public static byte[] decryptKey(byte[] password,byte[] encryptedKey){
  try {
    Cipher c=Cipher.getInstance(ENCRYPT_KEY_ALGORITHM);
    c.init(Cipher.DECRYPT_MODE,new SecretKeySpec(password,SECRET_KEY_ALGORITHM),CBC_SALT_KEY);
    return c.doFinal(encryptedKey);
  }
 catch (  Exception e) {
    throw new IllegalStateException(ENCRYPT_KEY_ALGORITHM + " is not available",e);
  }
}

public static byte [ ] decryptKey ( byte [ ] password , byte [ ] encryptedKey ) { try { Cipher c = Cipher . getInstance ( ENCRYPT_KEY_ALGORITHM ) ; c . init ( Cipher . DECRYPT_MODE , new SecretKeySpec ( password , SECRET_KEY_ALGORITHM ) , CBC_SALT_KEY ) ; return c . doFinal ( encryptedKey ) ; } catch ( Exception e ) { throw new IllegalStateException ( ENCRYPT_KEY_ALGORITHM + " is not available" , e ) ; } }
decrypt key ( does not use salting , so the encryption result is the same for the same input )
