| Crates.io | tink-signature |
| lib.rs | tink-signature |
| version | 0.3.0 |
| created_at | 2021-01-21 11:18:15.13457+00 |
| updated_at | 2024-11-28 11:37:36.632835+00 |
| description | Signature functionality for Rust port of Google's Tink cryptography library |
| homepage | |
| repository | https://github.com/project-oak/tink-rust |
| max_upload_size | |
| id | 344848 |
| size | 62,358 |
This crate provides digital signature functionality, as described in the upstream Tink documentation.
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(())
}
This is not an officially supported Google product.