use of com.google.crypto.tink.proto.RegistryConfig in project tink by google.
the class PublicKeyVerifyCatalogueTest method testBasic.
@Test
public void testBasic() throws Exception {
PublicKeyVerifyCatalogue catalogue = new PublicKeyVerifyCatalogue();
// Check a single key type for verifying, incl. case-insensitve primitive name.
String keyType = "type.googleapis.com/google.crypto.tink.Ed25519PublicKey";
{
KeyManager<PublicKeyVerify> manager = catalogue.getKeyManager(keyType, "PublicKeyVerify", 0);
assertThat(manager.doesSupport(keyType)).isTrue();
}
{
KeyManager<PublicKeyVerify> manager = catalogue.getKeyManager(keyType, "PUBLicKeYVerIFY", 0);
assertThat(manager.doesSupport(keyType)).isTrue();
}
{
KeyManager<PublicKeyVerify> manager = catalogue.getKeyManager(keyType, "PUBLICKEYVERIFY", 0);
assertThat(manager.doesSupport(keyType)).isTrue();
}
// Check all entries from the current SignatureConfig.
RegistryConfig config = SignatureConfig.TINK_1_0_0;
int count = 0;
for (KeyTypeEntry entry : config.getEntryList()) {
if ("PublicKeyVerify".equals(entry.getPrimitiveName())) {
count = count + 1;
KeyManager<PublicKeyVerify> manager = catalogue.getKeyManager(entry.getTypeUrl(), "publickeyverify", entry.getKeyManagerVersion());
assertThat(manager.doesSupport(entry.getTypeUrl())).isTrue();
}
}
assertEquals(2, count);
}
use of com.google.crypto.tink.proto.RegistryConfig in project tink by google.
the class PublicKeySignCatalogueTest method testBasic.
@Test
public void testBasic() throws Exception {
PublicKeySignCatalogue catalogue = new PublicKeySignCatalogue();
// Check a single key type for signing, incl. case-insensitve primitive name.
String keyType = "type.googleapis.com/google.crypto.tink.EcdsaPrivateKey";
{
KeyManager<PublicKeySign> manager = catalogue.getKeyManager(keyType, "PublicKeySign", 0);
assertThat(manager.doesSupport(keyType)).isTrue();
}
{
KeyManager<PublicKeySign> manager = catalogue.getKeyManager(keyType, "PUBLicKeYSigN", 0);
assertThat(manager.doesSupport(keyType)).isTrue();
}
{
KeyManager<PublicKeySign> manager = catalogue.getKeyManager(keyType, "PUBLICKEYSIGN", 0);
assertThat(manager.doesSupport(keyType)).isTrue();
}
// Check all entries from the current SignatureConfig.
RegistryConfig config = SignatureConfig.TINK_1_0_0;
int count = 0;
for (KeyTypeEntry entry : config.getEntryList()) {
if ("PublicKeySign".equals(entry.getPrimitiveName())) {
count = count + 1;
KeyManager<PublicKeySign> manager = catalogue.getKeyManager(entry.getTypeUrl(), "publickeysign", entry.getKeyManagerVersion());
assertThat(manager.doesSupport(entry.getTypeUrl())).isTrue();
}
}
assertEquals(2, count);
}
Aggregations