PUB
- Type of PublicKey
PRV
- Type of PrivateKey
public interface PublicKeyEntryDecoder<PUB extends PublicKey,PRV extends PrivateKey> extends PublicKeyEntryResolver
OpenSSH
encoded key dataFAILING, IGNORING
Modifier and Type | Method and Description |
---|---|
KeyPair |
cloneKeyPair(KeyPair kp) |
PRV |
clonePrivateKey(PRV key) |
PUB |
clonePublicKey(PUB key) |
PUB |
decodePublicKey(byte... keyData) |
PUB |
decodePublicKey(byte[] keyData,
int offset,
int length) |
PUB |
decodePublicKey(InputStream keyData) |
String |
encodePublicKey(OutputStream s,
PUB key)
|
KeyPair |
generateKeyPair(int keySize) |
KeyFactory |
getKeyFactoryInstance() |
KeyPairGenerator |
getKeyPairGenerator() |
Class<PRV> |
getPrivateKeyType() |
Class<PUB> |
getPublicKeyType() |
Collection<String> |
getSupportedTypeNames() |
resolve
Class<PRV> getPrivateKeyType()
Class
of the PrivateKey
that matches the
public oneCollection<String> getSupportedTypeNames()
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...KeyPair generateKeyPair(int keySize) throws GeneralSecurityException
keySize
- Key size in bitsKeyPair
with the specified key sizeGeneralSecurityException
- if unable to generate the pairKeyPair cloneKeyPair(KeyPair kp) throws GeneralSecurityException
kp
- The KeyPair
to be cloned - ignored if null
null
if no original pair)GeneralSecurityException
- If failed to clone - e.g., provided key
pair does not contain keys of the expected typegetPublicKeyType()
,
getPrivateKeyType()
PUB clonePublicKey(PUB key) throws GeneralSecurityException
key
- The PublicKey
to clone - ignored if null
null
if no original key)GeneralSecurityException
- If failed to clone the keyPRV clonePrivateKey(PRV key) throws GeneralSecurityException
key
- The PrivateKey
to clone - ignored if null
null
if no original key)GeneralSecurityException
- If failed to clone the keyKeyPairGenerator getKeyPairGenerator() throws GeneralSecurityException
KeyPairGenerator
suitable for this decoderGeneralSecurityException
- If failed to create the generatorPUB decodePublicKey(byte... keyData) throws IOException, GeneralSecurityException
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 keyPUB decodePublicKey(byte[] keyData, int offset, int length) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
PUB decodePublicKey(InputStream keyData) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
String encodePublicKey(OutputStream s, PUB key) throws IOException
s
- The OutputStream
to write the data tokey
- The PublicKey
- may not be null
getSupportedTypeNames()
IOException
- If failed to generate the encodingKeyFactory getKeyFactoryInstance() throws GeneralSecurityException
KeyFactory
suitable for the specific decoder typeGeneralSecurityException
- If failed to create oneCopyright © 2008–2016 The Apache Software Foundation. All rights reserved.