Package com.sshtools.common.publickey
Class SshKeyUtils
java.lang.Object
com.sshtools.common.publickey.SshKeyUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcreatePrivateKeyFile(SshKeyPair pair, String passphrase, File file) static voidcreatePrivateKeyFile(SshKeyPair pair, String passphrase, File file, int format) static voidcreatePublicKeyFile(SshPublicKey publicKey, String comment, File file) static voidcreatePublicKeyFile(SshPublicKey publicKey, String comment, File file, int format) static Stringstatic SshCertificategetCertificate(File privateKey, String passphrase) static SshCertificategetCertificate(File privateKey, String passphrase, File certFile) static SshCertificategetCertificate(InputStream privateKey, String passphrase, InputStream certFile) static SshCertificategetCertificate(String privateKey, String passphrase, String certFile) static SshKeyPairgetCertificateAndKey(File privateKey, String passphrase) static Stringstatic StringgetFingerprint(File key) static Stringstatic StringgetFingerprint(String key) static StringgetFormattedKey(SshKeyPair pair, String passphrase) static StringgetFormattedKey(SshPublicKey key, String comment) static StringgetFormattedKey(SshPublicKey key, String comment, int format) static Stringstatic StringgetOpenSSHFormattedKey(SshPublicKey key, String comment) static SshKeyPairgetPrivateKey(File key) static SshKeyPairgetPrivateKey(File key, PassphrasePrompt prompt) static SshKeyPairgetPrivateKey(File key, String passphrase) static SshKeyPairgetPrivateKey(InputStream key, String passphrase) static SshKeyPairgetPrivateKey(String formattedKey, PassphrasePrompt prompt) static SshKeyPairgetPrivateKey(String formattedKey, String passphrase) static SshPublicKeygetPublicKey(File key) static SshPublicKeygetPublicKey(InputStream key) static SshPublicKeygetPublicKey(String formattedKey) static SshPublicKeygetPublicKey(Path path) static StringgetPublicKeyComment(String formattedKey) static SshKeyPairgetRSAPrivateKeyWithSHA256Signature(File key, String passphrase) static SshKeyPairgetRSAPrivateKeyWithSHA256Signature(InputStream key, String passphrase) static SshKeyPairgetRSAPrivateKeyWithSHA256Signature(String formattedKey, String passphrase) static SshKeyPairgetRSAPrivateKeyWithSHA512Signature(File key, String passphrase) static SshKeyPairgetRSAPrivateKeyWithSHA512Signature(InputStream key, String passphrase) static SshKeyPairgetRSAPrivateKeyWithSHA512Signature(String formattedKey, String passphrase) static booleanisPrivateKeyFile(File file) static SshKeyPairstatic SshKeyPairstatic voidsaveCertificate(SshCertificate pair, String passphrase, String comment, File privateKeyFile) static voidsavePrivateKey(SshKeyPair pair, String passphrase, String comment, File privateKeyFile)
-
Constructor Details
-
SshKeyUtils
public SshKeyUtils()
-
-
Method Details
-
getOpenSSHFormattedKey
- Throws:
IOException
-
getOpenSSHFormattedKey
- Throws:
IOException
-
getFormattedKey
public static String getFormattedKey(SshPublicKey key, String comment, int format) throws IOException - Throws:
IOException
-
getFormattedKey
- Throws:
IOException
-
getFormattedKey
- Throws:
IOException
-
getPublicKey
- Throws:
IOException
-
getPublicKey
- Throws:
IOException
-
getPublicKey
- Throws:
IOException
-
getPublicKey
- Throws:
IOException
-
getPublicKeyComment
- Throws:
IOException
-
getPrivateKey
public static SshKeyPair getPrivateKey(File key, String passphrase) throws IOException, InvalidPassphraseException -
getPrivateKey
-
getPrivateKey
public static SshKeyPair getPrivateKey(File key, PassphrasePrompt prompt) throws IOException, InvalidPassphraseException -
getPrivateKey
public static SshKeyPair getPrivateKey(InputStream key, String passphrase) throws IOException, InvalidPassphraseException -
getPrivateKey
public static SshKeyPair getPrivateKey(String formattedKey, String passphrase) throws IOException, InvalidPassphraseException -
getPrivateKey
public static SshKeyPair getPrivateKey(String formattedKey, PassphrasePrompt prompt) throws IOException, InvalidPassphraseException -
getCertificate
public static SshCertificate getCertificate(File privateKey, String passphrase) throws IOException, InvalidPassphraseException -
getCertificate
public static SshCertificate getCertificate(File privateKey, String passphrase, File certFile) throws IOException, InvalidPassphraseException -
getCertificate
public static SshCertificate getCertificate(InputStream privateKey, String passphrase, InputStream certFile) throws IOException, InvalidPassphraseException -
getCertificate
public static SshCertificate getCertificate(String privateKey, String passphrase, String certFile) throws IOException, InvalidPassphraseException -
makeRSAWithSHA256Signature
-
getRSAPrivateKeyWithSHA256Signature
public static SshKeyPair getRSAPrivateKeyWithSHA256Signature(String formattedKey, String passphrase) throws UnsupportedEncodingException, IOException, InvalidPassphraseException -
getRSAPrivateKeyWithSHA256Signature
public static SshKeyPair getRSAPrivateKeyWithSHA256Signature(InputStream key, String passphrase) throws IOException, InvalidPassphraseException -
getRSAPrivateKeyWithSHA256Signature
public static SshKeyPair getRSAPrivateKeyWithSHA256Signature(File key, String passphrase) throws IOException, InvalidPassphraseException -
makeRSAWithSHA512Signature
-
getRSAPrivateKeyWithSHA512Signature
public static SshKeyPair getRSAPrivateKeyWithSHA512Signature(String formattedKey, String passphrase) throws UnsupportedEncodingException, IOException, InvalidPassphraseException -
getRSAPrivateKeyWithSHA512Signature
public static SshKeyPair getRSAPrivateKeyWithSHA512Signature(InputStream key, String passphrase) throws IOException, InvalidPassphraseException -
getRSAPrivateKeyWithSHA512Signature
public static SshKeyPair getRSAPrivateKeyWithSHA512Signature(File key, String passphrase) throws IOException, InvalidPassphraseException -
getFingerprint
- Throws:
IOException
-
getFingerprint
- Throws:
IOException
-
getFingerprint
- Throws:
IOException
-
getFingerprint
-
getBubbleBabble
-
createPublicKeyFile
public static void createPublicKeyFile(SshPublicKey publicKey, String comment, File file) throws IOException - Throws:
IOException
-
createPublicKeyFile
public static void createPublicKeyFile(SshPublicKey publicKey, String comment, File file, int format) throws IOException - Throws:
IOException
-
createPrivateKeyFile
public static void createPrivateKeyFile(SshKeyPair pair, String passphrase, File file) throws IOException - Throws:
IOException
-
createPrivateKeyFile
public static void createPrivateKeyFile(SshKeyPair pair, String passphrase, File file, int format) throws IOException - Throws:
IOException
-
isPrivateKeyFile
-
getCertificateAndKey
public static SshKeyPair getCertificateAndKey(File privateKey, String passphrase) throws IOException, InvalidPassphraseException -
savePrivateKey
public static void savePrivateKey(SshKeyPair pair, String passphrase, String comment, File privateKeyFile) throws IOException - Throws:
IOException
-
saveCertificate
public static void saveCertificate(SshCertificate pair, String passphrase, String comment, File privateKeyFile) throws IOException - Throws:
IOException
-