|
|
@ -11,6 +11,7 @@ import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
|
|
|
|
import cokr.xit.base.crypto.bean.DGuard;
|
|
|
|
import cokr.xit.base.crypto.bean.DGuard;
|
|
|
|
import cokr.xit.base.crypto.bean.Echelon;
|
|
|
|
import cokr.xit.base.crypto.bean.Echelon;
|
|
|
|
|
|
|
|
import cokr.xit.base.crypto.bean.XitAria;
|
|
|
|
|
|
|
|
|
|
|
|
public class CryptographyTest /* extends TestSupport */ {
|
|
|
|
public class CryptographyTest /* extends TestSupport */ {
|
|
|
|
private String
|
|
|
|
private String
|
|
|
@ -54,7 +55,7 @@ public class CryptographyTest /* extends TestSupport */ {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
void xitAria() {
|
|
|
|
void xitAria() {
|
|
|
|
String name = "xit-aria";
|
|
|
|
String name = "xit-aria";
|
|
|
|
Cryptography aria = Cryptography.get(name);
|
|
|
|
XitAria aria = (XitAria)Cryptography.get(name);
|
|
|
|
|
|
|
|
|
|
|
|
String plain = "7011102177320",
|
|
|
|
String plain = "7011102177320",
|
|
|
|
encrypted = aria.encrypt(plain),
|
|
|
|
encrypted = aria.encrypt(plain),
|
|
|
@ -71,6 +72,19 @@ public class CryptographyTest /* extends TestSupport */ {
|
|
|
|
encrypted = "0EsqJtTQ+kaN3ISfI1g78IP9Rx9Vz9iiEliy1NV1G8w=";
|
|
|
|
encrypted = "0EsqJtTQ+kaN3ISfI1g78IP9Rx9Vz9iiEliy1NV1G8w=";
|
|
|
|
decrypted = aria.decrypt(encrypted);
|
|
|
|
decrypted = aria.decrypt(encrypted);
|
|
|
|
System.out.println(String.format("encrypted: %s -> decrypted: %s", encrypted, decrypted));
|
|
|
|
System.out.println(String.format("encrypted: %s -> decrypted: %s", encrypted, decrypted));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String key2 = new String(new byte[] {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F});
|
|
|
|
|
|
|
|
System.out.println(key2);
|
|
|
|
|
|
|
|
aria.setVersion(1)
|
|
|
|
|
|
|
|
.setKeySize(128)
|
|
|
|
|
|
|
|
// .setKey("3AsrGqpYYnkHIu3D")
|
|
|
|
|
|
|
|
.setKey(key2);
|
|
|
|
|
|
|
|
plain = "ZUDDN1129404";
|
|
|
|
|
|
|
|
encrypted = aria.encrypt(plain);
|
|
|
|
|
|
|
|
decrypted = aria.decrypt(encrypted);
|
|
|
|
|
|
|
|
System.out.println(String.format("plain: %s -> encrypted: %s -> decrypted: %s", plain, encrypted, decrypted));
|
|
|
|
|
|
|
|
System.out.println(aria.decrypt("OBSVd++xen8anRrG5jtFmg=="));
|
|
|
|
|
|
|
|
System.out.println(aria.decrypt("ryGrL2tVXRVHEQhYm7ps2g=="));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private String md5(String str) {
|
|
|
|
private String md5(String str) {
|
|
|
|