PUB
- Type of PublicKey
PRV
- Type of PrivateKey
public interface PrivateKeyEntryDecoder<PUB extends PublicKey,PRV extends PrivateKey> extends KeyEntryResolver<PUB,PRV>, PrivateKeyEntryResolver
MAX_BIGINT_OCTETS_COUNT
FAILING, IGNORING
Modifier and Type | Method and Description |
---|---|
default PRV |
decodePrivateKey(SessionContext session,
FilePasswordProvider passwordProvider,
byte... keyData) |
default PRV |
decodePrivateKey(SessionContext session,
FilePasswordProvider passwordProvider,
byte[] keyData,
int offset,
int length) |
default PRV |
decodePrivateKey(SessionContext session,
FilePasswordProvider passwordProvider,
InputStream keyData) |
PRV |
decodePrivateKey(SessionContext session,
String keyType,
FilePasswordProvider passwordProvider,
InputStream keyData) |
default String |
encodePrivateKey(OutputStream s,
PRV key)
|
default boolean |
isPublicKeyRecoverySupported() |
default PUB |
recoverPublicKey(PRV prvKey)
Attempts to recover the public key given the private one
|
default PrivateKey |
resolve(SessionContext session,
String keyType,
byte[] keyData) |
cloneKeyPair, clonePrivateKey, clonePublicKey, decodeBigInt, decodeInt, decodeString, decodeString, decodeString, encodeBigInt, encodeInt, encodeString, encodeString, encodeString, generateKeyPair, getKeyFactoryInstance, getKeyPairGenerator, readRLEBytes, writeRLEBytes, writeRLEBytes
getPrivateKeyType, getPublicKeyType
findSupporterByKeyTypeName, getSupportedKeyTypes
default PrivateKey resolve(SessionContext session, String keyType, byte[] keyData) throws IOException, GeneralSecurityException
resolve
in interface PrivateKeyEntryResolver
session
- The SessionContext
for invoking this load command - may
be null
if not invoked within a session context (e.g., offline tool or session unknown).keyType
- The OpenSSH
reported key typekeyData
- The OpenSSH
encoded key dataPrivateKey
- ignored if null
IOException
- If failed to parse the key dataGeneralSecurityException
- If failed to generate the keydefault PRV decodePrivateKey(SessionContext session, FilePasswordProvider passwordProvider, byte... keyData) throws IOException, GeneralSecurityException
session
- The SessionContext
for invoking this load command - may
be null
if not invoked within a session context (e.g., offline tool or session unknown).passwordProvider
- The FilePasswordProvider
to use
in case the data is encrypted - may be null
if no encrypted
data is expectedkeyData
- The key data bytes in OpenSSH
format (after
BASE64 decoding) - ignored if null
/emptyPrivateKey
- or null
if no dataIOException
- If failed to decode the keyGeneralSecurityException
- If failed to generate the keydefault PRV decodePrivateKey(SessionContext session, FilePasswordProvider passwordProvider, byte[] keyData, int offset, int length) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
default PRV decodePrivateKey(SessionContext session, FilePasswordProvider passwordProvider, InputStream keyData) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
PRV decodePrivateKey(SessionContext session, String keyType, FilePasswordProvider passwordProvider, InputStream keyData) throws IOException, GeneralSecurityException
session
- The SessionContext
for invoking this load command - may
be null
if not invoked within a session context (e.g., offline tool or session unknown).keyType
- The reported / encode key typepasswordProvider
- The FilePasswordProvider
to use
in case the data is encrypted - may be null
if no encrypted
data is expectedkeyData
- The key data bytes stream positioned after the key type decoding
and making sure it is one of the supported typesPrivateKey
IOException
- If failed to read from the data streamGeneralSecurityException
- If failed to generate the keydefault String encodePrivateKey(OutputStream s, PRV key) throws IOException
s
- The OutputStream
to write the data tokey
- The PrivateKey
- may not be null
KeyTypeNamesSupport.getSupportedKeyTypes()
or
null
if encoding not supportedIOException
- If failed to generate the encodingdefault boolean isPublicKeyRecoverySupported()
default PUB recoverPublicKey(PRV prvKey) throws GeneralSecurityException
prvKey
- The PrivateKey
PublicKey
- null
if cannot recover itGeneralSecurityException
- If failed to generate the public keyCopyright © 2008–2022 The Apache Software Foundation. All rights reserved.