public abstract class AbstractPublicKeyEntryDecoder<PUB extends PublicKey,PRV extends PrivateKey> extends Object implements PublicKeyEntryDecoder<PUB,PRV>
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPublicKeyEntryDecoder(Class<PUB> pubType,
Class<PRV> prvType,
Collection<String> names) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclonePrivateKey, clonePublicKey, encodePublicKey, getKeyFactoryInstance, getKeyPairGeneratorpublic final Class<PUB> getPublicKeyType()
getPublicKeyType in interface PublicKeyEntryDecoder<PUB extends PublicKey,PRV extends PrivateKey>Class of the PublicKey that is the result
of decodingpublic final Class<PRV> getPrivateKeyType()
getPrivateKeyType in interface PublicKeyEntryDecoder<PUB extends PublicKey,PRV extends PrivateKey>Class of the PrivateKey that matches the
public onepublic KeyPair cloneKeyPair(KeyPair kp) throws GeneralSecurityException
cloneKeyPair in interface PublicKeyEntryDecoder<PUB extends PublicKey,PRV extends PrivateKey>kp - The KeyPair to be cloned - ignored if nullnull if no original pair)GeneralSecurityException - If failed to clone - e.g., provided key
pair does not contain keys of the expected typePublicKeyEntryDecoder.getPublicKeyType(),
PublicKeyEntryDecoder.getPrivateKeyType()public Collection<String> getSupportedTypeNames()
getSupportedTypeNames in interface PublicKeyEntryDecoder<PUB extends PublicKey,PRV extends PrivateKey>Collection of OpenSSH key type names that
are supported by this decoder - e.g., ECDSA keys have several curve names.
Caveat: this collection may be un-modifiable...public PUB decodePublicKey(byte... keyData) throws IOException, GeneralSecurityException
decodePublicKey in interface PublicKeyEntryDecoder<PUB extends PublicKey,PRV extends PrivateKey>keyData - The key data bytes in OpenSSH format (after
BASE64 decoding) - ignored if null/emptyPublicKey - or null if no dataIOException - If failed to decode the keyGeneralSecurityException - If failed to generate the keypublic PUB decodePublicKey(byte[] keyData, int offset, int length) throws IOException, GeneralSecurityException
decodePublicKey in interface PublicKeyEntryDecoder<PUB extends PublicKey,PRV extends PrivateKey>IOExceptionGeneralSecurityExceptionpublic PUB decodePublicKey(InputStream keyData) throws IOException, GeneralSecurityException
decodePublicKey in interface PublicKeyEntryDecoder<PUB extends PublicKey,PRV extends PrivateKey>IOExceptionGeneralSecurityExceptionpublic PUB generatePublicKey(KeySpec keySpec) throws GeneralSecurityException
GeneralSecurityExceptionpublic PRV generatePrivateKey(KeySpec keySpec) throws GeneralSecurityException
GeneralSecurityExceptionpublic abstract PUB decodePublicKey(String keyType, InputStream keyData) throws IOException, GeneralSecurityException
keyType - The reported / encode key typekeyData - The key data bytes stream positioned after the key type decoding
and making sure it is one of the supported typesPublicKeyIOException - If failed to read from the data streamGeneralSecurityException - If failed to generate the keypublic KeyPair generateKeyPair(int keySize) throws GeneralSecurityException
generateKeyPair in interface PublicKeyEntryDecoder<PUB extends PublicKey,PRV extends PrivateKey>keySize - Key size in bitsKeyPair with the specified key sizeGeneralSecurityException - if unable to generate the pairpublic static int encodeString(OutputStream s, String v) throws IOException
IOExceptionpublic static int encodeString(OutputStream s, String v, String charset) throws IOException
IOExceptionpublic static int encodeString(OutputStream s, String v, Charset cs) throws IOException
IOExceptionpublic static int encodeBigInt(OutputStream s, BigInteger v) throws IOException
IOExceptionpublic static int writeRLEBytes(OutputStream s, byte... bytes) throws IOException
IOExceptionpublic static int writeRLEBytes(OutputStream s, byte[] bytes, int off, int len) throws IOException
IOExceptionpublic static byte[] encodeInt(OutputStream s, int v) throws IOException
IOExceptionpublic static String decodeString(InputStream s) throws IOException
IOExceptionpublic static String decodeString(InputStream s, String charset) throws IOException
IOExceptionpublic static String decodeString(InputStream s, Charset cs) throws IOException
IOExceptionpublic static BigInteger decodeBigInt(InputStream s) throws IOException
IOExceptionpublic static byte[] readRLEBytes(InputStream s) throws IOException
IOExceptionpublic static int decodeInt(InputStream s) throws IOException
IOExceptionCopyright © 2008–2015 The Apache Software Foundation. All rights reserved.