tink-signature

Crates.iotink-signature
lib.rstink-signature
version0.3.0
sourcesrc
created_at2021-01-21 11:18:15.13457
updated_at2024-11-28 11:37:36.632835
descriptionSignature functionality for Rust port of Google's Tink cryptography library
homepage
repositoryhttps://github.com/project-oak/tink-rust
max_upload_size
id344848
size62,358
(conradgrobler)

documentation

https://docs.rs/tink-signature

README

Tink-Rust: Digital Signatures

Docs MSRV

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

Apache License, Version 2.0

Disclaimer

This is not an officially supported Google product.

Commit count: 765

cargo fmt