File tree Expand file tree Collapse file tree 3 files changed +8
-14
lines changed
main/java/org/bouncycastle/pqc/legacy/crypto/mceliece
test/java/org/bouncycastle/pqc/legacy/crypto/test Expand file tree Collapse file tree 3 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ public class McElieceFujisakiCipher
3030 */
3131 public static final String OID = "1.3.6.1.4.1.8301.3.1.3.4.2.1" ;
3232
33- private static final String DEFAULT_PRNG_NAME = "SHA1PRNG" ;
34-
3533 private Digest messDigest ;
3634
3735 private SecureRandom sr ;
Original file line number Diff line number Diff line change 1313import org .bouncycastle .pqc .legacy .math .linearalgebra .ByteUtils ;
1414import org .bouncycastle .pqc .legacy .math .linearalgebra .GF2Vector ;
1515import org .bouncycastle .pqc .legacy .math .linearalgebra .IntegerFunctions ;
16+ import org .bouncycastle .util .Arrays ;
17+ import org .bouncycastle .util .Strings ;
1618
1719/**
1820 * This class implements the Kobara/Imai conversion of the McEliecePKCS. This is
2325public class McElieceKobaraImaiCipher
2426 implements MessageEncryptor
2527{
28+ public static byte [] getPublicConstant ()
29+ {
30+ return Arrays .clone (PUBLIC_CONSTANT );
31+ }
2632
2733 /**
2834 * The OID of the algorithm.
2935 */
3036 public static final String OID = "1.3.6.1.4.1.8301.3.1.3.4.2.3" ;
3137
32- private static final String DEFAULT_PRNG_NAME = "SHA1PRNG" ;
33-
3438 /**
3539 * A predetermined public constant.
3640 */
37- public static final byte [] PUBLIC_CONSTANT = "a predetermined public constant"
38- .getBytes ();
39-
41+ private static final byte [] PUBLIC_CONSTANT = Strings .toByteArray ("a predetermined public constant" );
4042
4143 private Digest messDigest ;
4244
Original file line number Diff line number Diff line change @@ -129,13 +129,7 @@ public void performTest()
129129
130130 // XXX write in McElieceFujisakiDigestCipher?
131131
132- boolean verified = true ;
133- for (int i = 0 ; i < hash .length ; i ++)
134- {
135- verified = verified && hash [i ] == constructedmessage [i ];
136- }
137-
138- if (!verified )
132+ if (!Arrays .areEqual (hash , constructedmessage ))
139133 {
140134 fail ("en/decryption fails" );
141135 }
You can’t perform that action at this time.
0 commit comments