Last active
January 19, 2017 17:49
-
-
Save bcfurtado/328d570804de56e962384ae3445ea947 to your computer and use it in GitHub Desktop.
Creating SSH Keys with Java and Jsch v0.1.54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bcfurtado; | |
import com.jcraft.jsch.JSch; | |
import com.jcraft.jsch.JSchException; | |
import com.jcraft.jsch.KeyPair; | |
import java.io.IOException; | |
public class App { | |
public static void main( String[] args ) throws JSchException, IOException { | |
System.out.println( "Hello World!" ); | |
int type = KeyPair.RSA; | |
JSch jsch = new JSch(); | |
KeyPair kpair = KeyPair.genKeyPair(jsch, type); | |
kpair.setPassphrase(""); | |
String filename = "passpie_id_rsa"; | |
kpair.writePrivateKey(filename); | |
kpair.writePublicKey(filename + ".pub", ""); | |
System.out.println("Finger print: " + kpair.getFingerPrint()); | |
kpair.dispose(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on: https://gist.github.com/ymnk/2318108#file-keygen-java