Commit 77684aeb authored by Cypres TAC's avatar Cypres TAC
Browse files

Merge branch 'feat/key-gen' into 'master'

allow to easily generate Clea keys

See merge request !30
parents 19e9d354 4e598a4a
Pipeline #237246 passed with stages
in 8 minutes and 40 seconds
......@@ -49,9 +49,10 @@ All dependencies are noted in the `pom.xml`
Possibility to use encoding and decoding of a LSP using the main executable (`LspEncoderDecoder.java`)
* `java -cp java/target/clea-lsp-0.0.1-SNAPSHOT-jar-with-dependencies.jar fr.inria.clea.lsp.LspEncoderDecoder`
* `Usage: LspEncoderDecoder [read qrcode64 privKey] [build staff countryCode CRIexp venueType venueCategory1 venueCategory2 periodDuration pubkey]`
* `java -jar java/target/clea-lsp-*-jar-with-dependencies.jar`
* `Usage: LspEncoderDecoder [gen-keys] [decode lsp64 privKey] [encode staff countryCode CRIexp venueType venueCategory1 venueCategory2 periodDuration locationPhone locationPin pubkey]`
* the result is displayed on the console
* To generate a Clea key pair, use `java -jar java/target/clea-lsp-*-jar-with-dependencies.jar gen-keys`. Generated keys will be displayed on std output.
* used for C(encoding)/Java(decoding) operability tests in the project `../test`.
## TODO
......
......@@ -106,10 +106,8 @@
<version>3.0.0-M5</version>
</plugin>
<plugin>
<!-- Build an executable JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
......@@ -118,12 +116,6 @@
<mainClass>fr.inria.clea.lsp.LspEncoderDecoder</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
......
......@@ -15,7 +15,7 @@ public class LspEncoderDecoder {
* @see README.md
*/
public static void main(String[] args) throws Exception {
final String help = "Usage: LspEncoderDecoder [decode lsp64 privKey] [encode staff countryCode CRIexp venueType venueCategory1 venueCategory2 periodDuration locationPhone locationPin pubkey]";
final String help = "Usage: LspEncoderDecoder [gen-keys] [decode lsp64 privKey] [encode staff countryCode CRIexp venueType venueCategory1 venueCategory2 periodDuration locationPhone locationPin pubkey]";
if (args.length == 0) {
System.out.println(help);
......@@ -26,11 +26,19 @@ public class LspEncoderDecoder {
encodeLsp(args);
} else if ("decode".equals(args[0]) && args.length == 4) {
decodeLsp(args);
} else if ("gen-keys".equals(args[0])) {
generateKeyPair();
} else {
System.out.println(help);
}
}
protected static void generateKeyPair() throws Exception {
String[] keyPair = new CleaEciesEncoder().genKeysPair(true);
System.out.println("Clea EC Private Key: " + keyPair[0]);
System.out.println("Clea EC Public Key : " + keyPair[1]);
}
protected static void decodeLsp(String[] args) throws CleaCryptoException {
String lspBase64 = args[1];
String serverAuthoritySecretKey = args[2];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment