use of com.google.crypto.tink.proto.AesCmacPrfKeyFormat in project tink by google.
the class AesCmacPrfKeyManagerTest method testAes256CmacTemplate.
@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);
}
use of com.google.crypto.tink.proto.AesCmacPrfKeyFormat in project tink by google.
the class AesCmacPrfKeyManagerTest method createKey_multipleTimes.
@Test
public void createKey_multipleTimes() throws Exception {
AesCmacPrfKeyManager manager = new AesCmacPrfKeyManager();
AesCmacPrfKeyFormat keyFormat = makeAesCmacPrfKeyFormat(32);
assertThat(manager.keyFactory().createKey(keyFormat).getKeyValue()).isNotEqualTo(manager.keyFactory().createKey(keyFormat).getKeyValue());
}
use of com.google.crypto.tink.proto.AesCmacPrfKeyFormat in project tink by google.
the class AesCmacPrfKeyManagerTest method createKey_checkValues.
@Test
public void createKey_checkValues() throws Exception {
AesCmacPrfKeyFormat keyFormat = makeAesCmacPrfKeyFormat(32);
AesCmacPrfKey key = new AesCmacPrfKeyManager().keyFactory().createKey(keyFormat);
assertThat(key.getKeyValue()).hasSize(keyFormat.getKeySize());
}
Aggregations