7 releases
0.2.5 | Mar 14, 2023 |
---|---|
0.2.4 | Mar 25, 2022 |
0.2.1 | Oct 8, 2021 |
0.2.0 | May 24, 2021 |
0.1.0 | Jan 21, 2021 |
#1968 in Cryptography
Used in rinkey
280KB
4.5K
SLoC
Tink-Rust: Digital Signatures
This crate provides digital signature functionality, as described in the upstream Tink documentation.
Usage
fn main() -> Result<(), Box<dyn Error>> {
tink_signature::init();
// Other key templates can also be used.
let kh = tink_core::keyset::Handle::new(&tink_signature::ecdsa_p256_key_template())?;
let s = tink_signature::new_signer(&kh)?;
let pt = b"this data needs to be signed";
let a = s.sign(pt)?;
println!("'{}' => {}", String::from_utf8_lossy(pt), hex::encode(&a));
let pubkh = kh.public()?;
let v = tink_signature::new_verifier(&pubkh)?;
assert!(v.verify(&a, b"this data needs to be signed").is_ok());
println!("Signature verified.");
Ok(())
}
License
Disclaimer
This is not an officially supported Google product.
Dependencies
~6–8.5MB
~157K SLoC