#signature #tink

tink-signature

Signature functionality for Rust port of Google's Tink cryptography library

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

Download history 4/week @ 2024-09-23 8/week @ 2024-09-30 123/week @ 2024-11-25 26/week @ 2024-12-02

149 downloads per month
Used in rinkey

Apache-2.0

275KB
4.5K SLoC

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.

Dependencies

~4.5–7MB
~128K SLoC