Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package cl.devetel;
- import java.io.IOException;
- import java.io.ByteArrayInputStream;
- import java.security.GeneralSecurityException;
- import java.io.InputStream;
- import org.apache.commons.io.IOUtils;
- import org.apache.commons.ssl.OpenSSL;
- public class TresDesDevpay {
- byte[] password = "ABCDEFGHIJKLMNOPQRSTUVWX".getBytes();
- byte[] data = "".getBytes();
- public String cifrar(String str) throws IOException, GeneralSecurityException{
- InputStream encrypted = OpenSSL.encrypt("des3",password,new ByteArrayInputStream(str.getBytes()),true);
- return IOUtils.toString(encrypted);
- }
- // Encrypt!
- // // Decrypt results of previous!
- // public String decifrar(String str) throws IOException, GeneralSecurityException{
- // data = OpenSSL.decrypt("des3", password, str.getBytes());
- // return new String(data);
- // }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement