public class OpenSSHRSAPrivateKeyDecoder extends AbstractPrivateKeyEntryDecoder<RSAPublicKey,RSAPrivateKey>
Modifier and Type | Field and Description |
---|---|
static BigInteger |
DEFAULT_PUBLIC_EXPONENT |
static OpenSSHRSAPrivateKeyDecoder |
INSTANCE |
log
MAX_BIGINT_OCTETS_COUNT
FAILING, IGNORING
Constructor and Description |
---|
OpenSSHRSAPrivateKeyDecoder() |
Modifier and Type | Method and Description |
---|---|
RSAPrivateKey |
clonePrivateKey(RSAPrivateKey key) |
RSAPublicKey |
clonePublicKey(RSAPublicKey key) |
RSAPrivateKey |
decodePrivateKey(SessionContext session,
String keyType,
FilePasswordProvider passwordProvider,
InputStream keyData) |
String |
encodePrivateKey(SecureByteArrayOutputStream s,
RSAPrivateKey key,
RSAPublicKey pubKey)
|
KeyFactory |
getKeyFactoryInstance() |
KeyPairGenerator |
getKeyPairGenerator() |
boolean |
isPublicKeyRecoverySupported() |
RSAPublicKey |
recoverPublicKey(RSAPrivateKey privateKey)
Attempts to recover the public key given the private one
|
generatePrivateKey, generatePublicKey, toString
getPrivateKeyType, getPublicKeyType, getSupportedKeyTypes
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
decodePrivateKey, decodePrivateKey, decodePrivateKey, resolve
cloneKeyPair, decodeBigInt, decodeInt, decodeInt, decodeInt, decodeString, decodeString, decodeString, decodeString, decodeString, decodeString, decodeString, encodeBigInt, encodeInt, encodeString, encodeString, encodeString, generateKeyPair, readRLEBytes, readRLEBytes, readRLEBytes, writeRLEBytes, writeRLEBytes
getPrivateKeyType, getPublicKeyType
findSupporterByKeyTypeName, getSupportedKeyTypes
public static final BigInteger DEFAULT_PUBLIC_EXPONENT
public static final OpenSSHRSAPrivateKeyDecoder INSTANCE
public RSAPrivateKey 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 keypublic String encodePrivateKey(SecureByteArrayOutputStream s, RSAPrivateKey key, RSAPublicKey pubKey) throws IOException
PrivateKeyEntryDecoder
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 supportedIOException
- If failed to generate the encodingpublic boolean isPublicKeyRecoverySupported()
public RSAPublicKey recoverPublicKey(RSAPrivateKey privateKey) throws GeneralSecurityException
PrivateKeyEntryDecoder
privateKey
- The PrivateKey
PublicKey
- null
if cannot recover itGeneralSecurityException
- If failed to generate the public keypublic RSAPublicKey clonePublicKey(RSAPublicKey key) throws GeneralSecurityException
key
- The PublicKey
to clone - ignored if null
null
if no original key)GeneralSecurityException
- If failed to clone the keypublic RSAPrivateKey clonePrivateKey(RSAPrivateKey key) throws GeneralSecurityException
key
- The PrivateKey
to clone - ignored if null
null
if no original key)GeneralSecurityException
- If failed to clone the keypublic KeyPairGenerator getKeyPairGenerator() throws GeneralSecurityException
KeyPairGenerator
suitable for this decoderGeneralSecurityException
- If failed to create the generatorpublic KeyFactory getKeyFactoryInstance() throws GeneralSecurityException
KeyFactory
suitable for the specific decoder typeGeneralSecurityException
- If failed to create oneCopyright © 2008–2024 The Apache Software Foundation. All rights reserved.