This API guide explains how to use the WizCrypt engine inside your application. It is recommended that you have the JavaDoc opened in another window while going through this guide. The approximate time to learn this API is about 1-5 minutes depending on your expertise in Java.
The Exception handling code is not shown. Please refer to JavaDoc.
import org.wiztools.wizcrypt.CipherKey;
import org.wiztools.wizcrypt.CipherKeyGen;
import org.wiztools.wizcrypt.WizCrypt;
import java.io.*;
// Get the CipherKey object by giving the password:
String password = "mypassword";
CipherKey ck = CipherKeyGen.getCipherKeyForEncrypt(password);
// Get the InputStream & OutputStream
InputStream is = new FileInputStream("myfile.jpg");
OutputStream os = new FileOutputStream("myfile.jpg.wiz");
// Encrypt!
WizCrypt.encrypt(is, os, ck);
import org.wiztools.wizcrypt.CipherKey;
import org.wiztools.wizcrypt.CipherKeyGen;
import org.wiztools.wizcrypt.WizCrypt;
import java.io.*;
// Get the CipherKey object by giving the password:
String password = "mypassword";
CipherKey ck = CipherKeyGen.getCipherKeyForDecrypt(password);
// Get the InputStream & OutputStream
InputStream is = new FileInputStream("myfile.jpg.wiz");
OutputStream os = new FileOutputStream("myfile.jpg");
// Decrypt!
WizCrypt.decrypt(is, os, ck);
Note: CipherKey generation for both encryption and decryption call different methods.
For using the API, download wizcrypt-XX.jar. The only other dependency WizCrypt has, Commons-cli is not needed when the API is used. So, if you are planning to use the API and not WizCrypt as a tool, download wizcrypt-XX.jar and not wizcrypt-XX-jar-with-dependencies.jar.
Read the guide for Callback functionality. This allows one to write applications with progress bar kind of feedback functionality.