Tink is a multi-language, cross-platform, open source library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.

Tink

A multi-language, cross-platform library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.

https://developers.google.com/tink

Ubuntu macOS
Kokoro Ubuntu Kokoro macOS

Index

  1. Introduction
  2. Current status
  3. Getting started
  4. Learn more
  5. Contact and mailing list
  6. Maintainers

Introduction

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 one of the standard crypto libraries, and has been deployed in hundreds of products and systems.

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.

Current status

Java/Android, C++, Obj-C, Go, and Python are field tested and ready for production. The latest version is 1.6.1, released on 2021-07-12.

Javascript/Typescript is in an alpha state and should only be used for testing.

Getting started

Documentation for the project is located at https://developers.google.com/tink. Currently, it details a variety of common usage scenarios and covers the Java and Python implementations. The site will be populated with more content over time.

Alternatively, you can look at all of the examples which demonstrate performing simple tasks using Tink in a variety of languages.

  • Python
pip3 install tink
  • Golang
go get github.com/google/tink/go/...
  • Java
<dependency>
  <groupId>com.google.crypto.tink</groupId>
  <artifactId>tink</artifactId>
  <version>1.6.1</version>
</dependency>
  • Android
dependencies {
  implementation 'com.google.crypto.tink:tink-android:1.6.1'
}
  • Objective-C/iOS
cd /path/to/your/Xcode project/
pod init
pod 'Tink', '1.6.1'
pod install

Learn more

Community-driven ports

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.

Contact and mailing list

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.

Maintainers

Tink is maintained by (A-Z):

  • Moreno Ambrosin
  • Taymon Beal
  • Daniel Bleichenbacher
  • William Conner
  • Thai Duong
  • Thomas Holenstein
  • Stefan Kölbl
  • Charles Lee
  • Cindy Lin
  • Fernando Lobato Meeser
  • Atul Luykx
  • Rafael Misoczki
  • Sophie Schmieg
  • Laurent Simon
  • Elizaveta Tretiakova
  • Jürg Wullschleger

Alumni:

  • Haris Andrianakis
  • Tanuj Dhir
  • Quan Nguyen
  • Bartosz Przydatek
  • Enzo Puig
  • Veronika Slívová
  • Paula Vidas
