-
Notifications
You must be signed in to change notification settings - Fork 1.2k
StreamingAead with KEK URI #527
Comments
I'm having the same issue. A different application is writing to GCS using StreamingAead. And a different application is reading the encrypted file. Streaming AED works when I'm using the same KeysetHandle when encrypting and decrypting the file.
I'm just starting out on using Tink and GCP in general, so possibly I'm missing something obvious. I think I can store the keys in KMS (https://github.com/google/tink/blob/v1.2.2/docs/JAVA-HOWTO.md#storing-keysets). But I wonder why I can't use the KEK URI for streaming Aead like I can for Aead. Edit: This link and the corresponding GitHub code helped me figure it out. |
Hello, I'm searching for the same functionality. I currently have some code (in golang in my case) using the AEAD envelope with a Google KMS Key URI, which works very well, but I'm trying to do the same with a streaming AEAD instead. Is it possible? |
I'm also interested in having a StreamingAead implementation that encrypts a stream using a key encrypted by a KMS. Is this something that is on the Tink roadmap? If not, is this a feature that would be accepted as a contribution? |
It is currently not possible to create an "EnvelopeStreamingAead" primitive, and we also don't plan to add this functionality. Also, we have some plans to change the API of Envelope encryption, and therefore we prefer not to add any feature to it at the moment. But you can do almost the same like this:
to decrypt, you do this:
The code is very similar to https://source.corp.google.com/piper///depot/google3/third_party/tink/java_src/examples/encryptedkeyset/EncryptedKeysetExample.java. The only difference to envelope encryption is that you will have to store two files (the encrypted keyset and the encrypted data) instead of just one. But this approach here is a bit more flexible, because you can for example use the StreamingAead primitive several times if you want, which will result in less calls to the KMS. Does this work for your use case? |
Hello, the code sample seems to be private. But i'm doing something similar to what you described, storing key sets n a separate bucket and encrypting them with a KMS Key. I also added some code to deal with key rotation. PS: I was on parental leave, so I took time to go back to the problem ;) |
To clarify, the code sample referenced above can be found here: Or, in its new home here: |
Currently tink has only Aead KEK URI support.
Is there any example or support for StreamingAead with KEK URI?
below example is only having Aead as primitive, but we want to use StreamingAead with KEK URI.
https://github.com/google/tink/blob/master/examples/java_src/encryptedkeyset/EncryptedKeysetExample.java
if i try to use this snippet
to get StreamingAead instance i get below exception.
java.security.GeneralSecurityException: Primitive type com.google.crypto.tink.StreamingAead not supported by key manager of type class com.google.crypto.tink.aead.KmsAeadKeyManager, supported primitives: com.google.crypto.tink.Aead
Thanks for making this awesome lib :)
The text was updated successfully, but these errors were encountered: