summaryrefslogtreecommitdiffstats
path: root/bcprov/src/main/java/org/bouncycastle/pqc/jcajce/provider/test/McElieceCCA2PrimitivesTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'bcprov/src/main/java/org/bouncycastle/pqc/jcajce/provider/test/McElieceCCA2PrimitivesTest.java')
-rw-r--r--bcprov/src/main/java/org/bouncycastle/pqc/jcajce/provider/test/McElieceCCA2PrimitivesTest.java71
1 files changed, 0 insertions, 71 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/pqc/jcajce/provider/test/McElieceCCA2PrimitivesTest.java b/bcprov/src/main/java/org/bouncycastle/pqc/jcajce/provider/test/McElieceCCA2PrimitivesTest.java
deleted file mode 100644
index 39e16ad..0000000
--- a/bcprov/src/main/java/org/bouncycastle/pqc/jcajce/provider/test/McElieceCCA2PrimitivesTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.bouncycastle.pqc.jcajce.provider.test;
-
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.NoSuchAlgorithmException;
-
-import org.bouncycastle.pqc.jcajce.provider.mceliece.BCMcElieceCCA2PrivateKey;
-import org.bouncycastle.pqc.jcajce.provider.mceliece.BCMcElieceCCA2PublicKey;
-import org.bouncycastle.pqc.jcajce.provider.mceliece.McElieceCCA2Primitives;
-import org.bouncycastle.pqc.jcajce.spec.ECCKeyGenParameterSpec;
-import org.bouncycastle.pqc.math.linearalgebra.GF2Vector;
-
-
-public class McElieceCCA2PrimitivesTest
- extends FlexiTest
-{
-
- KeyPairGenerator kpg;
-
- protected void setUp()
- {
- super.setUp();
- try
- {
- kpg = KeyPairGenerator.getInstance("McElieceKobaraImai");
- }
- catch (NoSuchAlgorithmException e)
- {
- e.printStackTrace();
- }
- }
-
- public void testPrimitives()
- throws Exception
- {
- int m = 11;
- int t = 50;
- initKPG(m, t);
- int n = 1 << m;
-
- KeyPair pair = kpg.genKeyPair();
- BCMcElieceCCA2PublicKey pubKey = (BCMcElieceCCA2PublicKey)pair.getPublic();
- BCMcElieceCCA2PrivateKey privKey = (BCMcElieceCCA2PrivateKey)pair
- .getPrivate();
-
- GF2Vector plaintext = new GF2Vector(pubKey.getK(), sr);
- GF2Vector errors = new GF2Vector(n, t, sr);
-
- GF2Vector ciphertext = McElieceCCA2Primitives.encryptionPrimitive(
- pubKey, plaintext, errors);
-
- GF2Vector[] dec = McElieceCCA2Primitives.decryptionPrimitive(privKey,
- ciphertext);
- GF2Vector plaintextAgain = dec[0];
- GF2Vector errorsAgain = dec[1];
-
- assertEquals(plaintext, plaintextAgain);
- assertEquals(errors, errorsAgain);
- }
-
- /**
- * Initialize the key pair generator with the given parameters.
- */
- private void initKPG(int m, int t)
- throws Exception
- {
- ECCKeyGenParameterSpec params = new ECCKeyGenParameterSpec(m, t);
- kpg.initialize(params);
- }
-
-}