#signature #tink

tink-signature

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

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

#1707 in Cryptography

Download history 5/week @ 2024-02-22 4/week @ 2024-02-29 4/week @ 2024-03-07 3/week @ 2024-03-14 3/week @ 2024-03-21 7/week @ 2024-03-28 8/week @ 2024-04-04 74/week @ 2024-04-11

92 downloads per month
Used in rinkey

Apache-2.0

280KB
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

~6–8.5MB
~158K SLoC