[][src]Function exonum_crypto::verify

pub fn verify(sig: &Signature, data: &[u8], pubkey: &PublicKey) -> bool

Verifies that data is signed with a secret key corresponding to the given public key.

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));