diff options
author | tholenst <tholenst@google.com> | 2023-07-21 00:22:31 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-07-21 00:23:30 -0700 |
commit | b3ccf388b00041c910449d34e882bb2cfee73dcf (patch) | |
tree | 6291a75f254cba805fa7fd7d57cc5b9464af4e7d /java_src/src/test | |
parent | 63fe69f9576bce3aa23e2e11d906a0705540a66a (diff) | |
download | tink-b3ccf388b00041c910449d34e882bb2cfee73dcf.tar.gz |
Replace some calls to "KeyTemplate.create" with "KeyTemplate.createFrom", taking a Parameters object.
The call to "create" will be deprecated. Note: if a user calls e.g. AesGcmKeyManager.aes128GcmTemplate() without registering the proto serialization, before this CL, it was possible to get the serialized version. After this CL, this will break.
I don't think this should be an issue since users basically always register everything anyhow.
PiperOrigin-RevId: 549859554
Diffstat (limited to 'java_src/src/test')
-rw-r--r-- | java_src/src/test/java/com/google/crypto/tink/internal/BUILD.bazel | 1 | ||||
-rw-r--r-- | java_src/src/test/java/com/google/crypto/tink/internal/KeyTemplateProtoConverterTest.java | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/java_src/src/test/java/com/google/crypto/tink/internal/BUILD.bazel b/java_src/src/test/java/com/google/crypto/tink/internal/BUILD.bazel index 5f6b30d6c..baca21c84 100644 --- a/java_src/src/test/java/com/google/crypto/tink/internal/BUILD.bazel +++ b/java_src/src/test/java/com/google/crypto/tink/internal/BUILD.bazel @@ -9,6 +9,7 @@ java_test( deps = [ "//proto:tink_java_proto", "//src/main/java/com/google/crypto/tink:key_template", + "//src/main/java/com/google/crypto/tink/aead:aead_config", "//src/main/java/com/google/crypto/tink/aead:aes_gcm_key_manager", "//src/main/java/com/google/crypto/tink/internal:key_template_proto_converter", "@maven//:com_google_protobuf_protobuf_java", diff --git a/java_src/src/test/java/com/google/crypto/tink/internal/KeyTemplateProtoConverterTest.java b/java_src/src/test/java/com/google/crypto/tink/internal/KeyTemplateProtoConverterTest.java index ffdd2e680..1c2d5f196 100644 --- a/java_src/src/test/java/com/google/crypto/tink/internal/KeyTemplateProtoConverterTest.java +++ b/java_src/src/test/java/com/google/crypto/tink/internal/KeyTemplateProtoConverterTest.java @@ -21,10 +21,12 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static org.junit.Assert.assertThrows; import com.google.crypto.tink.KeyTemplate; +import com.google.crypto.tink.aead.AeadConfig; import com.google.crypto.tink.aead.AesGcmKeyManager; import com.google.crypto.tink.proto.OutputPrefixType; import com.google.protobuf.ExtensionRegistryLite; import java.security.GeneralSecurityException; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -32,6 +34,10 @@ import org.junit.runners.JUnit4; /** Tests KeyTemplateProtoConverter. */ @RunWith(JUnit4.class) public final class KeyTemplateProtoConverterTest { + @BeforeClass + public static void register() throws Exception { + AeadConfig.register(); + } @Test public void toByteArrayFromByteArray_sameValues() throws Exception { |