|author||Jerry Belton <email@example.com>||Tue Nov 29 00:40:13 2022 +0000|
|committer||CQ Bot <firstname.lastname@example.org>||Tue Nov 29 19:02:45 2022 +0000|
[licenses] Add path to LICENSE file in README.fuchsia. This makes it easier for license checking tools to find the correct license file. More info: http://shortn/_S8Rzw4fSCw Change-Id: I583e96bcdebde7335b3dfdc68bb4f9d19e6a81f7 Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/tink/+/767683 Reviewed-by: Yuxiao Sun <email@example.com> Commit-Queue: Jerry Belton <firstname.lastname@example.org>
A multi-language, cross-platform library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.
Using crypto in your application shouldn't have to feel like juggling chainsaws in the dark. Tink is a crypto library written by a group of cryptographers and security engineers at Google. It was born out of our extensive experience working with Google's product teams, fixing weaknesses in implementations, and providing simple APIs that can be used safely without needing a crypto background.
Tink provides secure APIs that are easy to use correctly and hard(er) to misuse. It reduces common crypto pitfalls with user-centered design, careful implementation and code reviews, and extensive testing. At Google, Tink is already being used to secure data of many products such as AdMob, Google Pay, Google Assistant, Firebase, the Android Search App, etc.
Tink performs cryptographic tasks via so-called primitives, each of which is defined via a corresponding interface that specifies the functionality of the primitive. For example, symmetric key encryption is offered via an AEAD-primitive (Authenticated Encryption with Associated Data), that supports two operations:
encrypt(plaintext, associated_data), which encrypts the given
associated_dataas additional AEAD-input) and returns the resulting ciphertext
decrypt(ciphertext, associated_data), which decrypts the given
associated_dataas additional AEAD-input) and returns the resulting plaintext
Before implementations of primitives can be used, they must be registered at runtime with Tink, so that Tink “knows” the desired implementations. Here's how you can register all implementations of all primitives in Tink:
import com.google.crypto.tink.config.TinkConfig; TinkConfig.register();
After implementations of primitives have been registered, the basic use of Tink proceeds in three steps:
Keysetin Tink terms).
Here is how these steps would look like when encrypting or decrypting with an AEAD primitive in Java:
import com.google.crypto.tink.Aead; import com.google.crypto.tink.KeysetHandle; import com.google.crypto.tink.aead.AeadKeyTemplates; // 1. Generate the key material. KeysetHandle keysetHandle = KeysetHandle.generateNew( AeadKeyTemplates.AES128_GCM); // 2. Get the primitive. Aead aead = keysetHandle.getPrimitive(Aead.class); // 3. Use the primitive. byte ciphertext = aead.encrypt(plaintext, associatedData);
Out of the box Tink supports a wide range of languages, but it still doesn‘t support every language. Fortunately, some users like Tink so much that they’ve ported it to their favorite languages! Below you can find notable ports.
WARNING While we usually review these ports, until further notice, we do not maintain them and have no plan to support them in the foreseeable future.
If you want to contribute, please read CONTRIBUTING and send us pull requests. You can also report bugs or file feature requests.
If you'd like to talk to the developers or get notified about major product updates, you may want to subscribe to our mailing list. To join, simply send an empty email to email@example.com.
Tink is maintained by (A-Z):