Search in sources :

Example 1 with KeysetTemplateRequest

use of com.google.crypto.tink.proto.testing.KeysetTemplateRequest in project tink by google.

the class TestingServicesTest method template_success.

@Test
public void template_success() throws Exception {
    KeysetTemplateRequest request = KeysetTemplateRequest.newBuilder().setTemplateName("AES256_GCM").build();
    KeysetTemplateResponse response = keysetStub.getTemplate(request);
    assertThat(response.getErr()).isEmpty();
    KeyTemplate template = KeyTemplateProtoConverter.fromByteArray(response.getKeyTemplate().toByteArray());
    assertThat(template.getTypeUrl()).isEqualTo("type.googleapis.com/google.crypto.tink.AesGcmKey");
}
Also used : KeysetTemplateResponse(com.google.crypto.tink.proto.testing.KeysetTemplateResponse) KeysetTemplateRequest(com.google.crypto.tink.proto.testing.KeysetTemplateRequest) KeyTemplate(com.google.crypto.tink.KeyTemplate) Test(org.junit.Test)

Example 2 with KeysetTemplateRequest

use of com.google.crypto.tink.proto.testing.KeysetTemplateRequest in project tink by google.

the class TestingServicesTest method template_not_found.

@Test
public void template_not_found() throws Exception {
    KeysetTemplateRequest request = KeysetTemplateRequest.newBuilder().setTemplateName("UNKNOWN_TEMPLATE").build();
    KeysetTemplateResponse response = keysetStub.getTemplate(request);
    assertThat(response.getErr()).isNotEmpty();
}
Also used : KeysetTemplateResponse(com.google.crypto.tink.proto.testing.KeysetTemplateResponse) KeysetTemplateRequest(com.google.crypto.tink.proto.testing.KeysetTemplateRequest) Test(org.junit.Test)

Aggregations

KeysetTemplateRequest (com.google.crypto.tink.proto.testing.KeysetTemplateRequest)2 KeysetTemplateResponse (com.google.crypto.tink.proto.testing.KeysetTemplateResponse)2 Test (org.junit.Test)2 KeyTemplate (com.google.crypto.tink.KeyTemplate)1