code: public static AsymmetricKeyParameter getAsymmetricKeyParameter(PublicKeyParameters publicKey)
      {
          if (publicKey instanceof BcAsymmetricKeyParameters) {
              return ((BcAsymmetricKeyParameters) publicKey).getParameters();
          } else {
              try {
                  return PublicKeyFactory.createKey(publicKey.getEncoded());
              } catch (IOException e) {
                  // Very unlikely
                  throw new IllegalArgumentException("Invalid public key, unable to encode.");
              }
          }
  
      }
docs: Convert public key parameters to asymmetric key parameter.
  
  @param publicKey the public key parameter to convert.
  @return an asymmetric key parameter.