@Override public boolean isPasswordValid(String encPass, char[] rawPass, Object salt) { byte[] decoded = Base64.decode(encPass.getBytes()); byte[] decrypted = byteEncrypter.decrypt(decoded); char[] chars = toChars(decrypted); try { return Arrays.equals(chars, rawPass); } finally { scramble(decrypted); scramble(chars); } }
byte[] decode(byte[] passwd) { if (!config.isEncrypting()) { return passwd; } // decrypt the password StandardPBEByteEncryptor encryptor = new StandardPBEByteEncryptor(); char[] key = key(); try { encryptor.setPasswordCharArray(key); return encryptor.decrypt(Base64.decodeBase64(passwd)); } finally { scramble(key); } }
@Override public char[] decodeToCharArray(String encPass) throws UnsupportedOperationException { if (byteEncrypter == null) { // not initialized getCharEncoder(); } byte[] decoded = Base64.decode(removePrefix(encPass).getBytes()); byte[] bytes = byteEncrypter.decrypt(decoded); try { return toChars(bytes); } finally { scramble(bytes); } }
/** * Decrypts a byte array. * * @param encryptedBinary the byte array to be decrypted. * @see StandardPBEByteEncryptor#decrypt(byte[]) */ public byte[] decrypt(final byte[] encryptedBinary) { return this.encryptor.decrypt(encryptedBinary); }
/** * Decrypts a byte array. * * @param encryptedBinary the byte array to be decrypted. * @see StandardPBEByteEncryptor#decrypt(byte[]) */ public byte[] decrypt(final byte[] encryptedBinary) { return this.encryptor.decrypt(encryptedBinary); }
/** * Decrypts a byte array. * * @param encryptedBinary the byte array to be decrypted. * @see StandardPBEByteEncryptor#decrypt(byte[]) */ public byte[] decrypt(final byte[] encryptedBinary) { return this.encryptor.decrypt(encryptedBinary); }
/** * Decrypts a byte array. * * @param encryptedBinary the byte array to be decrypted. * @see StandardPBEByteEncryptor#decrypt(byte[]) */ public byte[] decrypt(final byte[] encryptedBinary) { return this.encryptor.decrypt(encryptedBinary); }
/** * Decrypts a byte array. * * @param encryptedBinary the byte array to be decrypted. * @see StandardPBEByteEncryptor#decrypt(byte[]) */ public byte[] decrypt(final byte[] encryptedBinary) { return this.encryptor.decrypt(encryptedBinary); }
/** * Decrypts a byte array. * * @param encryptedBinary the byte array to be decrypted. * @see StandardPBEByteEncryptor#decrypt(byte[]) */ public byte[] decrypt(final byte[] encryptedBinary) { return this.encryptor.decrypt(encryptedBinary); }
/** * Decrypt the given array and return the de-crypted one * * @param array * @return dec-array */ public static byte[] getDecrypted(byte[] array) { return encryptor.decrypt(array); }
@Override protected byte[] crypt(byte[] input, int mode) throws GeneralSecurityException { if (mode==Cipher.ENCRYPT_MODE) { return enc.encrypt(input); } else { return enc.decrypt(input); } } };
@Override protected byte[] crypt(byte[] input, int mode) throws GeneralSecurityException { if (mode == Cipher.ENCRYPT_MODE) { return enc.encrypt(input); } else { return enc.decrypt(input); } } };
public static byte[] decrypt(byte[] bytes, String key) { StandardPBEByteEncryptor encryptor = getEncryptor(key); return encryptor.decrypt(bytes); }
@Override public boolean isPasswordValid(String encPass, char[] rawPass, Object salt) { byte[] decoded = Base64.decode(encPass.getBytes()); byte[] decrypted = byteEncrypter.decrypt(decoded); char[] chars = toChars(decrypted); try { return Arrays.equals(chars, rawPass); } finally { scramble(decrypted); scramble(chars); } }
byte[] message = this.byteEncryptor.decrypt(encryptedMessageBytes);
return this.pool[poolPosition].decrypt(encryptedMessage);
return this.pool[poolPosition].decrypt(encryptedMessage);
return this.pool[poolPosition].decrypt(encryptedMessage);
@Override public char[] decodeToCharArray(String encPass) throws UnsupportedOperationException { if (byteEncrypter == null) { // not initialized getCharEncoder(); } byte[] decoded = Base64.decode(removePrefix(encPass).getBytes()); byte[] bytes = byteEncrypter.decrypt(decoded); try { return toChars(bytes); } finally { scramble(bytes); } }
/** * Decode the password * @param passwd * @return */ byte[] decode(byte[] passwd) { if (!isEncrypting()) { return passwd; } //decrypt the password StandardPBEByteEncryptor encryptor = new StandardPBEByteEncryptor(); char[] key = key(); try { encryptor.setPasswordCharArray(key); return encryptor.decrypt(Base64.decodeBase64(passwd)); } finally { scramble(key); } }