Skip to content

Commit

Permalink
Change Tink Java examples to use the most recent recommended APIs for…
Browse files Browse the repository at this point in the history
… `KeysetHandle::getPrimitive`.

PiperOrigin-RevId: 691749033
Change-Id: I2c7bc35b8943a130f0f66c8fc297864b5a5d69b8
  • Loading branch information
LizaTretyakova authored and copybara-github committed Oct 31, 2024
1 parent 97dda27 commit ec67d21
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/maven/src/main/java/com/helloworld/HelloWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.crypto.tink.Aead;
import com.google.crypto.tink.KeysetHandle;
import com.google.crypto.tink.KmsClient;
import com.google.crypto.tink.RegistryConfiguration;
import com.google.crypto.tink.TinkJsonProtoKeysetFormat;
import com.google.crypto.tink.aead.AeadConfig;
import com.google.crypto.tink.aead.PredefinedAeadParameters;
Expand Down Expand Up @@ -88,7 +89,7 @@ public static void main(String[] args) throws Exception {
createAndWriteEncryptedKeyset(keysetPath, keysetEncryptionAead);

KeysetHandle keysetHandle = readEncryptedKeyset(keysetPath, keysetEncryptionAead);
Aead aead = keysetHandle.getPrimitive(Aead.class);
Aead aead = keysetHandle.getPrimitive(RegistryConfiguration.get(), Aead.class);

byte[] ciphertext = aead.encrypt(plaintext, associatedData);
byte[] decrypted = aead.decrypt(ciphertext, associatedData);
Expand Down

0 comments on commit ec67d21

Please sign in to comment.