PUB
- Type of PublicKey
PRV
- Type of PrivateKey
public interface PrivateKeyEntryDecoder<PUB extends java.security.PublicKey,PRV extends java.security.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,
java.io.InputStream keyData) |
PRV |
decodePrivateKey(SessionContext session,
java.lang.String keyType,
FilePasswordProvider passwordProvider,
java.io.InputStream keyData) |
default java.lang.String |
encodePrivateKey(SecureByteArrayOutputStream s,
PRV key,
PUB pubKey)
Encodes the
PrivateKey using the OpenSSH format - same one used by the decodePublicKey
method(s) |
default boolean |
isPublicKeyRecoverySupported() |
default PUB |
recoverPublicKey(PRV prvKey)
Attempts to recover the public key given the private one
|
default java.security.PrivateKey |
resolve(SessionContext session,
java.lang.String keyType,
byte[] keyData) |
cloneKeyPair, clonePrivateKey, clonePublicKey, decodeBigInt, decodeInt, decodeInt, decodeInt, decodeString, decodeString, decodeString, decodeString, decodeString, decodeString, decodeString, encodeBigInt, encodeInt, encodeString, encodeString, encodeString, generateKeyPair, getKeyFactoryInstance, getKeyPairGenerator, readRLEBytes, readRLEBytes, readRLEBytes, writeRLEBytes, writeRLEBytes
getPrivateKeyType, getPublicKeyType
findSupporterByKeyTypeName, getSupportedKeyTypes
default java.security.PrivateKey resolve(SessionContext session, java.lang.String keyType, byte[] keyData) throws java.io.IOException, java.security.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
java.io.IOException
- If failed to parse the key datajava.security.GeneralSecurityException
- If failed to generate the keydefault PRV decodePrivateKey(SessionContext session, FilePasswordProvider passwordProvider, byte... keyData) throws java.io.IOException, java.security.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 datajava.io.IOException
- If failed to decode the keyjava.security.GeneralSecurityException
- If failed to generate the keydefault PRV decodePrivateKey(SessionContext session, FilePasswordProvider passwordProvider, byte[] keyData, int offset, int length) throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOException
java.security.GeneralSecurityException
default PRV decodePrivateKey(SessionContext session, FilePasswordProvider passwordProvider, java.io.InputStream keyData) throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOException
java.security.GeneralSecurityException
PRV decodePrivateKey(SessionContext session, java.lang.String keyType, FilePasswordProvider passwordProvider, java.io.InputStream keyData) throws java.io.IOException, java.security.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
java.io.IOException
- If failed to read from the data streamjava.security.GeneralSecurityException
- If failed to generate the keydefault java.lang.String encodePrivateKey(SecureByteArrayOutputStream s, PRV key, PUB pubKey) throws java.io.IOException
PrivateKey
using the OpenSSH
format - same one used by the decodePublicKey
method(s)s
- The SecureByteArrayOutputStream
to write the data to.key
- The PrivateKey
- may not be null
pubKey
- The PublicKey
belonging to the private key - must be non-null
if
public key recovery
is not supportedKeyTypeNamesSupport.getSupportedKeyTypes()
or null
if encoding
not supportedjava.io.IOException
- If failed to generate the encodingdefault boolean isPublicKeyRecoverySupported()
default PUB recoverPublicKey(PRV prvKey) throws java.security.GeneralSecurityException
prvKey
- The PrivateKey
PublicKey
- null
if cannot recover itjava.security.GeneralSecurityException
- If failed to generate the public key