public void decrypt(byte[] password) throws GeneralSecurityException {
        if (!isEncrypted()) {
            return;
        }

        byte[] enc = Base64.decode(this.encodedKey);

        SecretKeySpec key = getSecretKey(password, this.initializationVector.getIV());

        Cipher cipher = getCipher();
        cipher.init(Cipher.DECRYPT_MODE, key, this.initializationVector);
        enc = cipher.doFinal(enc);

        this.intKey = getKey(this.keyAlg, enc);
        this.keyData = enc;
        this.isEncrypted = false;
        this.encodedKey = null;
    }
public void decrypt ( byte [ ] password ) throws GeneralSecurityException { if ( ! isEncrypted ( ) ) { return ; } byte [ ] enc = Base64 . decode ( this . encodedKey ) ; SecretKeySpec key = getSecretKey ( password , this . initializationVector . getIV ( ) ) ; Cipher cipher = getCipher ( ) ; cipher . init ( Cipher . DECRYPT_MODE , key , this . initializationVector ) ; enc = cipher . doFinal ( enc ) ; this . intKey = getKey ( this . keyAlg , enc ) ; this . keyData = enc ; this . isEncrypted = false ; this . encodedKey = null ; }
Decrypts the private key with given password.
Does nothing if the key is not encrypted.

@param password password to decrypt the key with.
@throws GeneralSecurityException whenever an error occurs during decryption.