@Test(priority = 8) public void testEncrypt2() { String input = "EncryptMe"; String encrypted = cryptoTool.encrypt(input); Assert.assertNotNull(encrypted); Assert.assertFalse(encrypted.equals(input)); }
public String encrypt(String strToEncrypt) { try { cipher.init(Cipher.ENCRYPT_MODE, key); final String encryptedString = new String(Base64.encodeBase64(cipher.doFinal(strToEncrypt.getBytes()))); return encryptedString; } catch (Exception e) { throw new RuntimeException("Error while encrypting, check your crypto key! " + e.getMessage(), e); } }
CryptoTool { public String encrypt(String strToEncrypt) { try { cipher.init(Cipher.ENCRYPT_MODE, key); final String encryptedString = new String(Base64.encodeBase64(cipher.doFinal(strToEncrypt.getBytes()))); return encryptedString; } catch (Exception e) { throw new RuntimeException("Error while encrypting, check your crypto key! " + e.getMessage(), e); } } }
CryptoTool { public String encrypt(String strToEncrypt) { try { cipher.init(Cipher.ENCRYPT_MODE, key); final String encryptedString = new String(Base64.encodeBase64(cipher.doFinal(strToEncrypt.getBytes()))); return encryptedString; } catch (Exception e) { throw new RuntimeException("Error while encrypting, check your crypto key! " + e.getMessage(), e); } } CryptoTool(String cryptoAlgorithm, String cryptoKeyType, Key key);  CryptoTool();  CryptoTool(String cryptoKeyPath);  CryptoTool(String cryptoAlgorithm, String cryptoKeyType, String cryptoKeyPath); }
CryptoTool { public String encrypt(String strToEncrypt) { try { cipher.init(Cipher.ENCRYPT_MODE, key); final String encryptedString = new String(Base64.encodeBase64(cipher.doFinal(strToEncrypt.getBytes()))); return encryptedString; } catch (Exception e) { throw new RuntimeException("Error while encrypting, check your crypto key! " + e.getMessage(), e); } } CryptoTool(String cryptoAlgorithm, String cryptoKeyType, Key key);  CryptoTool();  CryptoTool(String cryptoKeyPath);  CryptoTool(String cryptoAlgorithm, String cryptoKeyType, String cryptoKeyPath); String encrypt(String strToEncrypt); String decrypt(String strToDecrypt); String encryptByPattern(String content, Pattern pattern); String decryptByPattern(String content, Pattern pattern); String encryptByPatternAndWrap(String content, Pattern pattern, String wrapper); String decryptByPatternAndWrap(String content, Pattern pattern, String wrapper); String getAlgorithm(); void setAlgorithm(String algorithm); Cipher getCipher(); void setCipher(Cipher cipher); }
CryptoTool { public String encrypt(String strToEncrypt) { try { cipher.init(Cipher.ENCRYPT_MODE, key); final String encryptedString = new String(Base64.encodeBase64(cipher.doFinal(strToEncrypt.getBytes()))); return encryptedString; } catch (Exception e) { throw new RuntimeException("Error while encrypting, check your crypto key! " + e.getMessage(), e); } } CryptoTool(String cryptoAlgorithm, String cryptoKeyType, Key key);  CryptoTool();  CryptoTool(String cryptoKeyPath);  CryptoTool(String cryptoAlgorithm, String cryptoKeyType, String cryptoKeyPath); String encrypt(String strToEncrypt); String decrypt(String strToDecrypt); String encryptByPattern(String content, Pattern pattern); String decryptByPattern(String content, Pattern pattern); String encryptByPatternAndWrap(String content, Pattern pattern, String wrapper); String decryptByPatternAndWrap(String content, Pattern pattern, String wrapper); String getAlgorithm(); void setAlgorithm(String algorithm); Cipher getCipher(); void setCipher(Cipher cipher);  }