File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -228,7 +228,12 @@ public String downloadPvtKey() {
228228 public String generateUserKey (String username , String keyname ) {
229229
230230 //set key type
231- int type = SSHUtil .KEY_TYPE .equals ("rsa" ) ? KeyPair .RSA : KeyPair .DSA ;
231+ int type = KeyPair .RSA ;
232+ if (SSHUtil .KEY_TYPE .equals ("dsa" )) {
233+ type = KeyPair .DSA ;
234+ } else if (SSHUtil .KEY_TYPE .equals ("ecdsa" )) {
235+ type = KeyPair .ECDSA ;
236+ }
232237
233238 JSch jsch = new JSch ();
234239
Original file line number Diff line number Diff line change @@ -167,7 +167,12 @@ public static String keyGen(String passphrase) {
167167 if (StringUtils .isEmpty (AppConfig .getProperty ("privateKey" )) || StringUtils .isEmpty (AppConfig .getProperty ("publicKey" ))) {
168168
169169 //set key type
170- int type = KEY_TYPE .equals ("rsa" ) ? KeyPair .RSA : KeyPair .DSA ;
170+ int type = KeyPair .RSA ;
171+ if (SSHUtil .KEY_TYPE .equals ("dsa" )) {
172+ type = KeyPair .DSA ;
173+ } else if (SSHUtil .KEY_TYPE .equals ("ecdsa" )) {
174+ type = KeyPair .ECDSA ;
175+ }
171176 String comment = "keybox@global_key" ;
172177
173178 JSch jsch = new JSch ();
@@ -623,6 +628,8 @@ public static String getKeyType(String publicKey){
623628 keyType ="DSA" ;
624629 } else if (KeyPair .RSA == type ){
625630 keyType ="RSA" ;
631+ } else if (KeyPair .ECDSA == type ){
632+ keyType ="ECDSA" ;
626633 } else if (KeyPair .UNKNOWN ==type ){
627634 keyType ="UNKNOWN" ;
628635 } else if (KeyPair .ERROR == type ){
Original file line number Diff line number Diff line change 44#
55# set to true to regenerate and import SSH keys
66resetApplicationSSHKey =false
7- # SSH Key Type 'dsa' or 'rsa ' for generated keys
7+ # SSH key type 'dsa', 'rsa', or 'ecdsa ' for generated keys
88sshKeyType =rsa
9- # SSH Key Length for generated keys
9+ # SSH key length for generated keys. 2048 => 'rsa','dsa'; 521 => 'ecdsa'
1010sshKeyLength =2048
1111# private ssh key, leave blank to generate key pair
1212privateKey =
You can’t perform that action at this time.
0 commit comments