pub fn sign(data: &[u8], secret_key: &SecretKey) -> Signature
Expand description
Signs a slice of bytes using the signer’s secret key and returns the
resulting Signature
.
§Examples
The example below generates a pair of secret and public keys, indicates certain data, signs the data using the secret key and with the help of the public key verifies that the data have been signed with the corresponding secret key.
let (public_key, secret_key) = exonum_crypto::gen_keypair();
let data = [1, 2, 3];
let signature = exonum_crypto::sign(&data, &secret_key);
assert!(exonum_crypto::verify(&signature, &data, &public_key));