Package org.jasypt.util.text

Examples of org.jasypt.util.text.BasicTextEncryptor.encrypt()


    // Declare a basic encryptor
    BasicTextEncryptor te = new BasicTextEncryptor();
    // Set password to use
    te.setPassword(PASSWORD_FOR_ENCRYPTION);
    // Encrypt text. By default the algorithm used is PBEWithMD5AndDES
    String encryptedText = te.encrypt(TEXT_TO_ENCRYPT);
    System.out.printf("testTextEncryptionUsingBasicTextEncryptor : '%s' become '%s'\n", TEXT_TO_ENCRYPT, encryptedText);
    // Valid "encrypted" text
    Assert.assertEquals(te.decrypt(encryptedText), TEXT_TO_ENCRYPT);
  }
View Full Code Here


//public class Main {

    private static String encriptar(String cadena, String clave) {
         BasicTextEncryptor encriptador = new BasicTextEncryptor();
         encriptador.setPassword(clave);
         String cadenaEncriptada = encriptador.encrypt(cadena);
         return cadenaEncriptada;
    }

    private static String desencriptar(String cadena, String clave) {
         BasicTextEncryptor desencriptador = new BasicTextEncryptor();
View Full Code Here

        BasicTextEncryptor encryptor = new BasicTextEncryptor();
        encryptor.setPassword("secret");

        String message = "super secret message";
        String encrypted = encryptor.encrypt(message);
        System.out.println(encrypted);

        assertEquals(message, encryptor.decrypt(encrypted));

    }
View Full Code Here

    @Before
    public void setUp() throws Exception {
        final BasicTextEncryptor basicTextEncryptor = new BasicTextEncryptor();
        basicTextEncryptor.setPassword(ENCRYPTION_KEY);
        encryptedValue = basicTextEncryptor.encrypt(UNENCRYPTED_VALUE);
        encryptedProperties = new Properties();
        encryptedProperties.put(KEY, encryptedValue);

    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.