From 2dd58c5eccce3786372d658b8471932b8da3c01c Mon Sep 17 00:00:00 2001 From: Thomas Holenstein Date: Tue, 5 Dec 2023 08:26:03 -0800 Subject: [PATCH] Remove the refaster templace which maps "readNoSecret(r)" to a method calling "read". I don't think users should do this -- we might remove read at some point in the future. PiperOrigin-RevId: 588079644 Change-Id: Ia867ab1363b1489e1b71248750b4fd98f9262b5f --- .../com/google/tink1_templates/AllChanges.java | 15 --------------- .../com/google/tinkuser/TinkUser.java_expected | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/tools/refaster/java/com/google/tink1_templates/AllChanges.java b/tools/refaster/java/com/google/tink1_templates/AllChanges.java index f49c4cf..cfe8fa5 100644 --- a/tools/refaster/java/com/google/tink1_templates/AllChanges.java +++ b/tools/refaster/java/com/google/tink1_templates/AllChanges.java @@ -18,7 +18,6 @@ import com.google.crypto.tink.BinaryKeysetReader; import com.google.crypto.tink.KeysetHandle; -import com.google.crypto.tink.KeysetReader; import com.google.crypto.tink.TinkProtoKeysetFormat; import com.google.crypto.tink.aead.AeadKeyTemplates; import com.google.crypto.tink.aead.PredefinedAeadParameters; @@ -66,20 +65,6 @@ public KeysetHandle afterTemplate(byte[] bytes) throws GeneralSecurityException, return TinkProtoKeysetFormat.parseKeysetWithoutSecret(bytes); } } - /** For any other reader, we can always just call read. */ - class CleanupKeysetHandleReadNoSecretReader { - @BeforeTemplate - public KeysetHandle beforeTemplate(KeysetReader reader) - throws GeneralSecurityException, IOException { - return KeysetHandle.readNoSecret(reader); - } - - @AfterTemplate - public KeysetHandle afterTemplate(KeysetReader reader) - throws GeneralSecurityException, IOException { - return TinkProtoKeysetFormat.parseKeysetWithoutSecret(reader.read().toByteArray()); - } - } class HMAC_SHA256_128BITTAG { @BeforeTemplate diff --git a/tools/refaster/java/com/google/tinkuser/TinkUser.java_expected b/tools/refaster/java/com/google/tinkuser/TinkUser.java_expected index 872202d..8df0efb 100644 --- a/tools/refaster/java/com/google/tinkuser/TinkUser.java_expected +++ b/tools/refaster/java/com/google/tinkuser/TinkUser.java_expected @@ -45,7 +45,7 @@ public final class TinkUser { return TinkProtoKeysetFormat.parseKeysetWithoutSecret(b).getPrimitive(Aead.class); } public Aead useAnyReader(KeysetReader r) throws GeneralSecurityException, IOException { - return TinkProtoKeysetFormat.parseKeysetWithoutSecret(r.read().toByteArray()).getPrimitive(Aead.class); + return KeysetHandle.readNoSecret(r).getPrimitive(Aead.class); } public void macKeyTemplateUser() throws Exception {