Comments
  • Add more Keyset Manager functionality to Go

    Add more Keyset Manager functionality to Go

    - brings Java KeysetManager functions to Go: Add, Enable, Disable, Delete, Destroy and SetPrimary
    - updates Rotate docs to 'Deprecated' point to Add & SetPrimary
    - mostly copies same Java tests/assertions
    
  • Proguard/R8 is stripping out fields from generated file class AesGcmKeyFormat

    Proguard/R8 is stripping out fields from generated file class AesGcmKeyFormat

    Coming from Tink 1.3.0 stable to Tink 1.4 RC2 (on Android), I noticed that the AesGcmKeyFormat has a possible problem with proguard/R8. We haven't added anything in our proguard-rules.pro file for Tink and am getting a stack trace like this

    java.lang.NoClassDefFoundError: com.google.crypto.tink.aead.AeadKeyTemplates
    	... 13 more
    Caused by: java.lang.NoClassDefFoundError: com.google.crypto.tink.aead.AeadKeyTemplates
    	at slack.commons.security.AeadPrimitiveFactoryImpl.getAeadPrimitive(AeadPrimitiveFactory.kt:4)
    	... 12 more
    Caused by: java.lang.ExceptionInInitializerError
    	at androidx.security.crypto.EncryptedSharedPreferences$PrefValueEncryptionScheme.
    <clinit>(EncryptedSharedPreferences.java:1)
            ... 11 more
    Caused by: java.lang.RuntimeException: Field version_ for com.google.crypto.tink.proto.AesGcmKeyFormat not found. Known fields are [public int com.google.crypto.tink.proto.AesGcmKeyFormat.keySize_, public static final com.google.crypto.tink.proto.AesGcmKeyFormat com.google.crypto.tink.proto.AesGcmKeyFormat.DEFAULT_INSTANCE, public static volatile com.google.crypto.tink.shaded.protobuf.Parser com.google.crypto.tink.proto.AesGcmKeyFormat.PARSER]
    	at com.google.crypto.tink.shaded.protobuf.MessageSchema.reflectField(MessageSchema.java:7)
    	at com.google.crypto.tink.shaded.protobuf.MessageSchema.newSchemaForRawMessageInfo(MessageSchema.java:53)
    	at com.google.crypto.tink.shaded.protobuf.MessageSchema.newSchema(MessageSchema.java:2)
    	at com.google.crypto.tink.shaded.protobuf.Protobuf.schemaFor(Protobuf.java:30)
    	at com.google.crypto.tink.shaded.protobuf.Protobuf.schemaFor(Protobuf.java:48)
    	at com.google.crypto.tink.shaded.protobuf.GeneratedMessageLite$Builder.buildPartial(GeneratedMessageLite.java:5)
    	at com.google.crypto.tink.shaded.protobuf.GeneratedMessageLite$Builder.build(GeneratedMessageLite.java:1)
    	at com.google.crypto.tink.aead.AeadKeyTemplates.createAesGcmKeyTemplate(AeadKeyTemplates.java:5)
    	at com.google.crypto.tink.aead.AeadKeyTemplates.<clinit>(AeadKeyTemplates.java:1)
    

    In the Android studio looking at the generated AesGcmKeyFormat, it has the _version

    package com.google.crypto.tink.proto;
    
    import ...;
    
    public final class AesGcmKeyFormat extends GeneratedMessageLite<AesGcmKeyFormat, AesGcmKeyFormat.Builder> implements AesGcmKeyFormatOrBuilder {
        public static final int KEY_SIZE_FIELD_NUMBER = 2;
        private int keySize_;
        public static final int VERSION_FIELD_NUMBER = 3;
        private int version_;
        private static final AesGcmKeyFormat DEFAULT_INSTANCE;
        private static volatile Parser<AesGcmKeyFormat> PARSER;
    
    ...
    }
    

    But when looking at the build APK with proguard/R8 running through it, seems like version_ was removed

    Screen Shot 2020-05-19 at 5 33 14 PM

    Seems like the AesSivKeyFormat has a similar problem as well.

    Screen Shot 2020-05-19 at 5 47 31 PM

    I'm going to also check if this problem might have existed in the 1.3 release of the library. But I haven't seen this stack trace before.

    We stricly use protobuf 3.12.0

    +--- com.google.protobuf:protobuf-java:{strictly 3.12.0} -> 3.12.0 (c)
    
    ...
    
    |    |    \--- com.google.protobuf:protobuf-javalite:3.12.0
    
    ...
    
    |    |    +--- com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.1
    |    |    |    +--- org.hamcrest:hamcrest-core:1.3 -> org.hamcrest:hamcrest:2.2
    |    |    |    \--- com.google.protobuf:protobuf-java:2.6.1 -> 3.12.0
    
  • PHP Implementation?

    PHP Implementation?

    I intend to follow this up with a pull request.

    Would the Tink team be interested in a PHP implementation of the same API? Obtensibly it would wrap both the openssl and sodium extensions.

  • Python support release date

    Python support release date

    Is there any update on the release date for a version of Tink that supports Python? The roadmap states August 2019 as the intended date and that has come and gone...!

    It'd be good to have access to a release with Python support before January 2020 so old Python2 projects with Keyczar in can be migrated over to Python3 projects with Tink.

    Alternatively, if anybody has a suggestion for a suitable Python3 library to replace Keyczar in Python2 , that would be greatly appreciated!

    Regards,

    Jordan

  • [android] [throwable] arithmetic error in scalar multiplication

    [android] [throwable] arithmetic error in scalar multiplication

    we use Tink-Android to generate keyPair and sign our information. it work well in common case. but there is a crash in Android device M1 E when we use

    Ed25519Sign(private_key)
    

    and we find the throwable is

       // This check is to protect against flaws, i.e. if there is a computation error through a
        // faulty CPU or if the implementation contains a bug.
        XYZ result = new XYZ(ret);
        if (!result.isOnCurve()) {
          throw new IllegalStateException("arithmetic error in scalar multiplication");
        }
    

    https://github.com/google/tink/blob/09fc71c45dc7c4ecc7fb0df3414b0fb3a9ca52c3/java/src/main/java/com/google/crypto/tink/subtle/Ed25519.java#L626

    Android version: 7.0 cpu: Helio P10 gpu: ARM Mali-T860 Tink-Android Version: 1.2.2

    Is there anyone can help me ? thanks !

  • Android (tink : 1.3.0-rc3) KeyStoreException + UnrecoverableKeyException

    Android (tink : 1.3.0-rc3) KeyStoreException + UnrecoverableKeyException

    Hello,

    I'd like to report the follow exceptions happening with Android; we are using 1.3.0-rc3. I am not able to reproduce these issues; however they have been seen in the wild.

    OS Issue observed : Android 6,7,8,9 Devices : Samsung Galaxy S6, S7 edge. LG g4, g5, g6

    KeyStoreException (Invalid Key Blob) with stack trace :

    android.security.KeyStore.getKeyStoreException (KeyStore.java:708) android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStoreSecretKeyFromKeystore (AndroidKeyStoreProvider.java:283) android.security.keystore.AndroidKeyStoreSpi.engineGetKey (AndroidKeyStoreSpi.java:98) java.security.KeyStore.getKey (KeyStore.java:1062) com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm. (AndroidKeystoreAesGcm.java:48) com.google.crypto.tink.integration.android.AndroidKeystoreKmsClient.getAead (AndroidKeystoreKmsClient.java:111) com.google.crypto.tink.integration.android.AndroidKeystoreKmsClient.getOrGenerateNewAeadKey (AndroidKeystoreKmsClient.java:130) com.google.crypto.tink.integration.android.AndroidKeysetManager. (AndroidKeysetManager.java:118) com.google.crypto.tink.integration.android.AndroidKeysetManager. (AndroidKeysetManager.java:88) com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build (AndroidKeysetManager.java:185) com.loblaw.pcoptimum.android.app.utils.Crypto$AEAD.getAndroidKeysetManager (Crypto.java:204)

    KeyStoreException (Unknown error) with stack trace :

    android.security.KeyStore.getKeyStoreException (KeyStore.java:1107) android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStoreSecretKeyFromKeystore (AndroidKeyStoreProvider.java:283) android.security.keystore.AndroidKeyStoreSpi.engineGetKey (AndroidKeyStoreSpi.java:98) java.security.KeyStore.getKey (KeyStore.java:825) com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm. (AndroidKeystoreAesGcm.java:48) com.google.crypto.tink.integration.android.AndroidKeystoreKmsClient.getAead (AndroidKeystoreKmsClient.java:111) com.google.crypto.tink.integration.android.AndroidKeystoreKmsClient.getOrGenerateNewAeadKey (AndroidKeystoreKmsClient.java:130) com.google.crypto.tink.integration.android.AndroidKeysetManager. (AndroidKeysetManager.java:118) com.google.crypto.tink.integration.android.AndroidKeysetManager. (AndroidKeysetManager.java:88) com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build (AndroidKeysetManager.java:185)

    UnrecoverableKeyException (-49) with stack trace :

    android.security.KeyStore.getKeyStoreException (KeyStore.java:839) android.security.keystore.AndroidKeyStoreProvider.getKeyCharacteristics (AndroidKeyStoreProvider.java:236) android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStoreKeyFromKeystore (AndroidKeyStoreProvider.java:356) android.security.keystore.AndroidKeyStoreSpi.engineGetKey (AndroidKeyStoreSpi.java:101) java.security.KeyStore.getKey (KeyStore.java:1062) com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm. (AndroidKeystoreAesGcm.java:48) com.google.crypto.tink.integration.android.AndroidKeystoreKmsClient.getAead (AndroidKeystoreKmsClient.java:111) com.google.crypto.tink.integration.android.AndroidKeystoreKmsClient.getOrGenerateNewAeadKey (AndroidKeystoreKmsClient.java:130) com.google.crypto.tink.integration.android.AndroidKeysetManager. (AndroidKeysetManager.java:118) com.google.crypto.tink.integration.android.AndroidKeysetManager. (AndroidKeysetManager.java:88) com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build (AndroidKeysetManager.java:185)

  • GeneralSecurityException: decryption failed

    GeneralSecurityException: decryption failed

    GeneralSecurityException: decryption failed
      File "AeadWrapper.java", line 82, in decrypt
      File "TinkHelper.kt", line 33, in decrypt
    

    This error occurs with version 1.3.0-rc1 on an Android device running 9.0 but is fixed in versino 1.3.0-rc4. We can't upgrade to 1.3.0-rc4 because of https://github.com/google/tink/issues/301.

    Will the 1.3.0 release contain the fix for the decryption error but not the issue with firebase?

  • Protobuf related build issue with Tink + Firebase (Android)

    Protobuf related build issue with Tink + Firebase (Android)

    I am trying to integrate Tink to my Flutter app which also uses Firebase. With 1.3.0-rc3 I get this build errors in Android:

    Execution failed for task ':app:checkDevelopmentDebugDuplicateClasses'.
    > 1 exception was raised by workers:
      java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class com.google.protobuf.AbstractMessageLite found in modules protobuf-javalite-3.10.0.jar (com.google.protobuf:protobuf-javalite:3.10.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
      Duplicate class com.google.protobuf.AbstractMessageLite$Builder found in modules protobuf-javalite-3.10.0.jar (com.google.protobuf:protobuf-javalite:3.10.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
      Duplicate class com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream found in modules protobuf-javalite-3.10.0.jar (com.google.protobuf:protobuf-javalite:3.10.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
      Duplicate class com.google.protobuf.AbstractParser found in modules protobuf-javalite-3.10.0.jar (com.google.protobuf:protobuf-javalite:3.10.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
      Duplicate class com.google.protobuf.AbstractProtobufList found in modules protobuf-javalite-3.10.0.jar (com.google.protobuf:protobuf-javalite:3.10.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
      Duplicate class com.google.protobuf.Any found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and protobuf-javalite-3.10.0.jar (com.google.protobuf:protobuf-javalite:3.10.0)
    .
    .
    .
    

    I have tried various suggestions mentioned in other protobuf related issues here but no solution found so far.

    Issue disappears if I downgrade Tink to version 1.3.0-rc1, so I am using it as a workaround for now.

  • "go get" fails when specifying "latest" version as a Go module dependency

    The go/keyset API is not present in the latest release, which causes problems when trying to use go modules:

    GO111MODULE=on go get github.com/google/tink/go/keyset
    go: finding github.com/google/tink/go/keyset latest
    go: finding github.com/google/tink/go latest
    go get github.com/google/tink/go/keyset: no matching versions for query "latest"
    
  • On Android, when GeneralSecurityException

    On Android, when GeneralSecurityException "decryption failed" is thrown when calling AeadFactory::decrypt?

    Hi,

    Edit: we are using Tink 1.2.2.

    We have been getting crash reports with the exception GeneralSecurityException: decryption failed with the stack trace pointing to AeadFactory::decrypt as the source of the exception, and we are lost on when that happens.

    We are not sharing the keys or the cipher text, so, the same device and algorithm that encrypts it, is the same one that is decrypting it.

    We are also using the AndroidKeysetManager.

    The error seems to happen exclusively on Android 8 e 9 so far.

    Any idea on what may be causing this exception being thrown? Thank you :)

    Check our full implementation: https://gist.github.com/AllanHasegawa/85431b6f7c53074511527655712c9872

  • InvalidProtocolBufferException (Protocol message contained an invalid tag (zero))

    InvalidProtocolBufferException (Protocol message contained an invalid tag (zero))

    In my Android app, I see this exception happening on one device: Protocol message contained an invalid tag (zero)., com.google.crypto.tink.shaded.protobuf.InvalidProtocolBufferException

    Related code where the exception happens (Kotlin code from my Flutter plugin):

    .
    .
    .
    "encryptString" -> {
        uiScope.launch {
            try {
                var encryptedDataBase64String: String? = null
                withContext(Dispatchers.IO) {
                    initializeTink()
    
                    val applicationId = call.argument<String>("applicationId")
                            ?: throw IllegalArgumentException("applicationId")
                    val keySetName = call.argument<String>("keySetName")
                            ?: throw IllegalArgumentException("keySetName")
                    val dataString = call.argument<String>("data")
                            ?: throw IllegalArgumentException("data")
                    val passwordString = call.argument<String>("password")
    
                    val data = dataString.toByteArray(Charsets.UTF_8)
    
                    val password = passwordString!!.toByteArray(Charsets.UTF_8)
    
                    val keySetHandle = getOrGenerateNewKeysetHandle(applicationContext!!, applicationId, keySetName)
                    val aead = keySetHandle.getPrimitive(Aead::class.java)
    
                    val encryptedData = aead.encrypt(data, password)
    
                    encryptedDataBase64String = Base64.encodeToString(encryptedData, Base64.DEFAULT)
                }
                result.success(encryptedDataBase64String)
            } catch (e: Exception) {
                Log.e(LOG_TAG, "Exception", e)
                result.error(
                        "Exception",
                        e.localizedMessage ?: e.message ?: "$e", "$e")
            }
        }
    }
    
    

    Tink 1.4.0 Device: Huawei P20 / Android 10

    This is an user device so I cannot reproduce it myself (I see this from Crashlytics).

  • Envelope Encryption and DEK caching

    Envelope Encryption and DEK caching

    Is your feature request related to a problem?

    No

    What sort of feature would you like to see?

    I have a general question about using Tink and EnvelopeEncryption.

    I tried the example GOLANG-HOWTO.md#envelope-encryption, it works great.

    I wonder if it is possible, or if it is a roadmap feature to allow configuring reusing DEK for a set number of Encrypt() instead of creating a new DEK (and encrypted with remote KMS) for each Encrypt()

    I understand the best practices is to use a new DEK for each message to encrypt. However past a certain volume, I am considering balancing cost and security. Each DEK are encrypted with remote KMS, for high volume message, the KMS cost becomes significant.

    This feature would be very similar as the data key caching documented by AWS Encryption SDK DataKey Caching, ie allow configuring threshold to drive whether to re-use the DEK or not.

    Have you considered any alternative solutions?

    If this feature is not planned, i would really value pointers how best to customize tink to allow envelope encryption data key caching.

    I am wondering if the best place to extend tink is creating a new Key Manager similar than kms_envelope_aead_key_manager.go and add some sort of cache around in a newer version of KMSEnvelopeAEAD where before we generate a new DEK we get one from a cache if the reuse threshold is acceptable.

    Thanks! -seb

  • Build success on Windows (with cmake and mingw)

    Build success on Windows (with cmake and mingw)

    At first I tried bazel, but it seems its broken with the VS toolchain ( at least in versions 2017+ ).

    So cmake it is. For a saner build environment, I use msys2.

    msys2 includes a package manager 'pacman' for installing the dev tools and libraries required for building. Ensure you select the mingw variants of golang, gcc, and cmake, or you'll encounter build errors.

    You can get a list of packages with: pacman -Ss <package_name>

    For the most part, the build went well. It is missing unistd.h's 'pread' , and cc/util/util_test.cc makes use of file permissions not supported by Windows (specifically 'group' and 'other'). Those were the only two issues blocking compilation for me.

    I was able to get the aead_cli example working. Here is the CMakeLists.txt I used to build my exe.

    cmake_minimum_required(VERSION 3.5)
    project(aead_cli CXX)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    set(CMAKE_CXX_STANDARD 14)
    
    add_subdirectory(third_party/tink)
    add_subdirectory(util)
    
    add_executable(aead_cli aead_cli.cc)
    set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
    target_link_libraries(aead_cli tink::static absl::flags_parse util) 
    

    There is an issue with it trying to link in librt on my setup, which doesn't fly for Windows. For the time being, I just delete the -lrt in build.ninja file after running cmake -DCMAKE_GENERATOR=ninja

    I created a pull request #660 in case there's any interest by the tink devs.

    Screen Shot 2023-01-03 at 2 42 41 PM

  • Envelope AEAD with multiple KEKs and AEAD primitives

    Envelope AEAD with multiple KEKs and AEAD primitives

    I have a general question around best practices when dealing with multiple KEKs for envelope encryption.

    Background We have a centralised security solution that handles encryption for various tenants. Each tenant has 1 GCP KMS Key dedicated to it. The purpose of having separate KMS Keys for each tenant is to ensure secure data isolation and limit risk in events where the key is compromised etc.. etc...

    Scenario After securely identifying the tenant during a request, the centralised security solution picks the appropriate KEK (remote GCP KMS key) to process the request (i.e. encrypt the data). Specifically, it picks the right AEAD primitive instance that matches the tenant's KEK.

    With the Google Tink Library, the example docs to generate an AEAD primitive is:

    kekURI := "gcp-kms://.../.../.../my-cloud-kek-123"
    kmsClient, err := gcpkms.NewClient(kekURI)
    if err != nil {
    ...
    }
    
    registry.RegisterKMSClient(kmsClient)
    
    dek := aead.AES256GCMKeyTemplate()
    keyHandle, err := keyset.Handle(aead.KMSEnvelopeAEADKeyTemplate(kekURI)
    if err != nil {
    ...
    }
    
    aeadPrimitive, err := aead.New(keyHandle)
    if err != nil {
    ...
    }
    
    
    // We can finally use the AEAD primitive here for envelope encryption for a single KEK
    aead.Encrypt(....)
    aead.Decrypt(....)
    

    Now the code example above works fine for a single KEK, however we'd like to support multiple KEKs and be able to dynamically switch KEKs depending on the requests the "centralised security solution" receives for each tenant.

    N tenants = N KEK (GCP KMS keys)

    Note: The list of tenants can grow over time, its not a static number (N).

    The "centralised security solution" can receive concurrent requests (gRPC server) and must be able to handle concurrent requests without issues.

    Our initial approach to the problem is shown below:

    • we use sync.RWMutex to cache AEAD primitives
    • we went with caching AEAD primitives, on the assumption that creating a new primitive every single time from the URI would be wasteful/expensive, even if we used GetKMSClient from the registry to cache atleast the kmsClient bit (i.e. we'd still need to generate the keyHandle and AEAD primitive, even if KMSClient is cached in registry)
    • our cache is mostly read heavy (i.e. when the centralised security solution gRPC server boots up one more more instances - behind a load balancer - it would write to the cache once to initialise the AEAD primitive in cache, and then its purely reads from the cache going forward)
    • cache key is tenant ID
    • since sync.RWMutex supports multiple read locks, it would be ideal for a read heavy scenario
    type TenantAEADCache struct {
        mu sync.RWMutex
        
        cache map[string]tink.AEAD
    }
    
    func (t *TenantAEADCache) GetAEADPrimitive(tenant string) (tink.AEAD, error) {
        aeadPrimitive, err := t.GetAEADPrimitiveFromCache(tenant)
        if err != nil {
            return t.GenerateAndGetAEADPrimitive(tenant)
    
        }
        return aeadPrimitive, err
    }
    
    
    func (t *TenantAEADCache) GetAEADPrimitiveFromCache(tenant string) (tink.AEAD, error) {
        // read lock
        t.mu.RLock()
        defer t.mu.RLock()
       
        aeadPrimitive, ok := t.cache[tenant]
        if !ok {
            return nil, errors.New("not cached")
        }
        return aeadPrimitive, nil
    }
    
    func (t *TenantAEADCache) GenerateAndGetAEADPrimitive(tenant string) (tink.AEAD, error) {
        // write lock
        t.mu.Lock()
        defer t.mu.Lock()
    
        t.cache[tenant] = .... // generate an AEADPrimitive in a similar way to the first code example at the top
        
        return t.cache[tenant], nil
    }
    
    

    (please ignore any minor code issues, this was not a copy pasted snippet, just a best effort manually typed example)

    I'd like to learn about:

    • whether this approach will have any concurrency issues with the Google Tink Library?
    • whether the "registry" stuff could be of any help instead of the approach above?
    • when using the AEAD primitive, does it perform any mutex locks within the Google Tink Library when calling the Encrypt/Decrypt methods (which could become a bottleneck for the approach mentioned above)

    I've read through a bit of the code for KMSEnvelopeAEAD which seems to be the instance/concrete type of tink.AEAD that I'm working with. Would there be any locks or concurrency issues with the code below

    https://github.com/google/tink/blob/master/go/aead/kms_envelope_aead.go#L59-L129

    Alternatively, please let me know if there's a better approach to solving concurrent multi-tenant (multi KEK) envelope encryption with Google Tink.

    Regards

  • Bump certifi from 2022.9.24 to 2022.12.7 in /python/examples

    Bump certifi from 2022.9.24 to 2022.12.7 in /python/examples

    Bumps certifi from 2022.9.24 to 2022.12.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

  • Bump decode-uri-component from 0.2.0 to 0.2.2 in /javascript

    Bump decode-uri-component from 0.2.0 to 0.2.2 in /javascript

    Bumps decode-uri-component from 0.2.0 to 0.2.2.

    Release notes

    Sourced from decode-uri-component's releases.

    v0.2.2

    • Prevent overwriting previously decoded tokens 980e0bf

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.1...v0.2.2

    v0.2.1

    • Switch to GitHub workflows 76abc93
    • Fix issue where decode throws - fixes #6 746ca5d
    • Update license (#1) 486d7e2
    • Tidelift tasks a650457
    • Meta tweaks 66e1c28

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.1

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

whirlpool cryptographic hashing library

whirlpool.go A whirlpool hashing library for go Build status Setup $ go get github.com/jzelinskie/whirlpool Example package main import ( "fmt" "

Oct 12, 2022
Pure Go GOST cryptographic functions library.

Pure Go GOST cryptographic functions library. GOST is GOvernment STandard of Russian Federation (and Soviet Union). GOST 28147-89 (RFC 5830) block cip

Aug 10, 2022
Jan 7, 2023
goKryptor is a small and portable cryptographic tool for encrypting and decrypting files.

goKryptor goKryptor is a small and portable cryptographic tool for encrypting and decrypting files. This tool supports XOR and AES-CTR (Advanced Encry

Dec 6, 2021
Ekliptic - Primitives for cryptographic operations on the secp256k1 curve, with zero dependencies and excellent performance

Ekliptic This package provides primitives for cryptographic operations on the se

Sep 7, 2022
Go implementation of BLAKE2 (b) cryptographic hash function (optimized for 64-bit platforms).

Go implementation of BLAKE2b collision-resistant cryptographic hash function created by Jean-Philippe Aumasson, Samuel Neves, Zooko Wilcox-O'Hearn, an

Jul 11, 2022
Cryptographic Addition Chain Generation in Go

Cryptographic Addition Chain Generation in Go addchain generates short addition chains for exponents of cryptographic interest with results rivaling t

Dec 5, 2022
An out-of-the-box cryptographic message communication.

An out-of-the-box cryptographic message communication.

Feb 8, 2022
Arche - Smart Hybrid Workforce Manager: A system that aims to provide companies an easy to use platform for managing company resources by allowing employees to book company spaces and resources.
Arche - Smart Hybrid Workforce Manager: A system that aims to provide companies an easy to use platform for managing company resources by allowing employees to book company spaces and resources.

Description Smart Hybrid Workforce Manager is a system that aims to provide companies an easy to use system for managing company resources by allowing

Dec 8, 2022
An open source smart contract platform

EOSIO - The Most Powerful Infrastructure for Decentralized Applications Welcome to the EOSIO source code repository! This software enables businesses

Jan 7, 2023
Cross commerce challenge - Cross Commerce Store Challenge With Golang
Cross commerce challenge - Cross Commerce Store Challenge With Golang

Cross Commerce Store Desafio Simples Aplicação ETL Todo o código fonte está cont

Feb 13, 2022
ChainMaker, a blockchain platform for building secure

ChainMaker, a blockchain platform for building secure, trustworthy value-exchange networks to power the new global digital economy. ChainMaker aim

Nov 15, 2022
Simple, fast and safe cross-platform linear binary stream communication protocol. AES key exchange based on ecc secp256k1

FFAX Protocol 2 dev 简体中文 Welcome to FFAX Protocol v2 Quick start go get github.com/RealFax/FFAX func example() { listener, err := net.Listen("tcp",

Mar 21, 2022
A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability.
A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability.

A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability.

Jan 7, 2023
Easy to use encryption library for Go

encryptedbox EncryptedBox is an easy to use module for Go that can encrypt or sign any type of data. It is especially useful when you must serialize y

Jul 20, 2022
Easy to use crypto library with multiple algorithms

crypka Crypka is library, which abstracts away crypto, so one can easily do: Swap cryptosystems by swapping algorithm object in one place Easily and s

Mar 6, 2022
Security research and open source implementation of the Apple 'Wireless Accessory Configuration' (WAC) protocol
Security research and open source implementation of the Apple 'Wireless Accessory Configuration' (WAC) protocol

Apple 'Wireless Accessory Configuration' (WAC) research Introduction This repository contains some research on how the WAC protocol works. I was mostl

Jul 28, 2022
OpenZeppelin Contracts is a library for secure smart contract development.

A library for secure smart contract development. Build on a solid foundation of community-vetted code. Implementations of standards like ERC20 and ERC

Jan 5, 2023
An easy-to-use XChaCha20-encryption wrapper for io.ReadWriteCloser (even lossy UDP) using ECDH key exchange algorithm, ED25519 signatures and Blake3+Poly1305 checksums/message-authentication for Go (golang). Also a multiplexer.

Quick start Prepare keys (on both sides): [ -f ~/.ssh/id_ed25519 ] && [ -f ~/.ssh/id_ed25519.pub ] || ssh-keygen -t ed25519 scp ~/.ssh/id_ed25519.pub

Dec 30, 2022