IT
암복호화 예제(AES)
밥알이
2014. 6. 12. 14:29
package hello;
import crypto.CipherUtils;
public class AesSample {
private static final String KEY_ALGORITHM = "AES";
private static final String CIPHER_ALGORITHM = "AES/ECB/ZeroBytePadding";
private static final String KEY_STRING = "abcdefgh01234567";
public static void main(String[] args) {
System.out.println("Key: " + KEY_STRING);
CipherUtils cu = new CipherUtils(KEY_ALGORITHM, CIPHER_ALGORITHM, KEY_STRING);
String data = "This is just an exampleaaaa"; System.out.println("Data: " + data);
try {
String encryptedHex = cu.encrypt(data);
System.out.println("Encrypted Hex: " + encryptedHex);
String decryptedData = cu.decrypt(encryptedHex);
System.out.println("Decrypted Data: " + decryptedData);
} catch (Exception e) {
// TODO Auto-generated catch block e.printStackTrace();
}
}
}