Package pruebas

Source Code of pruebas.Encriptar

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package pruebas;

import org.jasypt.util.text.BasicTextEncryptor;
import org.jasypt.util.text.StrongTextEncryptor;

/**
*
* @author Clara
*/
public class Encriptar {


///**
//*
//* @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;
    }

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

    /**
    * @param args the command line arguments
    */
    public static void Encriptar() {
         String cadena = "Tu búsqueda ha finalizado";
         String clave = "www.IFconFig.com.ar";
         String cadenaEncriptada = encriptar(cadena, clave);
         System.out.println("Cadena Encriptada = " + cadenaEncriptada);
         System.out.println("Cadena Desencriptada = " + desencriptar(cadenaEncriptada, clave));
    }
//    }
}
TOP

Related Classes of pruebas.Encriptar

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.