@Override public PublicKey newInstance() throws EncodingException { return KeyPairUtil.decodePublicKey(PemUtil.decode(encodedKey)); } }
/** * Reads a DER or PEM-encoded public key from data in the given stream. The {@link InputStream} parameter is closed by * this method. * * @param in Input stream containing an encoded key. * * @return Public key. * * @throws EncodingException on key encoding errors. * @throws StreamException on IO errors. */ public static PublicKey readPublicKey(final InputStream in) throws EncodingException, StreamException { return decodePublicKey(StreamUtil.readAll(in)); }
/** {@inheritDoc} */ @Override @Nullable protected PublicKey getPublicKey() { if (null == getPublicKeyInfo()) { return null; } return KeyPairUtil.decodePublicKey(getPublicKeyInfo()); }