Struct sm9::Sm9

source ·
pub struct Sm9;
Expand description

SM9 identity-based cryptographic

Implementations§

source§

impl Sm9

source

pub fn generate_master_private_key_to_pem(ke: &Fn, path: impl AsRef<Path>)

generate_master_private_key_to_pem file

source

pub fn generate_random_master_private_key_to_pem(path: impl AsRef<Path>)

generate_random_master_private_key_to_pem file

source

pub fn generate_master_public_key_to_pem( master_private_key_file: impl AsRef<Path>, master_public_key_file: impl AsRef<Path> )

generate_master_public_key_to_pem file

source

pub fn generate_user_private_key_to_pem( master_private_key_file: impl AsRef<Path>, user_id: &[u8], user_private_key_file: impl AsRef<Path> )

generate_user_private_key_to_pem file

source

pub fn generate_master_signature_public_key_to_pem( master_signature_private_key_file: impl AsRef<Path>, master_signature_public_key_file: impl AsRef<Path> )

generate_master_signature_public_key_to_pem file

source

pub fn generate_user_signature_private_key_to_pem( master_signature_private_key_file: impl AsRef<Path>, user_id: &[u8], user_signature_private_key_file: impl AsRef<Path> )

generate_user_signature_private_key_to_pem file

source

pub fn encrypt( master_public_key_file: impl AsRef<Path>, usr_id: &[u8], txt: &[u8] ) -> Vec<u8>

encrypt, difined in “SM9 identity-based cryptographic algorithms” Part 4: Key encapsulation mechanism and public key encryption algorithm 7.1.1 Encryption algorithm

source

pub fn decrypt( user_privte_key_file: impl AsRef<Path>, usr_id: &[u8], m: Vec<u8> ) -> Option<Vec<u8>>

decrypt, difined in “SM9 identity-based cryptographic algorithms” Part 4: Key encapsulation mechanism and public key encryption algorithm 7.2.1 Decryption algorithm

source

pub fn sign( master_signature_public_key_file: impl AsRef<Path>, user_signature_privte_key_file: impl AsRef<Path>, m: &[u8] ) -> Signature

sign, difined in “SM9 identity-based cryptographic algorithms” Part 2: Digital signature algorithm 6.1 Digital signature generation algorithm

source

pub fn verify( master_signature_public_key_file: impl AsRef<Path>, user_id: &[u8], m: &[u8], sig: &Signature ) -> bool

verify, difined in “SM9 identity-based cryptographic algorithms” Part 2: Digital signature algorithm 7.1 Digital signature verification algorithm

Auto Trait Implementations§

§

impl RefUnwindSafe for Sm9

§

impl Send for Sm9

§

impl Sync for Sm9

§

impl Unpin for Sm9

§

impl UnwindSafe for Sm9

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V