private static KeyHolder getHolder(String key) {
        char[] keyChars = _resolver.get().getKey(key == null ? "${wlp.password.encryption.key}" : key);
        KeyHolder holder = _key.get();
        if (holder == null || !!!holder.matches(keyChars)) {
            try {
                SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
                KeySpec aesKey = new PBEKeySpec(keyChars, new byte[] { -89, -94, -125, 57, 76, 90, -77, 79, 50, 21, 10, -98, 47, 23, 17, 56, -61, 46, 125, -128 }, 84756, 128);
                byte[] data = keyFactory.generateSecret(aesKey).getEncoded();
                KeyHolder holder2 = new KeyHolder(keyChars, new SecretKeySpec(data, "AES"), new IvParameterSpec(data));
                _key.compareAndSet(holder, holder2);
                // Still use this holder for returns even if I do not end up caching it.
                holder = holder2;
            } catch (InvalidKeySpecException e) {
                return null;
            } catch (NoSuchAlgorithmException e) {
                return null;
            }

        }
        return holder;
    }
private static KeyHolder getHolder ( String key ) { char [ ] keyChars = _resolver . get ( ) . getKey ( key == null ? "${wlp.password.encryption.key}" : key ) ; KeyHolder holder = _key . get ( ) ; if ( holder == null || ! ! ! holder . matches ( keyChars ) ) { try { SecretKeyFactory keyFactory = SecretKeyFactory . getInstance ( "PBKDF2WithHmacSHA1" ) ; KeySpec aesKey = new PBEKeySpec ( keyChars , new byte [ ] { - 89 , - 94 , - 125 , 57 , 76 , 90 , - 77 , 79 , 50 , 21 , 10 , - 98 , 47 , 23 , 17 , 56 , - 61 , 46 , 125 , - 128 } , 84756 , 128 ) ; byte [ ] data = keyFactory . generateSecret ( aesKey ) . getEncoded ( ) ; KeyHolder holder2 = new KeyHolder ( keyChars , new SecretKeySpec ( data , "AES" ) , new IvParameterSpec ( data ) ) ; _key . compareAndSet ( holder , holder2 ) ; holder = holder2 ; } catch ( InvalidKeySpecException e ) { return null ; } catch ( NoSuchAlgorithmException e ) { return null ; } } return holder ; }
@param holder
@param keyChars
@return