message: Add some additional test cases for asymmetric KeyManager registration and getPublicKeyData.
diff: @@ -1304,15 +1304,63 @@ public class RegistryTest {
  }
  @Test
  - public void testRegisterAssymmetricKeyManagers_publicKeyManagerReRegister_getPublicKeyData()
  + public void testRegisterAssymmetricKeyManagers_getPublicKeyData_shouldWork()
  throws Exception {
  Registry.reset();
  + Registry.registerAsymmetricKeyManagers(
  + new TestPrivateKeyTypeManager(), new TestPublicKeyTypeManager(), false);
  +
  + Ed25519PrivateKey privateKey =
  + Ed25519PrivateKey.newBuilder()
  + .setKeyValue(ByteString.copyFrom(Random.randBytes(32)))
  + .setPublicKey(
  + Ed25519PublicKey.newBuilder()
  + .setKeyValue(ByteString.copyFrom(Random.randBytes(32))))
  + .build();
  + KeyData publicKeyData =
  + Registry.getPublicKeyData(
  + new TestPrivateKeyTypeManager().getKeyType(), privateKey.toByteString());
  + assertThat(publicKeyData.getTypeUrl()).isEqualTo(new TestPublicKeyTypeManager().getKeyType());
  + Ed25519PublicKey publicKey =
  + Ed25519PublicKey.parseFrom(
  + publicKeyData.getValue(), ExtensionRegistryLite.getEmptyRegistry());
  + assertThat(publicKey.getKeyValue()).isEqualTo(privateKey.getPublicKey().getKeyValue());
  + }
  +
  + @Test
  + public void testRegisterAsymmetricKeyManagersSeparately_getPublicKeyData_throws()
  + throws Exception {
  + Registry.reset();
  + // Register asymmetric key managers only with registerKeyManager.
  + Registry.registerKeyManager(new TestPrivateKeyTypeManager(), false);
  + Registry.registerKeyManager(new TestPublicKeyTypeManager(), false);
  +
  + Ed25519PrivateKey privateKey =
  + Ed25519PrivateKey.newBuilder()
  + .setKeyValue(ByteString.copyFrom(Random.randBytes(32)))
  + .setPublicKey(
  + Ed25519PublicKey.newBuilder()
  + .setKeyValue(ByteString.copyFrom(Random.randBytes(32))))
  + .build();
  + assertThrows(
  + GeneralSecurityException.class,
  + () ->
  + Registry.getPublicKeyData(
  + new TestPrivateKeyTypeManager().getKeyType(), privateKey.toByteString()));
  + }
  +
  + @Test
  + public void testRegisterAssymmetricKeyManagersOnce_getPublicKeyData_shouldWork()
  + throws Exception {
  + Registry.reset();
  + // Register asymmetric key managers with registerAsymmetricKeyManagers and registerKeyManager.
  + Registry.registerKeyManager(new TestPrivateKeyTypeManager(), false);
  Registry.registerKeyManager(new TestPublicKeyTypeManager(), false);
  Registry.registerAsymmetricKeyManagers(
  new TestPrivateKeyTypeManager(), new TestPublicKeyTypeManager(), false);
  + Registry.registerKeyManager(new TestPrivateKeyTypeManager(), false);
  Registry.registerKeyManager(new TestPublicKeyTypeManager(), false);
  - // Check that getPublicKeyData works now.
  Ed25519PrivateKey privateKey =
  Ed25519PrivateKey.newBuilder()
  .setKeyValue(ByteString.copyFrom(Random.randBytes(32)))
  @@ -1340,6 +1388,7 @@ public class RegistryTest {
  GeneralSecurityException.class,
  () ->
  Registry.registerAsymmetricKeyManagers(
  + // Note: due to the {} this is a subclass of TestPrivateKeyTypeManager.
  new TestPrivateKeyTypeManager() {}, new TestPublicKeyTypeManager(), false));
  }
  