Search in sources :

Example 1 with KmsAeadKeyFormat

use of com.google.crypto.tink.proto.KmsAeadKeyFormat in project tink by google.

the class AeadKeyTemplatesTest method testCreateKmsAeadKeyTemplate.

@Test
public void testCreateKmsAeadKeyTemplate() throws Exception {
    // Intentionally using "weird" or invalid values for parameters,
    // to test that the function correctly puts them in the resulting template.
    String keyUri = "some example URI";
    KeyTemplate template = AeadKeyTemplates.createKmsAeadKeyTemplate(keyUri);
    assertEquals(KmsAeadKeyManager.TYPE_URL, template.getTypeUrl());
    assertEquals(OutputPrefixType.TINK, template.getOutputPrefixType());
    KmsAeadKeyFormat format = KmsAeadKeyFormat.parseFrom(template.getValue());
    assertEquals(keyUri, format.getKeyUri());
}
Also used : KmsAeadKeyFormat(com.google.crypto.tink.proto.KmsAeadKeyFormat) KeyTemplate(com.google.crypto.tink.proto.KeyTemplate) Test(org.junit.Test)

Aggregations

KeyTemplate (com.google.crypto.tink.proto.KeyTemplate)1 KmsAeadKeyFormat (com.google.crypto.tink.proto.KmsAeadKeyFormat)1 Test (org.junit.Test)1