Package org.jasypt.util.text

Examples of org.jasypt.util.text.BasicTextEncryptor


   * @throws java.lang.Exception
   */
  @Test
  public void testTextEncryptionUsingBasicTextEncryptor() throws Exception {
    // 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


//* @author Richard07
//*/
//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;
    }
View Full Code Here

         String cadenaEncriptada = encriptador.encrypt(cadena);
         return cadenaEncriptada;
    }

    private static String desencriptar(String cadena, String clave) {
         BasicTextEncryptor desencriptador = new BasicTextEncryptor();
         desencriptador.setPassword(clave);
         String cadenaDesencriptada = desencriptador.decrypt(cadena);
         return cadenaDesencriptada;
    }
View Full Code Here

    private int cursel;

    /** Creates new form ServerSelectGUI */
    public ServerSelectGUI(Properties ConfigData) {
        initComponents();
        encryptor = new BasicTextEncryptor();
        encryptor.setPassword("XQ1kg3L3zjPEnZZTtu01dohfPEyiwW0TzrUVwiPcjuZKIgVxD8qRnvK64j5xJsq");
        len = ConfigData.size() / 5;
        ServersList = new ArrayList();
        int c = 0;
        do {
View Full Code Here

    MNCServer(final String newip,
            final int newport,
            final String newlogin,
            final String newpwd) {

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

        Authenticator.setDefault(new Authenticator() {

            @Override
View Full Code Here

        return getEncryptor().decrypt(message);
    }

    private BasicTextEncryptor getEncryptor() {
        if (encryptor == null) {
            encryptor = new BasicTextEncryptor();
            encryptor.setPassword(this.getUuid() + HASH_KEY);
        }
        return encryptor;
    }
View Full Code Here

 
  /**
   *  Constructor for password encryption class
   */
  public TextEncryption() {
    encryptor = new BasicTextEncryptor();
    encryptor.setPassword(entryptorPassword);           // we HAVE TO set a password

  }
View Full Code Here

 
  /**
   *  Constructor for password encryption class
   */
  public TextEncryption() {
    encryptor = new BasicTextEncryptor();
    encryptor.setPassword(entryptorPassword);           // we HAVE TO set a password

  }
View Full Code Here

    private BasicTextEncryptor encryptor;

    public JasyptExample(String password) {

        encryptor = new BasicTextEncryptor();
        encryptor.setPassword(password);
    }
View Full Code Here

public class JasyptTest {
 
    @Test
    public void simpleTest(){

        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

TOP

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

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.