private static String decrypt(String resourcePassword) throws Exception { int startIdx = resourcePassword.indexOf("{"); int endIdx = resourcePassword.indexOf("}"); if (startIdx != 0 || endIdx == -1) return resourcePassword; String cipher = resourcePassword.substring(1, endIdx); if (log.isDebugEnabled()) log.debug("resource password is encrypted, decrypting " + resourcePassword); return CryptoEngine.decrypt(cipher, resourcePassword.substring(endIdx + 1)); }
private static String decrypt(String resourcePassword) throws Exception { int startIdx = resourcePassword.indexOf("{"); int endIdx = resourcePassword.indexOf("}"); if (startIdx != 0 || endIdx == -1) return resourcePassword; String cipher = resourcePassword.substring(1, endIdx); if (log.isDebugEnabled()) { log.debug("resource password is encrypted, decrypting " + resourcePassword); } return CryptoEngine.decrypt(cipher, resourcePassword.substring(endIdx + 1)); } }
private static String decrypt(String resourcePassword) throws Exception { int startIdx = resourcePassword.indexOf("{"); int endIdx = resourcePassword.indexOf("}"); if (startIdx != 0 || endIdx == -1) return resourcePassword; String cipher = resourcePassword.substring(1, endIdx); if (log.isDebugEnabled()) log.debug("resource password is encrypted, decrypting " + resourcePassword); return CryptoEngine.decrypt(cipher, resourcePassword.substring(endIdx + 1)); }
private static String decrypt(String resourcePassword) throws Exception { int startIdx = resourcePassword.indexOf("{"); int endIdx = resourcePassword.indexOf("}"); if (startIdx != 0 || endIdx == -1) return resourcePassword; String cipher = resourcePassword.substring(1, endIdx); if (log.isDebugEnabled()) { log.debug("resource password is encrypted, decrypting " + resourcePassword); } return CryptoEngine.decrypt(cipher, resourcePassword.substring(endIdx + 1)); } }
public void testCrypt() throws Exception { String textToCrypt = "java"; String cypherText = CryptoEngine.crypt("DES", textToCrypt); String decryptedText = CryptoEngine.decrypt("DES", cypherText); assertEquals(textToCrypt, decryptedText); }
public void testCrypt() throws Exception { String textToCrypt = "java"; String cypherText = CryptoEngine.crypt("DES", textToCrypt); String decryptedText = CryptoEngine.decrypt("DES", cypherText); assertEquals(textToCrypt, decryptedText); }