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." ) ; } }
Convert public key parameter to subject public key info .