47
47
*
48
48
* @author Petr Svenda [email protected]
49
49
* @author Jan Jancar [email protected]
50
+ * @version v0.1.0
50
51
*/
51
52
public class ECTester {
52
53
@@ -58,8 +59,11 @@ public class ECTester {
58
59
private Config cfg ;
59
60
60
61
private Options opts = new Options ();
61
- private static final String CLI_HEADER = "\n ECTester, a javacard Elliptic Curve Cryptograhy support tester/utility.\n \n " ;
62
- private static final String CLI_FOOTER =
"\n MIT Licensed\n Copyright (c) 2016-2017 Petr Svenda <[email protected] >" ;
62
+ private static final String VERSION = "v0.1.0" ;
63
+ private static final String DESCRIPTION = "ECTester " + VERSION + ", a javacard Elliptic Curve Cryptograhy support tester/utility." ;
64
+ private static final String LICENSE =
"MIT Licensed\n Copyright (c) 2016-2017 Petr Svenda <[email protected] >" ;
65
+ private static final String CLI_HEADER = "\n " + DESCRIPTION + "\n \n " ;
66
+ private static final String CLI_FOOTER = "\n " + LICENSE ;
63
67
64
68
private static final byte [] SELECT_ECTESTERAPPLET = {(byte ) 0x00 , (byte ) 0xa4 , (byte ) 0x04 , (byte ) 0x00 , (byte ) 0x0a ,
65
69
(byte ) 0x45 , (byte ) 0x43 , (byte ) 0x54 , (byte ) 0x65 , (byte ) 0x73 , (byte ) 0x74 , (byte ) 0x65 , (byte ) 0x72 , (byte ) 0x30 , (byte ) 0x31 };
@@ -74,6 +78,10 @@ private void run(String[] args) {
74
78
if (cli .hasOption ("help" )) {
75
79
help ();
76
80
return ;
81
+ } else if (cli .hasOption ("version" )) {
82
+ System .out .println (DESCRIPTION );
83
+ System .out .println (LICENSE );
84
+ return ;
77
85
}
78
86
cfg = new Config ();
79
87
@@ -200,6 +208,7 @@ private void run(String[] args) {
200
208
private CommandLine parseArgs (String [] args ) throws ParseException {
201
209
/*
202
210
* Actions:
211
+ * -V / --version
203
212
* -h / --help
204
213
* -e / --export
205
214
* -g / --generate [amount]
@@ -242,6 +251,7 @@ private CommandLine parseArgs(String[] args) throws ParseException {
242
251
*/
243
252
OptionGroup actions = new OptionGroup ();
244
253
actions .setRequired (true );
254
+ actions .addOption (Option .builder ("V" ).longOpt ("version" ).desc ("Print version info." ).build ());
245
255
actions .addOption (Option .builder ("h" ).longOpt ("help" ).desc ("Print help." ).build ());
246
256
actions .addOption (Option .builder ("ln" ).longOpt ("list-named" ).desc ("Print the list of supported named curves and keys." ).hasArg ().argName ("what" ).optionalArg (true ).build ());
247
257
actions .addOption (Option .builder ("e" ).longOpt ("export" ).desc ("Export the defaut curve parameters of the card(if any)." ).build ());
0 commit comments