public class SshPublicKeyFileFactory
extends java.lang.Object
OpenSSHssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAQQC8OZmB4d+SSMtVgsvdsCqRovgwcL/SYZunIBlR mCO6LhY/8PqefhygKfIZcxyGCKcrVAO4THGbqZ/ilv8NWXJT This is a commentSECSH standard format---- BEGIN SSH2 PUBLIC KEY ---- Comment: "This is a comment" AAAAB3NzaC1yc2EAAAADAQABAAAAgQC9mPcvyCnWpuvN7u4cjwUkBbTqgYm5kR92XNbo7/ElAJY+ 7HwoTtiUsQ6Q2Ma6hUg29LlDifpX5Ujwwm5PRK+7dXWL5bbznNGxJXY5P1E/5cr/+cJueaqZuA90 2x6oFweQZPK4en+nJyXFwYY/Pbf86F3EJFD3lh9RWSN7r2RbRw== ---- END SSH2 PUBLIC KEY ----SSH11024 65537 12203618663441486180278392644721081332612879088348276482061792 3981996764870633915934678786242627941442492506374351346273236223683187153 1433842142721049328324552410746419300820752745317401639942167156433029893 3759921689255688343334770869709776055449427739142029076904194522024626419 9127925140284440450097198129
| Modifier and Type | Field and Description |
|---|---|
static int |
OPENSSH_FORMAT |
static int |
OPENSSL_FORMAT
Deprecated.
Never correctly implemented.
|
static int |
SECSH_FORMAT |
| Constructor and Description |
|---|
SshPublicKeyFileFactory() |
| Modifier and Type | Method and Description |
|---|---|
static void |
convertFile(java.io.File keyFile,
int toFormat,
java.io.File toFile)
Take a file in any of the supported public key formats and convert to the
requested format.
|
static SshPublicKeyFile |
create(SshPublicKey key,
java.lang.String comment,
int format)
Create a file representation from an existing public key.
|
static SshPublicKeyFile |
create(SshPublicKey key,
java.lang.String options,
java.lang.String comment,
int format)
Create a file representation from an existing public key.
|
static void |
createFile(SshPublicKey key,
java.lang.String comment,
int format,
java.io.File toFile)
Take a SshPublicKey and write it to a
file
|
static SshPublicKey |
decodeSSH2PublicKey(byte[] encoded)
Decode an SSH2 encoded public key as specified in the SSH2 transport
protocol.
|
static SshPublicKey |
decodeSSH2PublicKey(java.lang.String algorithm,
byte[] encoded) |
static SshPublicKeyFile |
parse(byte[] formattedkey)
Parse a formatted public key and return a file representation.
|
static SshPublicKeyFile |
parse(java.io.InputStream in)
Parse a formatted key from an InputStream and return a file
representation.
|
public static final int OPENSSH_FORMAT
public static final int SECSH_FORMAT
@Deprecated public static final int OPENSSL_FORMAT
public static SshPublicKey decodeSSH2PublicKey(byte[] encoded) throws java.io.IOException
ssh-rsa is encoded as String "ssh-rsa" BigInteger e BigInteger n ssh-dsa is encoded as String "ssh-dsa" BigInteger p BigInteger q BigItneger g BigInteger y
encoded - java.io.IOExceptionpublic static SshPublicKey decodeSSH2PublicKey(java.lang.String algorithm, byte[] encoded) throws java.io.IOException
java.io.IOExceptionpublic static SshPublicKeyFile parse(byte[] formattedkey) throws java.io.IOException
formattedkey - java.io.IOExceptionpublic static SshPublicKeyFile parse(java.io.InputStream in) throws java.io.IOException
in - java.io.IOExceptionpublic static SshPublicKeyFile create(SshPublicKey key, java.lang.String comment, int format) throws java.io.IOException
key - the public keycomment - the comment to apply to the formatted keyformat - the format typejava.io.IOExceptionpublic static SshPublicKeyFile create(SshPublicKey key, java.lang.String options, java.lang.String comment, int format) throws java.io.IOException
key - the public keyoptions - options (if supported)comment - the comment to apply to the formatted keyformat - the format typejava.io.IOExceptionpublic static void createFile(SshPublicKey key, java.lang.String comment, int format, java.io.File toFile) throws java.io.IOException
key - comment - format - toFile - java.io.IOExceptionpublic static void convertFile(java.io.File keyFile,
int toFormat,
java.io.File toFile)
throws java.io.IOException
keyFile - toFormat - toFile - java.io.IOExceptionCopyright © 2022. All rights reserved.