From ec67d214975382feed30f804a2cc9603c0b548d8 Mon Sep 17 00:00:00 2001 From: Liza Tretyakova Date: Thu, 31 Oct 2024 04:11:15 -0700 Subject: [PATCH] Change Tink Java examples to use the most recent recommended APIs for `KeysetHandle::getPrimitive`. PiperOrigin-RevId: 691749033 Change-Id: I2c7bc35b8943a130f0f66c8fc297864b5a5d69b8 --- examples/maven/src/main/java/com/helloworld/HelloWorld.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/maven/src/main/java/com/helloworld/HelloWorld.java b/examples/maven/src/main/java/com/helloworld/HelloWorld.java index e8b07b6..b31ed4a 100644 --- a/examples/maven/src/main/java/com/helloworld/HelloWorld.java +++ b/examples/maven/src/main/java/com/helloworld/HelloWorld.java @@ -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; @@ -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);