diff options
| author | davidhofman | 2021-09-06 19:51:02 +0200 |
|---|---|---|
| committer | GitHub | 2021-09-06 19:51:02 +0200 |
| commit | 69ce36e4537be52c103e8b5a314cca49cc931d8f (patch) | |
| tree | a911f3c6586a00c151ed054794073bb7cece904f /src/cz/crcs/ectester/common/ec/CustomECParameterSpec.java | |
| parent | f1f6ca75524d152e347be8926fd43c98aeb504ac (diff) | |
| download | ECTester-69ce36e4537be52c103e8b5a314cca49cc931d8f.tar.gz ECTester-69ce36e4537be52c103e8b5a314cca49cc931d8f.tar.zst ECTester-69ce36e4537be52c103e8b5a314cca49cc931d8f.zip | |
Implement StandaloneWrongSuite. (#12)
* Add StandaloneWrongSuite.
* Partially implement StandaloneWrongSuite.
* Add setParam method to EC_Params.
* Fix new setParam method in EC_Params.
* Implement StandaloneWrongSuite
* Add custom classes for testing wrong curve parameters.
* Update custom classes.
* Add more custom classes for testing curves with wrong parameters.
* Modify StandaloneWrongSuite to work with the new custom classes.
* Various small cosmetic changes to new custom classes.
* Add missing author information to various classes.
* Fix a small mistake in CustomECFieldF2m
* Add randomG test, change some variables to final.
* Add option to skip certain tests + various small changes.
Diffstat (limited to 'src/cz/crcs/ectester/common/ec/CustomECParameterSpec.java')
| -rw-r--r-- | src/cz/crcs/ectester/common/ec/CustomECParameterSpec.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/cz/crcs/ectester/common/ec/CustomECParameterSpec.java b/src/cz/crcs/ectester/common/ec/CustomECParameterSpec.java new file mode 100644 index 0000000..cbc15e7 --- /dev/null +++ b/src/cz/crcs/ectester/common/ec/CustomECParameterSpec.java @@ -0,0 +1,47 @@ +package cz.crcs.ectester.common.ec; + +import java.math.BigInteger; +import java.security.spec.ECFieldFp; +import java.security.spec.ECParameterSpec; +import java.security.spec.ECPoint; +import java.security.spec.EllipticCurve; + +/** + * @author David Hofman + */ +public class CustomECParameterSpec extends ECParameterSpec { + private EllipticCurve curve; + private ECPoint g; + private BigInteger n; + private int h; + + public CustomECParameterSpec(EllipticCurve curve, ECPoint g, BigInteger n, int h) { + //feed the constructor of the superclass some default, valid data + //getters will return custom (and possibly invalid) parameters instead + super(new EllipticCurve(new ECFieldFp(BigInteger.ONE),BigInteger.ZERO,BigInteger.ZERO), new ECPoint(BigInteger.ZERO, BigInteger.ZERO), BigInteger.ONE, 1); + this.curve = curve; + this.g = g; + this.n = n; + this.h = h; + } + + @Override + public EllipticCurve getCurve() { + return curve; + } + + @Override + public ECPoint getGenerator() { + return g; + } + + @Override + public BigInteger getOrder() { + return n; + } + + @Override + public int getCofactor() { + return h; + } +} |
