Search in sources :

Example 56 with Key

use of com.google.crypto.tink.proto.Keyset.Key in project tink by google.

the class PrimitiveSetTest method testAddPrimive_withUnknownPrefixType_shouldFail.

@Test
public void testAddPrimive_withUnknownPrefixType_shouldFail() throws Exception {
    PrimitiveSet<Mac> pset = PrimitiveSet.newPrimitiveSet(Mac.class);
    Key key1 = Key.newBuilder().setKeyId(1).setStatus(KeyStatusType.ENABLED).build();
    GeneralSecurityException e = assertThrows(GeneralSecurityException.class, () -> pset.addPrimitive(new DummyMac1(), key1));
    assertExceptionContains(e, "unknown output prefix type");
}
Also used : GeneralSecurityException(java.security.GeneralSecurityException) Key(com.google.crypto.tink.proto.Keyset.Key) Test(org.junit.Test)

Aggregations

Key (com.google.crypto.tink.proto.Keyset.Key)56 Test (org.junit.Test)44 KeysetHandle (com.google.crypto.tink.KeysetHandle)31 GeneralSecurityException (java.security.GeneralSecurityException)27 Aead (com.google.crypto.tink.Aead)11 DeterministicAead (com.google.crypto.tink.DeterministicAead)10 EcdsaPrivateKey (com.google.crypto.tink.proto.EcdsaPrivateKey)8 Keyset (com.google.crypto.tink.proto.Keyset)7 Mac (com.google.crypto.tink.Mac)6 PublicKeySign (com.google.crypto.tink.PublicKeySign)6 PublicKeyVerify (com.google.crypto.tink.PublicKeyVerify)6 AesGcmKey (com.google.crypto.tink.proto.AesGcmKey)6 EciesAeadHkdfPrivateKey (com.google.crypto.tink.proto.EciesAeadHkdfPrivateKey)6 HybridDecrypt (com.google.crypto.tink.HybridDecrypt)4 HybridEncrypt (com.google.crypto.tink.HybridEncrypt)4 AesGcmKeyFormat (com.google.crypto.tink.proto.AesGcmKeyFormat)4 EcPointFormat (com.google.crypto.tink.proto.EcPointFormat)4 EllipticCurveType (com.google.crypto.tink.proto.EllipticCurveType)4 HashType (com.google.crypto.tink.proto.HashType)4 KeyTemplate (com.google.crypto.tink.proto.KeyTemplate)4