use of com.google.crypto.tink.KeyTemplate in project tink by google.
the class EcdsaSignKeyManagerTest method testEcdsaP256Template.
@Test
public void testEcdsaP256Template() throws Exception {
KeyTemplate template = EcdsaSignKeyManager.ecdsaP256Template();
assertThat(template.getTypeUrl()).isEqualTo(new EcdsaSignKeyManager().getKeyType());
assertThat(template.getOutputPrefixType()).isEqualTo(KeyTemplate.OutputPrefixType.TINK);
EcdsaKeyFormat format = EcdsaKeyFormat.parseFrom(template.getValue(), ExtensionRegistryLite.getEmptyRegistry());
assertThat(format.hasParams()).isTrue();
assertThat(format.getParams().getHashType()).isEqualTo(HashType.SHA256);
assertThat(format.getParams().getCurve()).isEqualTo(EllipticCurveType.NIST_P256);
assertThat(format.getParams().getEncoding()).isEqualTo(EcdsaSignatureEncoding.DER);
}
use of com.google.crypto.tink.KeyTemplate in project tink by google.
the class EcdsaSignKeyManagerTest method testRawEcdsaP256Template.
@Test
public void testRawEcdsaP256Template() throws Exception {
KeyTemplate template = EcdsaSignKeyManager.rawEcdsaP256Template();
assertThat(template.getTypeUrl()).isEqualTo(new EcdsaSignKeyManager().getKeyType());
assertThat(template.getOutputPrefixType()).isEqualTo(KeyTemplate.OutputPrefixType.RAW);
EcdsaKeyFormat format = EcdsaKeyFormat.parseFrom(template.getValue(), ExtensionRegistryLite.getEmptyRegistry());
assertThat(format.hasParams()).isTrue();
assertThat(format.getParams().getHashType()).isEqualTo(HashType.SHA256);
assertThat(format.getParams().getCurve()).isEqualTo(EllipticCurveType.NIST_P256);
assertThat(format.getParams().getEncoding()).isEqualTo(EcdsaSignatureEncoding.IEEE_P1363);
}
use of com.google.crypto.tink.KeyTemplate in project tink by google.
the class Ed25519PrivateKeyManagerTest method testRawEd25519Template.
@Test
public void testRawEd25519Template() throws Exception {
KeyTemplate template = Ed25519PrivateKeyManager.rawEd25519Template();
assertThat(template.getTypeUrl()).isEqualTo(new Ed25519PrivateKeyManager().getKeyType());
assertThat(template.getOutputPrefixType()).isEqualTo(KeyTemplate.OutputPrefixType.RAW);
Ed25519KeyFormat unused = Ed25519KeyFormat.parseFrom(template.getValue(), ExtensionRegistryLite.getEmptyRegistry());
}
use of com.google.crypto.tink.KeyTemplate in project tink by google.
the class Ed25519PrivateKeyManagerTest method testEd25519Template.
@Test
public void testEd25519Template() throws Exception {
KeyTemplate template = Ed25519PrivateKeyManager.ed25519Template();
assertThat(template.getTypeUrl()).isEqualTo(new Ed25519PrivateKeyManager().getKeyType());
assertThat(template.getOutputPrefixType()).isEqualTo(KeyTemplate.OutputPrefixType.TINK);
Ed25519KeyFormat unused = Ed25519KeyFormat.parseFrom(template.getValue(), ExtensionRegistryLite.getEmptyRegistry());
}
use of com.google.crypto.tink.KeyTemplate in project tink by google.
the class AesGcmHkdfStreamingKeyManagerTest method testAes128GcmHkdf1MBTemplate.
@Test
public void testAes128GcmHkdf1MBTemplate() throws Exception {
KeyTemplate template = AesGcmHkdfStreamingKeyManager.aes128GcmHkdf1MBTemplate();
assertThat(template.getTypeUrl()).isEqualTo(new AesGcmHkdfStreamingKeyManager().getKeyType());
assertThat(template.getOutputPrefixType()).isEqualTo(KeyTemplate.OutputPrefixType.RAW);
AesGcmHkdfStreamingKeyFormat format = AesGcmHkdfStreamingKeyFormat.parseFrom(template.getValue(), ExtensionRegistryLite.getEmptyRegistry());
assertThat(format.getKeySize()).isEqualTo(16);
assertThat(format.getParams().getDerivedKeySize()).isEqualTo(16);
assertThat(format.getParams().getHkdfHashType()).isEqualTo(HashType.SHA256);
assertThat(format.getParams().getCiphertextSegmentSize()).isEqualTo(1 << 20);
}
Aggregations