Package org.jasypt.util.text

Examples of org.jasypt.util.text.StrongTextEncryptor


   * @throws java.lang.Exception
   */
  @Test
  public void testTextEncryptionUsingStrongTextEncryptor() throws Exception {
    // Declare a strong encryptor
    StrongTextEncryptor te = new StrongTextEncryptor();
    // Set password to use
    te.setPassword(PASSWORD_FOR_ENCRYPTION);
    // Encrypt text. By default the algorithm used is PBEWithMD5AndTripleDES
    String encryptedText = te.encrypt(TEXT_TO_ENCRYPT);
    System.out.printf("testTextEncryptionUsingStrongTextEncryptor : '%s' become '%s'\n", TEXT_TO_ENCRYPT, encryptedText);
    // Valid "encrypted" text
    Assert.assertEquals(te.decrypt(encryptedText), TEXT_TO_ENCRYPT);
  }
View Full Code Here


     */
    public JuTextEncryptor createTextEncryptor() {
      AssertUtil.assertFalse("Password must be set", StringUtils.isEmpty(this.password));
     
      if (this.strongEncryption) {
        StrongTextEncryptor encryptor = new StrongTextEncryptor();
        encryptor.setPassword(this.password);
        return asJuTextEncryptor(encryptor);
      } else {
        BasicTextEncryptor encryptor = new BasicTextEncryptor();
        encryptor.setPassword(this.password);
        return asJuTextEncryptor(encryptor);
      }
    }
View Full Code Here

TOP

Related Classes of org.jasypt.util.text.StrongTextEncryptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.