8 releases
0.3.0 | Nov 28, 2024 |
---|---|
0.2.5 | Mar 14, 2023 |
0.2.4 | Mar 25, 2022 |
0.2.1 | Oct 8, 2021 |
0.1.0 | Jan 21, 2021 |
#1631 in Cryptography
149 downloads per month
Used in rinkey
275KB
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
~4.5–7MB
~128K SLoC