| Modifier and Type | Class and Description |
|---|---|
static class |
EncryptedPrivateKeyInfo.Template
A template class for decoding EncryptedPrivateKeyInfos from BER.
|
| Constructor and Description |
|---|
EncryptedPrivateKeyInfo(AlgorithmIdentifier encryptionAlgorithm,
OCTET_STRING encryptedData)
Creates an EncryptedPrivateKeyInfo from its components.
|
| Modifier and Type | Method and Description |
|---|---|
static EncryptedPrivateKeyInfo |
createPBE(PBEAlgorithm keyGenAlg,
Password password,
byte[] salt,
int iterationCount,
KeyGenerator.CharToByteConverter charToByteConverter,
PrivateKey pri,
CryptoToken token)
Creates a new EncryptedPrivateKeyInfo, where the data is encrypted
with a password-based key-
with wrapping/unwrapping happening on token.
|
static EncryptedPrivateKeyInfo |
createPBE(PBEAlgorithm keyGenAlg,
Password password,
byte[] salt,
int iterationCount,
KeyGenerator.CharToByteConverter charToByteConverter,
PrivateKeyInfo pki)
Creates a new EncryptedPrivateKeyInfo, where the data is encrypted
with a password-based key.
|
static EncryptedPrivateKeyInfo |
createPBES2(int saltLen,
int kdfIterations,
EncryptionAlgorithm encAlg,
Password pwd,
KeyGenerator.CharToByteConverter charToByteConverter,
PrivateKeyInfo privateKeyInfo)
Export a private key in PBES2 format, using a random PBKDF2 salt.
|
PrivateKeyInfo |
decrypt(Password pass,
KeyGenerator.CharToByteConverter charToByteConverter)
Decrypts an EncryptedPrivateKeyInfo that was encrypted with a PBE
algorithm.
|
void |
encode(java.io.OutputStream ostream)
Write this value's DER encoding to an output stream using
its own base tag.
|
void |
encode(Tag implicitTag,
java.io.OutputStream ostream)
Write this value's DER encoding to an output stream using
an implicit tag.
|
OCTET_STRING |
getEncryptedData() |
AlgorithmIdentifier |
getEncryptionAlgorithm() |
Tag |
getTag()
Returns the base tag for this type, not counting any tags
that may be imposed on it by its context.
|
static EncryptedPrivateKeyInfo.Template |
getTemplate() |
public EncryptedPrivateKeyInfo(AlgorithmIdentifier encryptionAlgorithm, OCTET_STRING encryptedData)
public AlgorithmIdentifier getEncryptionAlgorithm()
public OCTET_STRING getEncryptedData()
public static EncryptedPrivateKeyInfo createPBE(PBEAlgorithm keyGenAlg, Password password, byte[] salt, int iterationCount, KeyGenerator.CharToByteConverter charToByteConverter, PrivateKeyInfo pki) throws NotInitializedException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException, TokenException, java.io.CharConversionException
keyGenAlg - The algorithm for generating a symmetric key from
a password, salt, and iteration count.password - The password to use in generating the key.salt - The salt to use in generating the key.iterationCount - The number of hashing iterations to perform
while generating the key.charToByteConverter - The mechanism for converting the characters
in the password into bytes. If null, the default mechanism
will be used, which is UTF8.pki - The PrivateKeyInfo to be encrypted and stored in the
EncryptedContentInfo. Before they are encrypted, they will be
padded using PKCS padding.NotInitializedExceptionjava.security.NoSuchAlgorithmExceptionjava.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterExceptionTokenExceptionjava.io.CharConversionExceptionpublic static EncryptedPrivateKeyInfo createPBES2(int saltLen, int kdfIterations, EncryptionAlgorithm encAlg, Password pwd, KeyGenerator.CharToByteConverter charToByteConverter, PrivateKeyInfo privateKeyInfo) throws NotInitializedException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException, TokenException, java.io.CharConversionException
saltLen - Length of salt in bytes (default: 16)kdfIterations - PBKDF2 iterations (default: 2000)encAlg - The symmetric encryption algorithm for enciphering the
private key. Determines the size of derived key.pwd - PasswordcharToByteConverter - The mechanism for converting the characters
in the password into bytes. If null, the default mechanism
will be used, which is UTF8.privateKeyInfo - The encoded PrivateKeyInfo to be encrypted and
stored in the EncryptedContentInfo.NotInitializedExceptionjava.security.NoSuchAlgorithmExceptionjava.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterExceptionTokenExceptionjava.io.CharConversionExceptionpublic static EncryptedPrivateKeyInfo createPBE(PBEAlgorithm keyGenAlg, Password password, byte[] salt, int iterationCount, KeyGenerator.CharToByteConverter charToByteConverter, PrivateKey pri, CryptoToken token) throws NotInitializedException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException, TokenException, java.io.CharConversionException
keyGenAlg - The algorithm for generating a symmetric key from
a password, salt, and iteration count.password - The password to use in generating the key.salt - The salt to use in generating the key.iterationCount - The number of hashing iterations to perform
while generating the key.charToByteConverter - The mechanism for converting the characters
in the password into bytes. If null, the default mechanism
will be used, which is UTF8.pri - The PrivateKey to be encrypted and stored in the
EncryptedContentInfo.NotInitializedExceptionjava.security.NoSuchAlgorithmExceptionjava.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterExceptionTokenExceptionjava.io.CharConversionExceptionpublic PrivateKeyInfo decrypt(Password pass, KeyGenerator.CharToByteConverter charToByteConverter) throws NotInitializedException, java.security.NoSuchAlgorithmException, InvalidBERException, java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException, TokenException, IllegalBlockSizeException, javax.crypto.BadPaddingException, java.io.CharConversionException
pass - The password to use to generate the PBE key.charToByteConverter - The converter to change the password
characters to bytes. If null, the default conversion is used.NotInitializedExceptionjava.security.NoSuchAlgorithmExceptionInvalidBERExceptionjava.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterExceptionTokenExceptionIllegalBlockSizeExceptionjavax.crypto.BadPaddingExceptionjava.io.CharConversionExceptionpublic Tag getTag()
ASN1Valuepublic void encode(java.io.OutputStream ostream)
throws java.io.IOException
ASN1Valuepublic void encode(Tag implicitTag, java.io.OutputStream ostream) throws java.io.IOException
ASN1Valuepublic static EncryptedPrivateKeyInfo.Template getTemplate()