public class PKCS8ShroudedKeyBag extends KeyBag
SafeBag
,
Attributes
Modifier | Constructor and Description |
---|---|
protected |
PKCS8ShroudedKeyBag()
The default constructor.
|
protected |
PKCS8ShroudedKeyBag(KeyBag keyBag)
Creates a new PKCS8ShroudedKeyBag from a KeyBag.
|
Modifier and Type | Method and Description |
---|---|
void |
decode(ASN1Object obj)
Decodes the PKCS8ShroudedKeyBag given as ASN1Object.
|
void |
decrypt(char[] password)
Decrypts this KeyBag using the given password.
|
void |
encrypt(char[] password,
AlgorithmID algorithm,
int iterationCount)
Encrypts this KeyBag using the given password.
|
void |
encrypt(char[] password,
AlgorithmID algorithm,
java.security.SecureRandom random,
int iterationCount)
Encrypts this KeyBag using the given password.
|
ASN1Object |
toASN1Object()
Returns this PKCS8ShroudedKeyBag as ASN1Object.
|
java.lang.String |
toString()
Returns a String representation of this PKCS8ShroudedKeyBag.
|
getPrivateKey
create, encodeSafeContents, encodeSafeContentsAsASN1Object, getBagType, parseSafeContents, parseSafeContents, register
getAttributes, getFriendlyName, getLocalKeyID, setAttributes, setFriendlyName, setLocalKeyID
protected PKCS8ShroudedKeyBag()
protected PKCS8ShroudedKeyBag(KeyBag keyBag)
keyBag
- the KeyBagpublic void decode(ASN1Object obj) throws CodingException
decode
in interface ASN1Type
decode
in class KeyBag
obj
- the PKCS8ShroudedKeyBag as ASN1ObjectCodingException
- if the PKCS8ShroudedKeyBag cannot be decodedpublic ASN1Object toASN1Object() throws CodingException
toASN1Object
in interface ASN1Type
toASN1Object
in class KeyBag
CodingException
- if an de/encoding error occurspublic void decrypt(char[] password) throws java.security.NoSuchAlgorithmException, java.security.GeneralSecurityException
password
- the passwordjava.security.NoSuchAlgorithmException
java.security.GeneralSecurityException
public void encrypt(char[] password, AlgorithmID algorithm, int iterationCount) throws java.security.NoSuchAlgorithmException
password
- the password to be usedalgorithm
- the algorithm to be used, e.g.
PbeWithSHAAnd3_KeyTripleDES_CBC
; by default PBES2 is used
with HMacSHA256 has prf function and AES-256 as encryption scheme
(PBES2WithHmacSHA256AndAES256
iterationCount
- the iteration count to be usedjava.security.NoSuchAlgorithmException
public void encrypt(char[] password, AlgorithmID algorithm, java.security.SecureRandom random, int iterationCount) throws java.security.NoSuchAlgorithmException
password
- the password to be usedalgorithm
- the algorithm to be used, e.g.
PbeWithSHAAnd3_KeyTripleDES_CBC
random
- the SecureRandom to be usediterationCount
- the iteration count to be usedjava.security.NoSuchAlgorithmException