private String computeMaskedPassword ( ) throws Exception { // Create the PBE secret key SecretKeyFactory factory = SecretKeyFactory . getInstance ( VAULT_ENC_ALGORITHM ) ; char [ ] password = "somearbitrarycrazystringthatdoesnotmatter" . toCharArray ( ) ; PBEParameterSpec cipherSpec = new PBEParameterSpec ( salt . getBytes ( CHARSET ) , iterationCount ) ; PBEKeySpec keySpec = new PBEKeySpec ( password ) ; SecretKey cipherKey = factory . generateSecret ( keySpec ) ; String maskedPass = PBEUtils . encode64 ( keystorePassword . getBytes ( CHARSET ) , VAULT_ENC_ALGORITHM , cipherKey , cipherSpec ) ; return PicketBoxSecurityVault . PASS_MASK_PREFIX + maskedPass ; }
Method to compute masked password based on class attributes .