EncryptedPrivateKeyInfo type
as defined in PKCS #8.
Its ASN.1 definition is as follows:
EncryptedPrivateKeyInfo ::= SEQUENCE {
encryptionAlgorithm AlgorithmIdentifier,
encryptedData OCTET STRING }
AlgorithmIdentifier ::= SEQUENCE {
algorithm OBJECT IDENTIFIER,
parameters ANY DEFINED BY algorithm OPTIONAL }
java.security.spec.PKCS8EncodedKeySpec
| Modifier and Type | Field and Description |
|---|---|
| private final AlgorithmId | |
| private final byte[] | |
| private final byte[] | |
| private final AlgorithmParameters |
| Access | Constructor and Description |
|---|---|
| public | EncryptedPrivateKeyInfo(byte[]
the ASN.1 encoding of this object. The contents of
the array are copied to protect against subsequent modification. encoded)Constructs an |
| public | EncryptedPrivateKeyInfo(String
encryption algorithm name. See the
Java Security Standard Algorithm Names document
for information about standard Cipher algorithm names. algName, byte[] encrypted data. The contents of
encryptedData)encryptedData are copied to protect against subsequent
modification when constructing this object.Constructs an |
| public | EncryptedPrivateKeyInfo(AlgorithmParameters
the algorithm parameters for the encryption
algorithm. algParams, byte[] algParams.getEncoded() should return
the ASN.1 encoded bytes of the parameters field
of the AlgorithmIdentifier component of the
EncryptedPrivateKeyInfo type.encrypted data. The contents of
encryptedData)encryptedData are copied to protect against
subsequent modification when constructing this object.Constructs an |
| private | EncryptedPrivateKeyInfo(byte[] encoded, byte[] eData, AlgorithmId id, AlgorithmParameters p)
Create an EncryptedPrivateKeyInfo object from the given components. |
| Modifier and Type | Method and Description |
|---|---|
| private byte[] | |
| public static EncryptedPrivateKeyInfo | Returns: anEncryptedPrivateKeyInfothe be, char[] BinaryEncodable to encrypt. Supported types include
PrivateKey, KeyPair, and PKCS8EncodedKeySpec.the password used for PBE encryption. This array is cloned
before use. password, String the PBE encryption algorithm algorithm, AlgorithmParameterSpec the params, Provider AlgorithmParameterSpec used for encryption. If
null, the provider’s default parameters are applied.the provider)Provider for SecretKeyFactory and
Cipher operations. If null, the default
provider list is used.
Preview
Third Preview of PEM Encodings of Cryptographic Objects (JEP 538).
Creates an |
| public static EncryptedPrivateKeyInfo | Returns: anEncryptedPrivateKeyInfothe be, char[] BinaryEncodable to encrypt. Supported types include
PrivateKey, KeyPair, and PKCS8EncodedKeySpec.the password used for PBE encryption. This array is cloned
before use. password)
Preview
Third Preview of PEM Encodings of Cryptographic Objects (JEP 538).
Creates an |
| public static EncryptedPrivateKeyInfo | Returns: anEncryptedPrivateKeyInfothe be, Key BinaryEncodable to encrypt. Supported types include
PrivateKey, KeyPair, and PKCS8EncodedKeySpec.the key used to encrypt the encoding encryptKey, String the encryption algorithm, such as a password-based
encryption (PBE) algorithm algorithm, AlgorithmParameterSpec the params, Provider AlgorithmParameterSpec used for encryption. If
null, the provider’s default parameters are applied.the provider, SecureRandom Provider for Cipher operations.
If null, the default provider list is used.the random)SecureRandom instance used during encryption.
If null, the default is used.
Preview
Third Preview of PEM Encodings of Cryptographic Objects (JEP 538).
Creates an |
| private static EncryptedPrivateKeyInfo | encryptImpl(byte[] encoded, String algorithm, Key encryptKey, AlgorithmParameterSpec params, Provider provider, SecureRandom random)
|
| private static SecretKey | |
| public String | |
| public AlgorithmParameters | Returns: the algorithm parameters.Returns the algorithm parameters used by the encryption algorithm. |
| public byte[] | Returns: the ASN.1 encoding. Returns a new array each time this method is called.Returns the ASN.1 encoding of this object. |
| private static byte[] | |
| public byte[] | Returns: the encrypted data. Returns a new array each time this method is called.Returns the encrypted data. |
| public PrivateKey | Returns: the decryptedPrivateKeythe password used for PBE decryption. The array is cloned
before use. password)
Preview
Third Preview of PEM Encodings of Cryptographic Objects (JEP 538).
Extracts and returns the enclosed |
| public PrivateKey | Returns: the decryptedPrivateKeythe decryption key; must not be decryptKey)null
Preview
Third Preview of PEM Encodings of Cryptographic Objects (JEP 538).
Extracts and returns the enclosed |
| public KeyPair | Returns: a decryptedKeyPairthe password used for PBE decryption. The array is cloned
before use. password)
Preview
Third Preview of PEM Encodings of Cryptographic Objects (JEP 538).
Extracts and returns the enclosed |
| public KeyPair | Returns: a decryptedKeyPairthe decryption key; must not be decryptKey)null
Preview
Third Preview of PEM Encodings of Cryptographic Objects (JEP 538).
Extracts and returns the enclosed |
| public PKCS8EncodedKeySpec | Returns: the PKCS8EncodedKeySpec objectthe initialized cipher)Cipher object which will be
used for decrypting the encrypted data.Extracts the enclosed PKCS8EncodedKeySpec object from the encrypted data and returns it. |
| public PKCS8EncodedKeySpec | Returns: the PKCS8EncodedKeySpec object with a specified algorithmkey used for decrypting the encrypted data. decryptKey)Extracts the enclosed PKCS8EncodedKeySpec object from the encrypted data and returns it. |
| public PKCS8EncodedKeySpec | Returns: the PKCS8EncodedKeySpec object with a specified algorithmkey used for decrypting the encrypted data. decryptKey, String the name of provider whose cipher
implementation will be used. providerName)Extracts the enclosed PKCS8EncodedKeySpec object from the encrypted data and returns it. |
| public PKCS8EncodedKeySpec | Returns: the PKCS8EncodedKeySpec object with a specified algorithmkey used for decrypting the encrypted data. decryptKey, Provider the provider whose cipher implementation will be used. provider)Extracts the enclosed PKCS8EncodedKeySpec object from the encrypted data and returns it. |
| private PKCS8EncodedKeySpec | |
| private static PKCS8EncodedKeySpec |
| algid | back to summary |
|---|---|
| private final AlgorithmId algid | |
| encoded | back to summary |
|---|---|
| private final byte[] encoded | |
| encryptedData | back to summary |
|---|---|
| private final byte[] encryptedData | |
| params | back to summary |
|---|---|
| private final AlgorithmParameters params | |
| EncryptedPrivateKeyInfo | back to summary |
|---|---|
| public EncryptedPrivateKeyInfo(byte[] encoded) throws IOException Constructs an
| |
| EncryptedPrivateKeyInfo | back to summary |
|---|---|
| public EncryptedPrivateKeyInfo(String algName, byte[] encryptedData) throws NoSuchAlgorithmException Constructs an Note This constructor will use
| |
| EncryptedPrivateKeyInfo | back to summary |
|---|---|
| public EncryptedPrivateKeyInfo(AlgorithmParameters algParams, byte[] encryptedData) throws NoSuchAlgorithmException Constructs an
| |
| EncryptedPrivateKeyInfo | back to summary |
|---|---|
| private EncryptedPrivateKeyInfo(byte[] encoded, byte[] eData, AlgorithmId id, AlgorithmParameters p) Create an EncryptedPrivateKeyInfo object from the given components. | |
| decryptData | back to summary |
|---|---|
| private byte[] decryptData(Key decryptKey, Provider provider) throws NoSuchAlgorithmException, InvalidKeyException | |
| encrypt | back to summary |
|---|---|
| public static EncryptedPrivateKeyInfo encrypt(BinaryEncodable be, char[] password, String algorithm, AlgorithmParameterSpec params, Provider provider)
Preview Third Preview of PEM Encodings of Cryptographic Objects (JEP 538). Programs can only use Creates an The format of the PBE algorithm string is described in the Cipher Algorithms section of the Java Security Standard Algorithm Names Specification.
| |
| encrypt | back to summary |
|---|---|
| public static EncryptedPrivateKeyInfo encrypt(BinaryEncodable be, char[] password)
Preview Third Preview of PEM Encodings of Cryptographic Objects (JEP 538). Programs can only use Creates an Implementation Note The
| |
| encrypt | back to summary |
|---|---|
| public static EncryptedPrivateKeyInfo encrypt(BinaryEncodable be, Key encryptKey, String algorithm, AlgorithmParameterSpec params, Provider provider, SecureRandom random)
Preview Third Preview of PEM Encodings of Cryptographic Objects (JEP 538). Programs can only use Creates an The format of the algorithm string is described in the Cipher Algorithms section of the Java Security Standard Algorithm Names Specification.
| |
| encryptImpl | back to summary |
|---|---|
| private static EncryptedPrivateKeyInfo encryptImpl(byte[] encoded, String algorithm, Key encryptKey, AlgorithmParameterSpec params, Provider provider, SecureRandom random) | |
| generateSecretKey | back to summary |
|---|---|
| private static SecretKey generateSecretKey(char[] password, String algorithm, Provider provider) | |
| getAlgName | back to summary |
|---|---|
| public String getAlgName() Returns the encryption algorithm. Note Standard name is returned instead of the specified one in the constructor when such mapping is available. See the Java Security Standard Algorithm Names document for information about standard Cipher algorithm names.
| |
| getAlgParameters | back to summary |
|---|---|
| public AlgorithmParameters getAlgParameters() Returns the algorithm parameters used by the encryption algorithm.
| |
| getEncoded | back to summary |
|---|---|
| public byte[] getEncoded() throws IOException Returns the ASN.1 encoding of this object.
| |
| getEncoding | back to summary |
|---|---|
| private static byte[] getEncoding(BinaryEncodable d) | |
| getEncryptedData | back to summary |
|---|---|
| public byte[] getEncryptedData() Returns the encrypted data.
| |
| getKey | back to summary |
|---|---|
| public PrivateKey getKey(char[] password) throws NoSuchAlgorithmException, InvalidKeyException
Preview Third Preview of PEM Encodings of Cryptographic Objects (JEP 538). Programs can only use Extracts and returns the enclosed
| |
| getKey | back to summary |
|---|---|
| public PrivateKey getKey(Key decryptKey) throws NoSuchAlgorithmException, InvalidKeyException
Preview Third Preview of PEM Encodings of Cryptographic Objects (JEP 538). Programs can only use Extracts and returns the enclosed
| |
| getKeyPair | back to summary |
|---|---|
| public KeyPair getKeyPair(char[] password) throws NoSuchAlgorithmException, InvalidKeyException
Preview Third Preview of PEM Encodings of Cryptographic Objects (JEP 538). Programs can only use Extracts and returns the enclosed
| |
| getKeyPair | back to summary |
|---|---|
| public KeyPair getKeyPair(Key decryptKey) throws NoSuchAlgorithmException, InvalidKeyException
Preview Third Preview of PEM Encodings of Cryptographic Objects (JEP 538). Programs can only use Extracts and returns the enclosed
| |
| getKeySpec | back to summary |
|---|---|
| public PKCS8EncodedKeySpec getKeySpec(Cipher cipher) throws InvalidKeySpecException Extracts the enclosed PKCS8EncodedKeySpec object from the encrypted data and returns it. Note In order to successfully retrieve the enclosed
PKCS8EncodedKeySpec object,
| |
| getKeySpec | back to summary |
|---|---|
| public PKCS8EncodedKeySpec getKeySpec(Key decryptKey) throws NoSuchAlgorithmException, InvalidKeyException Extracts the enclosed PKCS8EncodedKeySpec object from the encrypted data and returns it.
| |
| getKeySpec | back to summary |
|---|---|
| public PKCS8EncodedKeySpec getKeySpec(Key decryptKey, String providerName) throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeyException Extracts the enclosed PKCS8EncodedKeySpec object from the encrypted data and returns it.
| |
| getKeySpec | back to summary |
|---|---|
| public PKCS8EncodedKeySpec getKeySpec(Key decryptKey, Provider provider) throws NoSuchAlgorithmException, InvalidKeyException Extracts the enclosed PKCS8EncodedKeySpec object from the encrypted data and returns it.
| |
| getKeySpecImpl | back to summary |
|---|---|
| private PKCS8EncodedKeySpec getKeySpecImpl(Key decryptKey, Provider provider) throws NoSuchAlgorithmException, InvalidKeyException | |
| pkcs8EncodingToSpec | back to summary |
|---|---|
| private static PKCS8EncodedKeySpec pkcs8EncodingToSpec(byte[] encodedKey) throws IOException | |