Search in sources :

Example 1 with AesCmacPrfKeyFormat

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);
}
Also used : AesCmacPrfKeyFormat(com.google.crypto.tink.proto.AesCmacPrfKeyFormat) KeyTemplate(com.google.crypto.tink.KeyTemplate) Test(org.junit.Test)

Example 2 with AesCmacPrfKeyFormat

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());
}
Also used : AesCmacPrfKeyFormat(com.google.crypto.tink.proto.AesCmacPrfKeyFormat) Test(org.junit.Test)

Example 3 with AesCmacPrfKeyFormat

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());
}
Also used : AesCmacPrfKey(com.google.crypto.tink.proto.AesCmacPrfKey) AesCmacPrfKeyFormat(com.google.crypto.tink.proto.AesCmacPrfKeyFormat) Test(org.junit.Test)

Aggregations

AesCmacPrfKeyFormat (com.google.crypto.tink.proto.AesCmacPrfKeyFormat)3 Test (org.junit.Test)3 KeyTemplate (com.google.crypto.tink.KeyTemplate)1 AesCmacPrfKey (com.google.crypto.tink.proto.AesCmacPrfKey)1