/** * Parse a public key. * <p> * This method accepts the bytes that are Base64 encoded in an OpenSSH public key file. * * @param encoded The key. * @return An AsymmetricKeyParameter instance. */ public static AsymmetricKeyParameter parsePublicKey(byte[] encoded) { SSHBuffer buffer = new SSHBuffer(encoded); return parsePublicKey(buffer); }
protected PublicKey engineGeneratePublic( KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof RSAPublicKeySpec) { return new BCRSAPublicKey((RSAPublicKeySpec)keySpec); } else if (keySpec instanceof OpenSSHPublicKeySpec) { CipherParameters parameters = OpenSSHPublicKeyUtil.parsePublicKey(((OpenSSHPublicKeySpec)keySpec).getEncoded()); if (parameters instanceof RSAKeyParameters) { return new BCRSAPublicKey((RSAKeyParameters)parameters); } throw new InvalidKeySpecException("Open SSH public key is not RSA public key"); } return super.engineGeneratePublic(keySpec); }
CipherParameters parameters = OpenSSHPublicKeyUtil.parsePublicKey(((OpenSSHPublicKeySpec)keySpec).getEncoded());
CipherParameters parameters = OpenSSHPublicKeyUtil.parsePublicKey(((OpenSSHPublicKeySpec)keySpec).getEncoded()); if (parameters instanceof Ed25519PublicKeyParameters)
CipherParameters params = OpenSSHPublicKeyUtil.parsePublicKey(((OpenSSHPublicKeySpec)keySpec).getEncoded()); if (params instanceof ECPublicKeyParameters)
OpenSSHPublicKeyUtil.parsePublicKey(kIn.readString());