public class PKCS8PEMResourceKeyPairParser extends AbstractPEMResourceKeyPairParser
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BEGIN_MARKER |
static java.util.List<java.lang.String> |
BEGINNERS |
static java.lang.String |
END_MARKER |
static java.util.List<java.lang.String> |
ENDERS |
static PKCS8PEMResourceKeyPairParser |
INSTANCE |
static java.lang.String |
PKCS8_FORMAT |
log
EMPTY
Constructor and Description |
---|
PKCS8PEMResourceKeyPairParser() |
Modifier and Type | Method and Description |
---|---|
static java.security.PrivateKey |
decodePEMPrivateKeyPKCS8(java.util.List<java.lang.Integer> oidAlgorithm,
byte[] keyBytes,
FilePasswordProvider passwordProvider) |
static java.security.PrivateKey |
decodePEMPrivateKeyPKCS8(java.lang.String oid,
byte[] keyBytes,
FilePasswordProvider passwordProvider) |
java.util.Collection<java.security.KeyPair> |
extractKeyPairs(java.lang.String resourceKey,
java.lang.String beginMarker,
java.lang.String endMarker,
FilePasswordProvider passwordProvider,
java.io.InputStream stream) |
static java.util.List<java.lang.Integer> |
getPKCS8AlgorithmIdentifier(ASN1Object privateKeyInfo) |
static java.util.List<java.lang.Integer> |
getPKCS8AlgorithmIdentifier(byte[] input) |
static java.util.List<java.lang.Integer> |
getPKCS8AlgorithmIdentifier(DERParser parser)
According to the standard:
|
applyPrivateKeyCipher, extractKeyPairs, getAlgorithm, getAlgorithmIdentifier
canExtractKeyPairs, extractKeyPairs, getBeginners, getEnders, getEndingMarkers, loadKeyPairs
getSimplifiedLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
aggregate, aggregate, canExtractKeyPairs, containsMarkerLine, containsMarkerLine, extractDataBytes, findMarkerLine, findMarkerLine, joinDataLines
loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs
public static final java.lang.String BEGIN_MARKER
public static final java.util.List<java.lang.String> BEGINNERS
public static final java.lang.String END_MARKER
public static final java.util.List<java.lang.String> ENDERS
public static final java.lang.String PKCS8_FORMAT
public static final PKCS8PEMResourceKeyPairParser INSTANCE
public java.util.Collection<java.security.KeyPair> extractKeyPairs(java.lang.String resourceKey, java.lang.String beginMarker, java.lang.String endMarker, FilePasswordProvider passwordProvider, java.io.InputStream stream) throws java.io.IOException, java.security.GeneralSecurityException
extractKeyPairs
in class AbstractKeyPairResourceParser
resourceKey
- A hint as to the origin of the text linesbeginMarker
- The line containing the begin markerendMarker
- The line containing the end markerpasswordProvider
- The FilePasswordProvider
to use
in case the data is encrypted - may be null
if no encryptedstream
- The decoded data InputStream
KeyPair
s - may be null
/empty if none.java.io.IOException
- If failed to parse the datajava.security.GeneralSecurityException
- If failed to generate the keyspublic static java.security.PrivateKey decodePEMPrivateKeyPKCS8(java.util.List<java.lang.Integer> oidAlgorithm, byte[] keyBytes, FilePasswordProvider passwordProvider) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
public static java.security.PrivateKey decodePEMPrivateKeyPKCS8(java.lang.String oid, byte[] keyBytes, FilePasswordProvider passwordProvider) throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
public static java.util.List<java.lang.Integer> getPKCS8AlgorithmIdentifier(byte[] input) throws java.io.IOException
java.io.IOException
public static java.util.List<java.lang.Integer> getPKCS8AlgorithmIdentifier(DERParser parser) throws java.io.IOException
PrivateKeyInfo ::= SEQUENCE {
version Version,
privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
privateKey PrivateKey,
attributes [0] IMPLICIT Attributes OPTIONAL
}
Version ::= INTEGER
PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
PrivateKey ::= OCTET STRING
Attributes ::= SET OF Attribute
AlgorithmIdentifier ::= SEQUENCE {
algorithm OBJECT IDENTIFIER,
parameters ANY DEFINED BY algorithm OPTIONAL
}
parser
- The DERParser
to usejava.io.IOException
- If malformed datagetPKCS8AlgorithmIdentifier(ASN1Object)
public static java.util.List<java.lang.Integer> getPKCS8AlgorithmIdentifier(ASN1Object privateKeyInfo) throws java.io.IOException
java.io.IOException