* if the key could not be decrypted or decoded.
*/
public PrivateKey getPrivateKey(char[] password)
throws GeneralSecurityException {
AlgorithmParameters params;
AlgorithmIdentifier aid;
PBEParameterSpec pspec;
SecretKeyFactory skf;
PrivateKeyInfo pki;
KeyFactory kf;
DERDecoder dec;
SecretKey secret;
KeySpec kspec;
Cipher cipher;
String name;
byte[] buf;
try {
name = algorithm_.getAlgorithmOID().toString();
params = algorithm_.getParameters();
pspec = (PBEParameterSpec) params
.getParameterSpec(PBEParameterSpec.class);
skf = SecretKeyFactory.getInstance(name);
kspec = new PBEKeySpec(password);
secret = skf.generateSecret(kspec);
cipher = Cipher.getInstance(name);
cipher.init(Cipher.DECRYPT_MODE, secret, pspec);
buf = cipher.doFinal(encryptedData_.getByteArray());
kspec = new PKCS8EncodedKeySpec(buf);
pki = new PrivateKeyInfo();
dec = new DERDecoder(new ByteArrayInputStream(buf));
pki.decode(dec);
dec.close();
aid = pki.getAlgorithmIdentifier();
name = aid.getAlgorithmOID().toString();
kf = KeyFactory.getInstance(name);
return kf.generatePrivate(kspec);
} catch (ASN1Exception e) {
throw new UnrecoverableKeyException(e.getMessage());