AesCmacPrfKeyManager extends KeyTypeManager<AesCmacPrfKey> { public static final KeyTemplate aes256CmacTemplate() { AesCmacPrfKeyFormat format = AesCmacPrfKeyFormat.newBuilder().setKeySize(32).build(); return KeyTemplate.create( new AesCmacPrfKeyManager().getKeyType(), format.toByteArray(), KeyTemplate.OutputPrefixType.RAW); } AesCmacPrfKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override void validateKey(AesCmacPrfKey key); @Override AesCmacPrfKey parseKey(ByteString byteString); @Override KeyFactory<AesCmacPrfKeyFormat, AesCmacPrfKey> keyFactory(); static void register(boolean newKeyAllowed); static final KeyTemplate aes256CmacTemplate();  }
@Test public void testAes256CmacTemplate() throws Exception { KeyTemplate template = AesCmacPrfKeyManager.aes256CmacTemplate(); assertThat(template.getTypeUrl()).isEqualTo(new AesCmacPrfKeyManager().getKeyType()); assertThat(template.getOutputPrefixType()).isEqualTo(KeyTemplate.OutputPrefixType.RAW); AesCmacPrfKeyFormat format = AesCmacPrfKeyFormat.parseFrom( template.getValue(), ExtensionRegistryLite.getEmptyRegistry()); assertThat(format.getKeySize()).isEqualTo(32); }
@Test public void testKeyTemplateAndManagerCompatibility() throws Exception { AesCmacPrfKeyManager manager = new AesCmacPrfKeyManager(); testKeyTemplateCompatible(manager, AesCmacPrfKeyManager.aes256CmacTemplate()); }