#cryptography #tink #signature

tink-signature

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

6 releases

0.2.4 Mar 25, 2022
0.2.1 Oct 8, 2021
0.2.0 May 24, 2021
0.1.2 May 19, 2021
0.1.0 Jan 21, 2021

#702 in Cryptography

Download history 33/week @ 2022-06-16 30/week @ 2022-06-23 54/week @ 2022-06-30 63/week @ 2022-07-07 29/week @ 2022-07-14 57/week @ 2022-07-21 57/week @ 2022-07-28 52/week @ 2022-08-04 66/week @ 2022-08-11 97/week @ 2022-08-18 56/week @ 2022-08-25 44/week @ 2022-09-01 90/week @ 2022-09-08 50/week @ 2022-09-15 132/week @ 2022-09-22 56/week @ 2022-09-29

334 downloads per month
Used in rinkey

Apache-2.0

255KB
4K 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

~5MB
~106K SLoC