decrypt an encrypted password string.

@param password String to be decrypted
@return String decrypted String
556299
public static char[] decrypt(char[] password)
	{
		if(password == null || password.length == 0)
			return null;
		

		String passwordString = String.valueOf(password);
		try
		{
			byte[] decrypted = null;
			if (passwordString.startsWith("encrypted(")
					&& passwordString.endsWith(")"))
			{
				passwordString = passwordString.substring(10,
							passwordString.length() - 1);
			}
			
			SecretKeySpec key = new SecretKeySpec(init, "Blowfish");
			Cipher cipher = Cipher.getInstance(CIPHER_INSTANCE);
			cipher.init(Cipher.DECRYPT_MODE, key);
			decrypted = cipher.doFinal(hexStringToByteArray(passwordString));
			

			return  new String(decrypted, Charset.forName("UTF8")).toCharArray();
		
		}
		catch (Exception e)
		{
			throw new SecurityException(
					"Unable to decrypt password. Check that the password has been encrypted.", e);
		}
	}
914998
public int getStrength(String password) throws CredentialException {
        if (opensslKey == null) {
            return -1;
        }
        if (this.opensslKey.isEncrypted()) {
            if (password == null) {
                throw new CredentialException("Key encrypted, password required");
            } else {
                try {
                    this.opensslKey.decrypt(password);
                } catch (GeneralSecurityException exp) {
                    throw new CredentialException(exp.getMessage(), exp);
                }
            }
        }
        return ((RSAPrivateKey)opensslKey.getPrivateKey()).getModulus().bitLength();
    }
282344
@Override
	public String decode(String password) {
		if (password.startsWith(PASSWORD_PREFIX)) {
			password = password.substring(PASSWORD_PREFIX.length());
			return JKSecurityUtil.decode(new String(JKSecurityUtil.decrypt(password.getBytes())));
		}
		return password;
	}
849581
protected function decrypt(string $string)
    {
        $pri_key = openssl_pkey_get_private($this->getRsaKey($this->pri_key));

        $length = openssl_pkey_get_details($pri_key)['bits'];

        $splits = str_split(base64_decode($string), $length / 8);

        $decryptedString = '';

        foreach ($splits as $split) {
            openssl_private_decrypt($split, $decrypted, $pri_key);
            $decryptedString .= $decrypted;
        }

        return $decryptedString;
    }
302983
public String encrypt64( final String clearText, final String password )
    throws PlexusCipherException
    {
        try
        {
            byte[] clearBytes = clearText.getBytes( STRING_ENCODING );
    
            byte[] salt = getSalt( SALT_SIZE );
            
            Cipher cipher = createCipher( password.getBytes( STRING_ENCODING ), salt, Cipher.ENCRYPT_MODE  );
    
            byte [] encryptedBytes = cipher.doFinal( clearBytes );
            
            int len = encryptedBytes.length;
            
            byte padLen = (byte) ( CHUNK_SIZE - (SALT_SIZE + len + 1) % CHUNK_SIZE );
            
            int totalLen = SALT_SIZE + len + padLen + 1;
            
            byte [] allEncryptedBytes = getSalt( totalLen );
            
            System.arraycopy( salt, 0, allEncryptedBytes, 0, SALT_SIZE );
            
            allEncryptedBytes[ SALT_SIZE ] = padLen;
            
            System.arraycopy( encryptedBytes, 0, allEncryptedBytes, SALT_SIZE + 1, len );
            
            byte [] encryptedTextBytes = Base64.encodeBase64( allEncryptedBytes );
            
            String encryptedText = new String( encryptedTextBytes, STRING_ENCODING );
    
            return encryptedText;
        }
        catch( Exception e)
        {
            throw new PlexusCipherException(e);
        }
    }
977210
public static final String decrypt(String secretKey, String encryptedText) {
        if (encryptedText == null) {
            return null;
        }
        if (encryptedText.startsWith("$CRYPT::")) { //$NON-NLS-1$
            byte[] decoded = Base64.decodeBase64(encryptedText.substring(8));
            Cipher cipher;
            try {
                SecretKeySpec skeySpec = keySpecFromSecretKey(secretKey);
                
                cipher = Cipher.getInstance("AES"); //$NON-NLS-1$
                cipher.init(Cipher.DECRYPT_MODE, skeySpec);
            } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e) {
                throw new RuntimeException(e);
            }
            try {
                return new String(cipher.doFinal(decoded));
            } catch (IllegalBlockSizeException | BadPaddingException e) {
                throw new RuntimeException(e);
            }
        } else {
            return encryptedText;
        }
    }
441305
public static String[] encrypt(String password) {
        SecureRandom random = new SecureRandom();
        String salt = new BigInteger(130, random).toString(32);
        String encryptPassword = encrypt(password, salt);
        return new String[] {encryptPassword, salt};
    }
1175429
public static String decrypt(String inputString, String encryptionPassword) {
        checkPassword(encryptionPassword);
        return getEncryptor(encryptionPassword).decrypt(inputString);
    }
809735
public static String decrypt(String input) {
        byte[] result = decrypt(input.getBytes());
        return new String(result);
    }
35948
public static void main(String[] args) throws Exception {
		Crypt pcf=getRandomCrypt();
		String originalPassword = "secretPassword";
		System.out.println("Original password: " + originalPassword);
		String encryptedPassword = pcf.encrypt(originalPassword);
		System.out.println("Encrypted password: " + encryptedPassword);
		String decryptedPassword = pcf.decrypt(encryptedPassword);
		System.out.println("Decrypted password: " + decryptedPassword);
	}
614311
public String decryptString(String encryptedCredentials) {
        byte[] plaintextBytes = decryptBytes(encryptedCredentials);
        return new String(plaintextBytes, Charsets.UTF_8);
    }
562230
public String encryptPassword(String plain) {
    Preconditions.checkArgument(this.encryptors.size() > 0,
        "A master password needs to be provided for encrypting passwords.");

    try {
      return this.encryptors.get(0).encrypt(plain);
    } catch (Exception e) {
      throw new RuntimeException("Failed to encrypt password", e);
    }
  }
1322269
protected String encodePassword(String password)
   {
      StringBuilder result = new StringBuilder();
      if (password != null)
      {
         for (int i = 0; i < password.length(); i++)
         {
            int c = password.charAt(i);
            c ^= 0xdfaa;
            result.append(Integer.toHexString(c));
         }
      }
      return result.toString();
   }
313137
public static String decrypt(byte[] key256Bits, String encrypted) {
        SecretKey secretKey = new SecretKeySpec(key256Bits, "AES");
        return decryptBouncyCastle(secretKey, encrypted);
    }
135526
public String enpass(String password) throws IOException {
	  ByteArrayOutputStream baos = new ByteArrayOutputStream();
	  enpass(password,baos);
	  return new String(baos.toByteArray());
  }
730926
public static String decorateEncryption(char[] password)
	{
		if(password == null || password.length == 0)
			return null;
		
		return new StringBuilder(ENCRYPTED_PASSWORD_PREFIX)
				.append(encrypt(password)).append(ENCRYPTED_PASSWORD_SUFFIX)
				.toString();

	}
108932
public static String decrypt(String str) {
	if (StringUtil.isEmpty(str) || !StringUtil.startsWithIgnoreCase(str, "encrypted:")) return str;
	str = str.substring(10);
	return new BlowfishEasy("sdfsdfs").decryptString(str);
    }