commit | 49e8266fc2a417a8c2abe8b5768e6db1febe58f4 | [log] [tgz] |
---|---|---|
author | Mitch Rudominer <rudominer@google.com> | Fri Sep 07 10:04:25 2018 -0700 |
committer | Mitch Rudominer <rudominer@google.com> | Fri Sep 07 10:04:25 2018 -0700 |
tree | 61154369b2d34e4cb352794795c2140e53c1a380 | |
parent | cd565494d398740b9ddb11ca74ca0b2a8f44acac [diff] |
Adds build logic for several more Tink libraries - subtle/common - util/errors - util/enums Also builds the tests. This required adding infrastructure for compiling the protos. Also we are changing strategy on how this is incorporated into the Cobalt build. We will now use add_subdirectory() instead of ExternalProject_Add. I couldn't make ExternalProject_Add work because of the dependency on ABSL. NOTE: There is one big problem we need to solve. Ostensibly there is a dependency on protobuf full as opposed to protobuf lite. This is not going to work for us on Fuchshia. We should reach out to the Tink folks about this. Change-Id: Ib73c2e37e56be17e60e39bf7f1ad1decb5ac402e
Ubuntu | macOS |
---|---|
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.
TIP The easiest way to get started with Tink is to install Bazel, then build, run and play with the hello world examples
.
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 plaintext
(using associated_data
as additional AEAD-input) and returns the resulting ciphertextdecrypt(ciphertext, associated_data)
, which decrypts the given ciphertext
(using associated_data
as additional AEAD-input) and returns the resulting plaintextBefore 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:
Keyset
in 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.AeadFactory; 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 = AeadFactory.getPrimitive(keysetHandle); // 3. Use the primitive. byte[] ciphertext = aead.encrypt(plaintext, aad);
Java and Android, C++ and Obj-C are field tested and ready for production. The latest version is 1.2.0, released on 2018-08-09.
Tink for Go and JavaScript are in active development.
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 tink-users+subscribe@googlegroups.com.
Tink is maintained by (A-Z):