use of com.google.crypto.tink.proto.AesCmacKeyFormat in project tink by google.
the class AesCmacKeyManagerTest method createKey_multipleTimes.
@Test
public void createKey_multipleTimes() throws Exception {
AesCmacKeyManager manager = new AesCmacKeyManager();
AesCmacKeyFormat keyFormat = makeAesCmacKeyFormat(32, 16);
assertThat(manager.keyFactory().createKey(keyFormat).getKeyValue()).isNotEqualTo(manager.keyFactory().createKey(keyFormat).getKeyValue());
}
use of com.google.crypto.tink.proto.AesCmacKeyFormat in project tink by google.
the class AesCmacKeyManagerTest method testRawAes256CmacTemplate.
@Test
public void testRawAes256CmacTemplate() throws Exception {
KeyTemplate template = AesCmacKeyManager.rawAes256CmacTemplate();
assertThat(template.getTypeUrl()).isEqualTo(new AesCmacKeyManager().getKeyType());
assertThat(template.getOutputPrefixType()).isEqualTo(KeyTemplate.OutputPrefixType.RAW);
AesCmacKeyFormat format = AesCmacKeyFormat.parseFrom(template.getValue(), ExtensionRegistryLite.getEmptyRegistry());
assertThat(format.getKeySize()).isEqualTo(32);
assertThat(format.getParams().getTagSize()).isEqualTo(16);
}
use of com.google.crypto.tink.proto.AesCmacKeyFormat in project tink by google.
the class AesCmacKeyManagerTest method createKey_checkValues.
@Test
public void createKey_checkValues() throws Exception {
AesCmacKeyFormat keyFormat = makeAesCmacKeyFormat(32, 16);
AesCmacKey key = new AesCmacKeyManager().keyFactory().createKey(keyFormat);
assertThat(key.getKeyValue()).hasSize(keyFormat.getKeySize());
assertThat(key.getParams().getTagSize()).isEqualTo(keyFormat.getParams().getTagSize());
}
use of com.google.crypto.tink.proto.AesCmacKeyFormat in project tink by google.
the class AesCmacKeyManagerTest method testAes256CmacTemplate.
@Test
public void testAes256CmacTemplate() throws Exception {
KeyTemplate template = AesCmacKeyManager.aes256CmacTemplate();
assertThat(template.getTypeUrl()).isEqualTo(new AesCmacKeyManager().getKeyType());
assertThat(template.getOutputPrefixType()).isEqualTo(KeyTemplate.OutputPrefixType.TINK);
AesCmacKeyFormat format = AesCmacKeyFormat.parseFrom(template.getValue(), ExtensionRegistryLite.getEmptyRegistry());
assertThat(format.getKeySize()).isEqualTo(32);
assertThat(format.getParams().getTagSize()).isEqualTo(16);
}
Aggregations