code: public static SubjectPublicKeyInfo getSubjectPublicKeyInfo(PublicKeyParameters publicKey)
      {
          try {
              if (publicKey instanceof BcPublicKeyParameters) {
                  return ((BcPublicKeyParameters) publicKey).getSubjectPublicKeyInfo();
              } else {
                  return SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(getAsymmetricKeyParameter(publicKey));
              }
          } catch (IOException e) {
              // Very unlikely
              throw new IllegalArgumentException("Invalid public key, unable to get subject info.");
          }
      }
docs: Convert public key parameter to subject public key info.
  
  @param publicKey the public key to convert.
  @return a subject public key info.