use of com.google.crypto.tink.proto.KeyTemplate in project tink by google.
the class AeadKeyTemplatesTest method testAES128_GCM.
@Test
public void testAES128_GCM() throws Exception {
KeyTemplate template = AeadKeyTemplates.AES128_GCM;
assertEquals(AesGcmKeyManager.TYPE_URL, template.getTypeUrl());
assertEquals(OutputPrefixType.TINK, template.getOutputPrefixType());
AesGcmKeyFormat format = AesGcmKeyFormat.parseFrom(template.getValue());
assertEquals(16, format.getKeySize());
}
use of com.google.crypto.tink.proto.KeyTemplate in project tink by google.
the class AeadKeyTemplatesTest method testAES256_GCM.
@Test
public void testAES256_GCM() throws Exception {
KeyTemplate template = AeadKeyTemplates.AES256_GCM;
assertEquals(AesGcmKeyManager.TYPE_URL, template.getTypeUrl());
assertEquals(OutputPrefixType.TINK, template.getOutputPrefixType());
AesGcmKeyFormat format = AesGcmKeyFormat.parseFrom(template.getValue());
assertEquals(32, format.getKeySize());
}
use of com.google.crypto.tink.proto.KeyTemplate in project tink by google.
the class AeadKeyTemplatesTest method testAES256_EAX.
@Test
public void testAES256_EAX() throws Exception {
KeyTemplate template = AeadKeyTemplates.AES256_EAX;
assertEquals(AesEaxKeyManager.TYPE_URL, template.getTypeUrl());
assertEquals(OutputPrefixType.TINK, template.getOutputPrefixType());
AesEaxKeyFormat format = AesEaxKeyFormat.parseFrom(template.getValue());
assertEquals(32, format.getKeySize());
assertTrue(format.hasParams());
assertEquals(16, format.getParams().getIvSize());
}
use of com.google.crypto.tink.proto.KeyTemplate in project tink by google.
the class StreamingAeadKeyTemplatesTest method testAES256_GCM_HKDF_4KB.
@Test
public void testAES256_GCM_HKDF_4KB() throws Exception {
KeyTemplate template = StreamingAeadKeyTemplates.AES256_GCM_HKDF_4KB;
assertEquals(AesGcmHkdfStreamingKeyManager.TYPE_URL, template.getTypeUrl());
assertEquals(OutputPrefixType.RAW, template.getOutputPrefixType());
AesGcmHkdfStreamingKeyFormat format = AesGcmHkdfStreamingKeyFormat.parseFrom(template.getValue());
assertEquals(32, format.getKeySize());
assertEquals(32, format.getParams().getDerivedKeySize());
assertEquals(HashType.SHA256, format.getParams().getHkdfHashType());
assertEquals(4096, format.getParams().getCiphertextSegmentSize());
}
use of com.google.crypto.tink.proto.KeyTemplate in project tink by google.
the class StreamingAeadKeyTemplatesTest method testAES256_CTR_HMAC_SHA256_4KB.
@Test
public void testAES256_CTR_HMAC_SHA256_4KB() throws Exception {
KeyTemplate template = StreamingAeadKeyTemplates.AES256_CTR_HMAC_SHA256_4KB;
assertEquals(AesCtrHmacStreamingKeyManager.TYPE_URL, template.getTypeUrl());
assertEquals(OutputPrefixType.RAW, template.getOutputPrefixType());
AesCtrHmacStreamingKeyFormat format = AesCtrHmacStreamingKeyFormat.parseFrom(template.getValue());
assertEquals(32, format.getKeySize());
assertEquals(32, format.getParams().getDerivedKeySize());
assertEquals(HashType.SHA256, format.getParams().getHkdfHashType());
assertEquals(4096, format.getParams().getCiphertextSegmentSize());
assertEquals(HashType.SHA256, format.getParams().getHmacParams().getHash());
assertEquals(32, format.getParams().getHmacParams().getTagSize());
}
Aggregations