AesCtrHmacAeadKeyManager extends KeyTypeManager<AesCtrHmacAeadKey> { public static final KeyTemplate aes256CtrHmacSha256Template() { return createKeyTemplate(32, 16, 32, 32, HashType.SHA256); } AesCtrHmacAeadKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override void validateKey(AesCtrHmacAeadKey key); @Override AesCtrHmacAeadKey parseKey(ByteString byteString); @Override KeyFactory<AesCtrHmacAeadKeyFormat, AesCtrHmacAeadKey> keyFactory(); static void register(boolean newKeyAllowed); static final KeyTemplate aes128CtrHmacSha256Template(); static final KeyTemplate aes256CtrHmacSha256Template();  }
@Test public void testAes256CtrHmacSha256Template() throws Exception { KeyTemplate template = AesCtrHmacAeadKeyManager.aes256CtrHmacSha256Template(); assertEquals(new AesCtrHmacAeadKeyManager().getKeyType(), template.getTypeUrl()); assertEquals(KeyTemplate.OutputPrefixType.TINK, template.getOutputPrefixType()); AesCtrHmacAeadKeyFormat format = AesCtrHmacAeadKeyFormat.parseFrom( template.getValue(), ExtensionRegistryLite.getEmptyRegistry()); assertTrue(format.hasAesCtrKeyFormat()); assertTrue(format.getAesCtrKeyFormat().hasParams()); assertEquals(32, format.getAesCtrKeyFormat().getKeySize()); assertEquals(16, format.getAesCtrKeyFormat().getParams().getIvSize()); assertTrue(format.hasHmacKeyFormat()); assertTrue(format.getHmacKeyFormat().hasParams()); assertEquals(32, format.getHmacKeyFormat().getKeySize()); assertEquals(32, format.getHmacKeyFormat().getParams().getTagSize()); assertEquals(HashType.SHA256, format.getHmacKeyFormat().getParams().getHash()); }