Class PKCS8KeyFile
java.lang.Object
net.schmizz.sshj.userauth.keyprovider.BaseFileKeyProvider
net.schmizz.sshj.userauth.keyprovider.PKCS8KeyFile
- All Implemented Interfaces:
FileKeyProvider, KeyProvider
- Direct Known Subclasses:
OpenSSHKeyFile
Key File implementation supporting PEM-encoded PKCS8 and PKCS1 formats with or without password-based encryption
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumstatic classprivate static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringBouncy Castle class for detecting support of historical OpenSSL password-based decryptionprivate static final booleanprotected final org.slf4j.LoggerFields inherited from class BaseFileKeyProvider
kp, pwdf, resource, type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate BigIntegergetBigInteger(com.hierynomus.asn1.types.constructed.ASN1Sequence sequence, int index) getEcNamedCurve(String objectId) private PublicKeygetEcPublicKey(byte[] bitString, ECParameterSpec ecParameterSpec) getKeyAlgorithmObjectIdentifier(String objectId) private PKCS8EncodedKeySpecgetPkcs8DecryptedKeySpec(char[] password, byte[] encoded) private KeyPairgetPkcs8KeyPair(byte[] encoded) private KeyPairgetPkcs8KeyPair(PKCS8KeyFile.KeyAlgorithmObjectIdentifier objectIdentifier, byte[] privateKeyInfo) private PrivateKeygetPkcs8PrivateKey(PKCS8KeyFile.KeyAlgorithmObjectIdentifier objectIdentifier, byte[] privateKeyInfo) private static booleanprivate KeyPairreadDsaKeyPair(byte[] pemKeyBody) private KeyPairreadEcKeyPair(byte[] pemKeyBody) private KeyPairreadEncryptedPkcs8KeyPair(byte[] pemKeyBody) protected KeyPairprivate KeyPairreadKeyPair(PEMKey pemKey) private KeyPairreadRsaKeyPair(byte[] pemKeyBody) toString()
-
Field Details
-
BOUNCY_CASTLE_CLASS
Bouncy Castle class for detecting support of historical OpenSSL password-based decryption- See Also:
-
HISTORICAL_DECRYPTION_SUPPORTED
private static final boolean HISTORICAL_DECRYPTION_SUPPORTED -
log
protected final org.slf4j.Logger log
-
-
Constructor Details
-
PKCS8KeyFile
public PKCS8KeyFile()
-
-
Method Details
-
readKeyPair
- Specified by:
readKeyPairin classBaseFileKeyProvider- Throws:
IOException
-
readKeyPair
- Throws:
IOException
-
toString
-
readDsaKeyPair
- Throws:
IOException
-
readRsaKeyPair
- Throws:
IOException
-
readEcKeyPair
- Throws:
IOException
-
getEcNamedCurve
-
readEncryptedPkcs8KeyPair
- Throws:
IOException
-
getPkcs8DecryptedKeySpec
private PKCS8EncodedKeySpec getPkcs8DecryptedKeySpec(char[] password, byte[] encoded) throws IOException, GeneralSecurityException - Throws:
IOExceptionGeneralSecurityException
-
getPkcs8KeyPair
- Throws:
IOException
-
getPkcs8KeyPair
private KeyPair getPkcs8KeyPair(PKCS8KeyFile.KeyAlgorithmObjectIdentifier objectIdentifier, byte[] privateKeyInfo) throws GeneralSecurityException - Throws:
GeneralSecurityException
-
getPkcs8PrivateKey
private PrivateKey getPkcs8PrivateKey(PKCS8KeyFile.KeyAlgorithmObjectIdentifier objectIdentifier, byte[] privateKeyInfo) throws GeneralSecurityException - Throws:
GeneralSecurityException
-
getEcPublicKey
private PublicKey getEcPublicKey(byte[] bitString, ECParameterSpec ecParameterSpec) throws GeneralSecurityException - Throws:
GeneralSecurityException
-
getKeyAlgorithmObjectIdentifier
-
getBigInteger
private BigInteger getBigInteger(com.hierynomus.asn1.types.constructed.ASN1Sequence sequence, int index) -
isHistoricalDecryptionSupported
private static boolean isHistoricalDecryptionSupported()
-