Skip to content

Commit

Permalink
Update signature tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fireduck64 committed Nov 3, 2020
1 parent 74dd160 commit 9f872d9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
6 changes: 6 additions & 0 deletions WORKSPACE
Expand Up @@ -65,6 +65,12 @@ maven_install(
maven_install_json = "//:maven_install.json",

)
# After updating run:
#
# bazel run @unpinned_maven//:pin
#
# See: https://github.com/bazelbuild/rules_jvm_external


load("@maven//:defs.bzl", "pinned_maven_install")
pinned_maven_install()
Expand Down
30 changes: 23 additions & 7 deletions lib/test/SignatureTest.java
Expand Up @@ -38,9 +38,10 @@ public void testRSA()
java.security.spec.RSAKeyGenParameterSpec.F0);

// RSA should just work with any key size someone feels like making so whatever

testAlgo("RSA", spec, "SHA256withRSA", null, 10240);
testAlgo("RSA", spec, "RSA", null, 24);

// Can't handle large data
testAlgo("RSA", spec, "RSA", null, 32);
}
@Test
public void testDSA()
Expand All @@ -52,9 +53,11 @@ public void testDSA()
spec = null;

// DSA should just work with any key size someone feels like making so whatever

testAlgo("DSA", spec, "SHA256withDSA", null, 10240);
testAlgo("DSA", spec, "DSA", null, 24);

// Is actually DSA with SHA1
testAlgo("DSA", spec, "DSA", null, 10240);
testAlgo("DSA", spec, "DSA", null, 32);
}

@Test
Expand All @@ -64,7 +67,8 @@ public void testEC()
java.security.spec.ECGenParameterSpec spec = new java.security.spec.ECGenParameterSpec("secp256k1");

testAlgo("ECDSA", spec, "SHA256withECDSA", null, 10240);
testAlgo("ECDSA", spec, "ECDSA", null, 24);
testAlgo("ECDSA", spec, "ECDSA", null, 2400);
testAlgo("ECDSA", spec, "ECDSA", null, 32);
}

@Test
Expand All @@ -74,7 +78,8 @@ public void testEC384()
java.security.spec.ECGenParameterSpec spec = new java.security.spec.ECGenParameterSpec("secp384r1");

testAlgo("ECDSA", spec, "SHA256withECDSA", null, 10240);
testAlgo("ECDSA", spec, "ECDSA", null, 24);
testAlgo("ECDSA", spec, "ECDSA", null, 2400);
testAlgo("ECDSA", spec, "ECDSA", null, 32);
}
@Test
public void testEC521()
Expand All @@ -83,7 +88,8 @@ public void testEC521()
java.security.spec.ECGenParameterSpec spec = new java.security.spec.ECGenParameterSpec("secp521r1");

testAlgo("ECDSA", spec, "SHA256withECDSA", null, 10240);
testAlgo("ECDSA", spec, "ECDSA", null, 24);
testAlgo("ECDSA", spec, "ECDSA", null, 2400);
testAlgo("ECDSA", spec, "ECDSA", null, 32);
}


Expand All @@ -99,8 +105,18 @@ public void testDSTU4145()
testAlgo("DSTU4145", spec, "GOST3411WITHDSTU4145", null, 10240);
testAlgo("DSTU4145", spec, "DSTU4145", null, 24000); //whatever the hell this is, seems to handle large data size
testAlgo("DSTU4145", spec, "DSTU4145", null, 24);
testAlgo("DSTU4145", spec, "DSTU4145", null, 32);
}

@Test
public void testED25519()
throws Exception
{
testAlgo("ED25519", null, "ED25519", null, 10240);
}



@Test
public void testCompressedEcPrefix() throws Exception
{
Expand Down

0 comments on commit 9f872d9

Please sign in to comment.