forked from bcgit/bc-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests New Hope/Sphincs-256 key gen.
fixed New Hope strength at size of dimension.
- Loading branch information
Showing
6 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
.../src/test/java/org/bouncycastle/pqc/jcajce/provider/test/NewHopeKeyPairGeneratorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.bouncycastle.pqc.jcajce.provider.test; | ||
|
||
import java.security.KeyFactory; | ||
import java.security.KeyPairGenerator; | ||
import java.security.SecureRandom; | ||
|
||
import org.bouncycastle.pqc.asn1.PQCObjectIdentifiers; | ||
|
||
|
||
public class NewHopeKeyPairGeneratorTest | ||
extends KeyPairGeneratorTest | ||
{ | ||
|
||
protected void setUp() | ||
{ | ||
super.setUp(); | ||
} | ||
|
||
public void testKeyFactory() | ||
throws Exception | ||
{ | ||
kf = KeyFactory.getInstance("NH", "BCPQC"); | ||
kf = KeyFactory.getInstance(PQCObjectIdentifiers.newHope.getId(), "BCPQC"); | ||
} | ||
|
||
public void testKeyPairEncoding() | ||
throws Exception | ||
{ | ||
kf = KeyFactory.getInstance("NH", "BCPQC"); | ||
|
||
kpg = KeyPairGenerator.getInstance("NH", "BCPQC"); | ||
kpg.initialize(1024, new SecureRandom()); | ||
|
||
performKeyPairEncodingTest(kpg.generateKeyPair()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...c/test/java/org/bouncycastle/pqc/jcajce/provider/test/Sphincs256KeyPairGeneratorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.bouncycastle.pqc.jcajce.provider.test; | ||
|
||
import java.security.KeyFactory; | ||
import java.security.KeyPairGenerator; | ||
import java.security.SecureRandom; | ||
|
||
import org.bouncycastle.pqc.asn1.PQCObjectIdentifiers; | ||
import org.bouncycastle.pqc.jcajce.spec.SPHINCS256KeyGenParameterSpec; | ||
|
||
|
||
public class Sphincs256KeyPairGeneratorTest | ||
extends KeyPairGeneratorTest | ||
{ | ||
|
||
protected void setUp() | ||
{ | ||
super.setUp(); | ||
} | ||
|
||
public void testKeyFactory() | ||
throws Exception | ||
{ | ||
kf = KeyFactory.getInstance("SPHINCS256", "BCPQC"); | ||
kf = KeyFactory.getInstance(PQCObjectIdentifiers.newHope.getId(), "BCPQC"); | ||
} | ||
|
||
public void testKeyPairEncoding() | ||
throws Exception | ||
{ | ||
kf = KeyFactory.getInstance("SPHINCS256", "BCPQC"); | ||
|
||
kpg = KeyPairGenerator.getInstance("SPHINCS256", "BCPQC"); | ||
kpg.initialize(new SPHINCS256KeyGenParameterSpec(SPHINCS256KeyGenParameterSpec.SHA512_256), new SecureRandom()); | ||
performKeyPairEncodingTest(kpg.generateKeyPair()); | ||
} | ||
|
||
} |