commit | 7c93e5baf167d22e355974ee49bd823bc48d12f7 | [log] [tgz] |
---|---|---|
author | Alexandre Zani <azani@google.com> | Wed Feb 20 14:07:35 2019 -0800 |
committer | Alexandre Zani <azani@google.com> | Thu Feb 21 15:47:56 2019 -0800 |
tree | bdcc40b30fdfe6277487073280341739b1f3d09d | |
parent | 35fc16f7254b90d89b2ba23b569d541fe53511d9 [diff] | |
parent | cccd37108a57963ad01d733ae3ac32cdc0383408 [diff] |
Merge changes from upstream. Replaced convert_bazel with convert_for_cobalt. convert_for_cobalt has two main differences with convert_bazel: 1. convert_for_cobalt uses the fact that BUILD.blaze files are written in StarLark which is a subset of Python. Instead of directly parsing the files, we create a python environment which gathers the necessary information and execute the BUILD.blaze files in that environment. 2. convert_for_cobalt does not attempt to convert every single target in the tink repository. Instead, it takes a list of starting targets and attempts to convert those targets and their transitive dependencies. This makes updating Tink easier since we try to convert much fewer targets. In addition, convert_for_cobalt has the ability to exclude certain targets that are unused and problematic, even if they are in the transitive closure of the targets we do want. This is handled only when it comes to build files. If a build target is actually needed by the build, you're on your own. Finally, convert_for_cobalt can symbolically move targets in order to cope with CMake's idiosyncracies. Note: convert_for_cobalt does not currentl support BUILD.gn. I will add BUILD.gn support later. Commands: git clone https://fuchsia.googlesource.com/third_party/tink cd tink git checkout origin/master -b ${USER}-merge git merge FETCH_HEAD ./tools/convert_for_cobalt Manual Change: It looks like Tink has adopted a dependency on a version of boringssl we don't have yet. In order to cope with this, I had to create a dummy function called EVP_aead_xchacha20_poly1305 which can be found in cc/subtle/xchacha20_poly1305_boringssl.cc It should crash the program if used. We can upgrade BoringSSL separately. Change-Id: I1204520b74e87b73ecaa6533245ffe82d34e3474
A multi-language, cross-platform library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.
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.
To get a quick overview of Tink design please take a look at slides from a talk about Tink presented at Real World Crypto 2019.
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.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);
Java and Android, C++ and Obj-C are field tested and ready for production. The latest version is 1.2.2, released on 2019-01-24.
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):