use of com.google.crypto.tink.proto.Keyset in project tink by google.
the class CompareKeysetsTest method testCompareKeysets_differentKeyIdButRawOutputPrefix_throws.
@Test
public void testCompareKeysets_differentKeyIdButRawOutputPrefix_throws() throws Exception {
Keyset keyset1 = Keyset.newBuilder().addKey(aesGcmKey(KEY_0, 18, KeyStatusType.ENABLED, OutputPrefixType.RAW)).setPrimaryKeyId(18).build();
Keyset keyset2 = Keyset.newBuilder().addKey(aesGcmKey(KEY_0, 17, KeyStatusType.ENABLED, OutputPrefixType.RAW)).setPrimaryKeyId(17).build();
try {
CompareKeysets.compareKeysets(keyset1, keyset2);
fail();
} catch (Exception e) {
// expected.
}
}
use of com.google.crypto.tink.proto.Keyset in project tink by google.
the class CompareKeysetsTest method testCompareKeysets_singleKeyDifferentOutputPrefix_throws.
@Test
public void testCompareKeysets_singleKeyDifferentOutputPrefix_throws() throws Exception {
Keyset keyset1 = Keyset.newBuilder().addKey(aesGcmKey(KEY_0, 17, KeyStatusType.ENABLED, OutputPrefixType.TINK)).setPrimaryKeyId(17).build();
Keyset keyset2 = Keyset.newBuilder().addKey(aesGcmKey(KEY_0, 17, KeyStatusType.ENABLED, OutputPrefixType.RAW)).setPrimaryKeyId(17).build();
try {
CompareKeysets.compareKeysets(keyset1, keyset2);
fail();
} catch (Exception e) {
// expected.
}
}
use of com.google.crypto.tink.proto.Keyset in project tink by google.
the class CompareKeysetsTest method testCompareKeysets_twoKeysDifferentOrder_equal.
@Test
public void testCompareKeysets_twoKeysDifferentOrder_equal() throws Exception {
Keyset keyset1 = Keyset.newBuilder().addKey(aesGcmKey(KEY_0, 17, KeyStatusType.ENABLED, OutputPrefixType.TINK)).addKey(aesGcmKey(KEY_1, 18, KeyStatusType.ENABLED, OutputPrefixType.TINK)).setPrimaryKeyId(17).build();
Keyset keyset2 = Keyset.newBuilder().addKey(aesGcmKey(KEY_1, 18, KeyStatusType.ENABLED, OutputPrefixType.TINK)).addKey(aesGcmKey(KEY_0, 17, KeyStatusType.ENABLED, OutputPrefixType.TINK)).setPrimaryKeyId(17).build();
CompareKeysets.compareKeysets(keyset1, keyset2);
}
use of com.google.crypto.tink.proto.Keyset in project tink by google.
the class CompareKeysetsTest method testCompareKeysets_differentKeysSameIdsSimlarOrder_throws.
@Test
public void testCompareKeysets_differentKeysSameIdsSimlarOrder_throws() throws Exception {
Keyset keyset1 = Keyset.newBuilder().addKey(aesGcmKey(KEY_0, 17, KeyStatusType.ENABLED, OutputPrefixType.TINK)).addKey(aesGcmKey(KEY_1, 18, KeyStatusType.ENABLED, OutputPrefixType.TINK)).addKey(aesGcmKey(KEY_2, 18, KeyStatusType.ENABLED, OutputPrefixType.TINK)).addKey(aesGcmKey(KEY_3, 18, KeyStatusType.ENABLED, OutputPrefixType.TINK)).addKey(aesGcmKey(KEY_4, 18, KeyStatusType.ENABLED, OutputPrefixType.TINK)).addKey(aesGcmKey(KEY_5, 18, KeyStatusType.ENABLED, OutputPrefixType.TINK)).setPrimaryKeyId(17).build();
Keyset keyset2 = Keyset.newBuilder().addKey(aesGcmKey(KEY_0, 17, KeyStatusType.ENABLED, OutputPrefixType.TINK)).addKey(aesGcmKey(KEY_1, 18, KeyStatusType.ENABLED, OutputPrefixType.TINK)).addKey(aesGcmKey(KEY_2, 18, KeyStatusType.ENABLED, OutputPrefixType.TINK)).addKey(// != KEY_3
aesGcmKey(KEY_6, 18, KeyStatusType.ENABLED, OutputPrefixType.TINK)).addKey(aesGcmKey(KEY_4, 18, KeyStatusType.ENABLED, OutputPrefixType.TINK)).addKey(aesGcmKey(KEY_5, 18, KeyStatusType.ENABLED, OutputPrefixType.TINK)).setPrimaryKeyId(17).build();
try {
CompareKeysets.compareKeysets(keyset1, keyset2);
fail();
} catch (Exception e) {
// expected.
}
}
use of com.google.crypto.tink.proto.Keyset in project tink by google.
the class CompareKeysetsTest method testCompareKeysets_singleKey_equal.
@Test
public void testCompareKeysets_singleKey_equal() throws Exception {
Keyset keyset1 = Keyset.newBuilder().addKey(aesGcmKey(KEY_0, 17, KeyStatusType.ENABLED, OutputPrefixType.TINK)).setPrimaryKeyId(17).build();
Keyset keyset2 = Keyset.newBuilder().addKey(aesGcmKey(KEY_0, 17, KeyStatusType.ENABLED, OutputPrefixType.TINK)).setPrimaryKeyId(17).build();
CompareKeysets.compareKeysets(keyset1, keyset2);
}
Aggregations