diff --git a/ebac.identity/src/main/java/org/cassproject/ebac/identity/EcContact.java b/ebac.identity/src/main/java/org/cassproject/ebac/identity/EcContact.java index 494672ce6..216476ea4 100644 --- a/ebac.identity/src/main/java/org/cassproject/ebac/identity/EcContact.java +++ b/ebac.identity/src/main/java/org/cassproject/ebac/identity/EcContact.java @@ -115,7 +115,7 @@ public String getImageUrl() { */ public EbacContact toEncryptedContact(String secret) { EbacContact c = new EbacContact(); - c.iv = EcAes.newIv(32); + c.iv = EcAes.newIv(16); c.pk = EcAesCtr.encrypt(pk.toPem(), secret, c.iv); c.displayNameIv = EcAes.newIv(16); c.displayName = EcAesCtr.encrypt(displayName, secret, c.iv); diff --git a/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcAesAsyncTest.java b/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcAesAsyncTest.java index 35e8d1a39..1730526fe 100644 --- a/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcAesAsyncTest.java +++ b/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcAesAsyncTest.java @@ -10,7 +10,7 @@ import static org.stjs.javascript.Global.console; @RunWith(STJSTestDriverRunner.class) -@ScriptsBefore({"pem-jwk.js", "require.js", "/forge/forge.bundle.js", "ec.base.js"}) +@ScriptsBefore({"pem-jwk.js", "require.js", "/forge/forge.bundle.js", "ec.base.js", "base64toArrayBuffer.js"}) public class EcAesAsyncTest { @Test public void aesTest() { @@ -54,9 +54,9 @@ public void aesCrossTest1() { console.log("-----aesCrossTest1-----"); final String randomString = EcAes.newIv(1024); console.log("Random string: " + randomString); - final String secret = EcAes.newIv(32); + final String secret = EcAes.newIv(16); console.log("Random secret: " + secret); - final String iv = EcAes.newIv(32); + final String iv = EcAes.newIv(16); console.log("Random iv:" + iv); EcAesCtrAsync.encrypt(randomString, secret, iv, new Callback1() { @Override @@ -81,9 +81,9 @@ public void aesCrossTest1Utf8() { console.log("-----aesCrossTest1Utf8-----"); final String randomString = "ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ"; console.log("Random string: " + randomString); - final String secret = EcAes.newIv(32); + final String secret = EcAes.newIv(16); console.log("Random secret: " + secret); - final String iv = EcAes.newIv(32); + final String iv = EcAes.newIv(16); console.log("Random iv:" + iv); EcAesCtrAsync.encrypt(randomString, secret, iv, new Callback1() { @Override @@ -108,9 +108,9 @@ public void aesCrossTest2Utf8() { console.log("-----aesCrossTest2Utf8-----"); final String randomString = "ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ"; console.log("Random string: " + randomString); - final String secret = EcAes.newIv(32); + final String secret = EcAes.newIv(16); console.log("Random secret: " + secret); - final String iv = EcAes.newIv(32); + final String iv = EcAes.newIv(16); console.log("Random iv:" + iv); String encrypted = EcAesCtr.encrypt(randomString, secret, iv); console.log("Encrypted String: " + encrypted); @@ -171,9 +171,9 @@ public void aesCrossTest1Worker() { console.log("-----aesCrossTest1Worker-----"); final String randomString = EcAes.newIv(1024); console.log("Random string: " + randomString); - final String secret = EcAes.newIv(32); + final String secret = EcAes.newIv(16); console.log("Random secret: " + secret); - final String iv = EcAes.newIv(32); + final String iv = EcAes.newIv(16); console.log("Random iv:" + iv); EcAesCtrAsyncWorker.encrypt(randomString, secret, iv, new Callback1() { @Override @@ -198,9 +198,9 @@ public void aesCrossTest1Utf8Worker() { console.log("-----aesCrossTest1Utf8Worker-----"); final String randomString = "ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ"; console.log("Random string: " + randomString); - final String secret = EcAes.newIv(32); + final String secret = EcAes.newIv(16); console.log("Random secret: " + secret); - final String iv = EcAes.newIv(32); + final String iv = EcAes.newIv(16); console.log("Random iv:" + iv); EcAesCtrAsyncWorker.encrypt(randomString, secret, iv, new Callback1() { @Override @@ -225,9 +225,9 @@ public void aesCrossTest2Utf8Worker() { console.log("-----aesCrossTest2Utf8Worker-----"); final String randomString = "ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ"; console.log("Random string: " + randomString); - final String secret = EcAes.newIv(32); + final String secret = EcAes.newIv(16); console.log("Random secret: " + secret); - final String iv = EcAes.newIv(32); + final String iv = EcAes.newIv(16); console.log("Random iv:" + iv); String encrypted = EcAesCtr.encrypt(randomString, secret, iv); console.log("Encrypted String: " + encrypted); diff --git a/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcAesTest.java b/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcAesTest.java index 7a1f8fc2b..1269c9f8f 100644 --- a/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcAesTest.java +++ b/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcAesTest.java @@ -9,16 +9,16 @@ import static org.stjs.javascript.Global.console; @RunWith(STJSTestDriverRunner.class) -@ScriptsBefore({"pem-jwk.js", "require.js", "/forge/forge.bundle.js", "ec.base.js"}) +@ScriptsBefore({"pem-jwk.js", "require.js", "/forge/forge.bundle.js", "ec.base.js", "base64toArrayBuffer.js"}) public class EcAesTest { @Test public void aesTest() { console.log("-----aesTest-----"); String randomString = EcAes.newIv(1024); console.log("Random string: " + randomString); - String secret = EcAes.newIv(32); + String secret = EcAes.newIv(16); console.log("Random secret: " + secret); - String iv = EcAes.newIv(32); + String iv = EcAes.newIv(16); console.log("Random iv:" + iv); String encrypted = EcAesCtr.encrypt(randomString, secret, iv); console.log("Encrypted String: " + encrypted); @@ -33,9 +33,9 @@ public void aesUtf8Test() { console.log("-----aesUtf8Test-----"); String randomString = "abcᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ"; console.log("Random string: " + randomString); - String secret = EcAes.newIv(32); + String secret = EcAes.newIv(16); console.log("Random secret: " + secret); - String iv = EcAes.newIv(32); + String iv = EcAes.newIv(16); console.log("Random iv:" + iv); String encrypted = EcAesCtr.encrypt(randomString, secret, iv); console.log("Encrypted String: " + encrypted); diff --git a/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcPpkTest.java b/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcPpkTest.java index dd6f4c67d..fbcdce65f 100644 --- a/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcPpkTest.java +++ b/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcPpkTest.java @@ -9,7 +9,7 @@ import static org.stjs.javascript.Global.console; @RunWith(STJSTestDriverRunner.class) -@ScriptsBefore({"pem-jwk.js", "require.js", "/forge/forge.bundle.js", "ec.base.js"}) +@ScriptsBefore({"pem-jwk.js", "require.js", "/forge/forge.bundle.js", "ec.base.js", "base64toArrayBuffer.js"}) public class EcPpkTest { @Test diff --git a/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcRsaTest.java b/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcRsaTest.java index eb9fb8daf..d5372f4d2 100644 --- a/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcRsaTest.java +++ b/ec.crypto/src/test/java/com/eduworks/ec/crypto/EcRsaTest.java @@ -11,7 +11,7 @@ import static org.stjs.javascript.Global.console; @RunWith(STJSTestDriverRunner.class) -@ScriptsBefore({"pem-jwk.js", "require.js", "/forge/forge.bundle.js", "ec.base.js"}) +@ScriptsBefore({"pem-jwk.js", "require.js", "/forge/forge.bundle.js", "ec.base.js", "base64toArrayBuffer.js"}) public class EcRsaTest { @Test public void rsaOaepTest() {