You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
Java
37 lines
1.1 KiB
Java
import com.Ineb.Dguard.*;
|
|
import com.Ineb.Exception.DguardLoginException;
|
|
import com.Ineb.Exception.DguardNetworkException;
|
|
import com.Ineb.Exception.DGuardPropertyException;
|
|
|
|
import java.sql.*;
|
|
import java.util.*;
|
|
import java.io.*;
|
|
|
|
public class APITest2 {
|
|
|
|
public static void main(String[] args) {
|
|
try {
|
|
DguardManager dm = DguardManager.Init("db_agent", "Agent!1700", "Agent!1700", "./3rd-party/dguard/conf/dguard.conf");
|
|
|
|
String Table = "CRYPTO";
|
|
String Column1 = "PWD";
|
|
String Column2 = "ENC";
|
|
String[] Data = {"1234", "000010000001", "9999999999999"};
|
|
|
|
String HashStr = dm.MsgDigest(Table, Column1, Data[0]);
|
|
System.out.println("MsgDigest " + " : [" + HashStr + "]");
|
|
|
|
String EncStr;
|
|
String DecStr;
|
|
for (int i = 0; i < Data.length; i++) {
|
|
EncStr = dm.Encrypt(Table, Column2, Data[i]);
|
|
System.out.println("Encrypt " + i + " : [" + EncStr + "]");
|
|
DecStr = dm.Decrypt(Table, Column2, EncStr);
|
|
System.out.println("Decrypt " + i + " : [" + DecStr + "]");
|
|
}
|
|
} catch(Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|