modules/common/src/main/java/org/picketlink/common/util/StringUtil.java
/**
     * Given a masked password {@link String}, decode it
     *
     * @param maskedString a password string that is masked
     * @param salt Salt
     * @param iterationCount Iteration Count
     *
     * @return Decoded String
     *
     * @throws Exception
     */
Given a masked password  String, decode it
@param maskedString a password string that is masked
@param salt Salt
@param iterationCount Iteration Count

@return Decoded String

@throws Exception
Given a masked password String decode it @param maskedString a password string that is masked @param salt Salt @param iterationCount Iteration Count @return Decoded String @throws Exception
public static String decode(String maskedString, String salt, int iterationCount) throws Exception {
        String pbeAlgo = PicketLinkCommonConstants.PBE_ALGORITHM;
        if (maskedString.startsWith(PicketLinkCommonConstants.PASS_MASK_PREFIX)) {
            SecretKeyFactory factory = SecretKeyFactory.getInstance(pbeAlgo);
            char[] password = "somearbitrarycrazystringthatdoesnotmatter".toCharArray();
            PBEParameterSpec cipherSpec = new PBEParameterSpec(salt.getBytes(), iterationCount);
            PBEKeySpec keySpec = new PBEKeySpec(password);
            SecretKey cipherKey = factory.generateSecret(keySpec);
            maskedString = maskedString.substring(PicketLinkCommonConstants.PASS_MASK_PREFIX.length());
            String decodedValue = PBEUtils.decode64(maskedString, pbeAlgo, cipherKey, cipherSpec);
            maskedString = decodedValue;
        }
        return maskedString;
    }
public static String decode ( String maskedString , String salt , int iterationCount ) throws Exception { String pbeAlgo = PicketLinkCommonConstants . PBE_ALGORITHM ; if ( maskedString . startsWith ( PicketLinkCommonConstants . PASS_MASK_PREFIX ) ) { SecretKeyFactory factory = SecretKeyFactory . getInstance ( pbeAlgo ) ; char [ ] password = "somearbitrarycrazystringthatdoesnotmatter" . toCharArray ( ) ; PBEParameterSpec cipherSpec = new PBEParameterSpec ( salt . getBytes ( ) , iterationCount ) ; PBEKeySpec keySpec = new PBEKeySpec ( password ) ; SecretKey cipherKey = factory . generateSecret ( keySpec ) ; maskedString = maskedString . substring ( PicketLinkCommonConstants . PASS_MASK_PREFIX . length ( ) ) ; String decodedValue = PBEUtils . decode64 ( maskedString , pbeAlgo , cipherKey , cipherSpec ) ; maskedString = decodedValue ; } return maskedString ; }
Given a masked password {@link String}, decode it
 @param maskedString a password string that is masked
 @param salt Salt
 @param iterationCount Iteration Count
Given a masked password { @link String } decode it @param maskedString a password string that is masked @param salt Salt @param iterationCount Iteration Count
// Create the PBE secret key