diff --git a/mixer/src/main/java/meerkat/mixer/main/Mix.java b/mixer/src/main/java/meerkat/mixer/main/Mix.java index dc67dbd..0eb2211 100644 --- a/mixer/src/main/java/meerkat/mixer/main/Mix.java +++ b/mixer/src/main/java/meerkat/mixer/main/Mix.java @@ -33,7 +33,7 @@ import static java.lang.System.exit; * Command-line mixProverVerifier and verifier. */ public class Mix { - final static String DEFAULT_ECGROUP = "secp256k1"; + final static String DEFAULT_ECGROUP = "secp256r1"; final static Logger logger = LoggerFactory.getLogger(Mix.class); public Random rand; @@ -108,13 +108,17 @@ public class Mix { mixProverVerifier = new Mix2nizk(rand, enc); } + public void createKeypair(File outFile) throws IOException { + createKeypair(DEFAULT_ECGROUP, outFile); + } + /** * Create a new ECElGamal key pair and write it serialized to file. * * @param outFile */ - public void createKeypair(File outFile) throws IOException { - group = new ECGroup(DEFAULT_ECGROUP); + public void createKeypair(String curveName, File outFile) throws IOException { + group = new ECGroup(curveName); BigInteger sk = ECElGamal.generateSecretKey(group, rand); secretKey = new ECElGamal.SK(group, sk); @@ -228,6 +232,8 @@ public class Mix { public static void main(String[] args) { OptionParser parser = new OptionParser(); final OptionSpec OPT_HELP = parser.accepts("help", "Print help"); + final OptionSpec OPT_CURVENAME = parser.accepts("curve-name", "Use the given named elliptic curve").withRequiredArg().ofType(String.class) + .defaultsTo(DEFAULT_ECGROUP); final OptionSpec OPT_GENKEY = parser.accepts("genkey", "Generate a key-pair (write into key file)"); final OptionSpec OPT_DECRYPT = parser.accepts("decrypt", "Decrypt using given keypair"); final OptionSpec OPT_KEYFILE = parser.accepts("keys", "File containing public key (or keypair for decryption)").withRequiredArg().ofType(File.class); @@ -261,7 +267,7 @@ public class Mix { try { if (options.has(OPT_GENKEY)) { - mix.createKeypair(keyFile); + mix.createKeypair(options.valueOf(OPT_CURVENAME), keyFile); } else { mix.loadKeypair(keyFile); if (options.has(OPT_ENCRYPT)) { diff --git a/mixer/src/main/java/meerkat/mixer/proofs/generic/SigmaFiatShamir.java b/mixer/src/main/java/meerkat/mixer/proofs/generic/SigmaFiatShamir.java index 9275fd0..06e5047 100644 --- a/mixer/src/main/java/meerkat/mixer/proofs/generic/SigmaFiatShamir.java +++ b/mixer/src/main/java/meerkat/mixer/proofs/generic/SigmaFiatShamir.java @@ -28,7 +28,7 @@ public class SigmaFiatShamir