Skip to content

Commit

Permalink
Remove the refaster templace which maps "readNoSecret(r)" to a method…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
tholenst authored and copybara-github committed Dec 5, 2023
1 parent d23625b commit 2dd58c5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
15 changes: 0 additions & 15 deletions tools/refaster/java/com/google/tink1_templates/AllChanges.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2dd58c5

Please sign in to comment.