Merge branch 'master' of https://vcs.factcenter.org/meerkat/meerkat-java into voting-booth-gui
						commit
						6350da1fc2
					
				|  | @ -33,7 +33,7 @@ import static java.lang.System.exit; | ||||||
|  * Command-line mixProverVerifier and verifier. |  * Command-line mixProverVerifier and verifier. | ||||||
|  */ |  */ | ||||||
| public class Mix { | public class Mix { | ||||||
|     final static String DEFAULT_ECGROUP = "secp256k1"; |     final static String DEFAULT_ECGROUP = "secp256r1"; | ||||||
|     final static Logger logger = LoggerFactory.getLogger(Mix.class); |     final static Logger logger = LoggerFactory.getLogger(Mix.class); | ||||||
| 
 | 
 | ||||||
|     public Random rand; |     public Random rand; | ||||||
|  | @ -108,13 +108,17 @@ public class Mix { | ||||||
|         mixProverVerifier = new Mix2nizk(rand, enc); |         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. |      * Create a new ECElGamal key pair and write it serialized to file. | ||||||
|      * |      * | ||||||
|      * @param outFile |      * @param outFile | ||||||
|      */ |      */ | ||||||
|     public void createKeypair(File outFile) throws IOException { |     public void createKeypair(String curveName, File outFile) throws IOException { | ||||||
|         group = new ECGroup(DEFAULT_ECGROUP); |         group = new ECGroup(curveName); | ||||||
|         BigInteger sk = ECElGamal.generateSecretKey(group, rand); |         BigInteger sk = ECElGamal.generateSecretKey(group, rand); | ||||||
|         secretKey = new ECElGamal.SK(group, sk); |         secretKey = new ECElGamal.SK(group, sk); | ||||||
| 
 | 
 | ||||||
|  | @ -228,6 +232,8 @@ public class Mix { | ||||||
|     public static void main(String[] args) { |     public static void main(String[] args) { | ||||||
|         OptionParser parser = new OptionParser(); |         OptionParser parser = new OptionParser(); | ||||||
|         final OptionSpec<Void> OPT_HELP = parser.accepts("help", "Print help"); |         final OptionSpec<Void> OPT_HELP = parser.accepts("help", "Print help"); | ||||||
|  |         final OptionSpec<String> OPT_CURVENAME = parser.accepts("curve-name", "Use the given named elliptic curve").withRequiredArg().ofType(String.class) | ||||||
|  |                 .defaultsTo(DEFAULT_ECGROUP); | ||||||
|         final OptionSpec<Void> OPT_GENKEY = parser.accepts("genkey", "Generate a key-pair (write into key file)"); |         final OptionSpec<Void> OPT_GENKEY = parser.accepts("genkey", "Generate a key-pair (write into key file)"); | ||||||
|         final OptionSpec<Void> OPT_DECRYPT = parser.accepts("decrypt", "Decrypt using given keypair"); |         final OptionSpec<Void> OPT_DECRYPT = parser.accepts("decrypt", "Decrypt using given keypair"); | ||||||
|         final OptionSpec<File> OPT_KEYFILE = parser.accepts("keys", "File containing public key (or keypair for decryption)").withRequiredArg().ofType(File.class); |         final OptionSpec<File> 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 { |         try { | ||||||
|             if (options.has(OPT_GENKEY)) { |             if (options.has(OPT_GENKEY)) { | ||||||
|                 mix.createKeypair(keyFile); |                 mix.createKeypair(options.valueOf(OPT_CURVENAME), keyFile); | ||||||
|             } else { |             } else { | ||||||
|                 mix.loadKeypair(keyFile); |                 mix.loadKeypair(keyFile); | ||||||
|                 if (options.has(OPT_ENCRYPT)) { |                 if (options.has(OPT_ENCRYPT)) { | ||||||
|  |  | ||||||
|  | @ -28,7 +28,7 @@ public class SigmaFiatShamir<NIZKMsgType, FirstMsgType extends Message, FinalMes | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Fiat–Shamir heuristic |      * Fiat-Shamir heuristic | ||||||
|      * @param input - protobuf contains all parameters from the first step of the current proof |      * @param input - protobuf contains all parameters from the first step of the current proof | ||||||
|      * @return randomOracle.hash(input) |      * @return randomOracle.hash(input) | ||||||
|      */ |      */ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue