com.mindbright.ssh2
Class SSH2PublicKeyFile
java.lang.Object
com.mindbright.ssh2.SSH2PublicKeyFile
- public class SSH2PublicKeyFile
- extends java.lang.Object
This class implements the file formats commonly used for storing public keys
for public key authentication. It can handle both OpenSSH's proprietary file
format aswell as the (draft) standard format. When importing/exporting use
the appropriate constructor and the load/store methods. Note that this class
can also be used to convert key pair files between the formats.
- See Also:
SSH2KeyPairFile
Constructor Summary |
SSH2PublicKeyFile()
This is the constructor used for loading a public key. |
SSH2PublicKeyFile(PublicKey publicKey,
java.lang.String subject,
java.lang.String comment)
This is the constructor used for storing a public key. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BEGIN_PUB_KEY
public static final java.lang.String BEGIN_PUB_KEY
- See Also:
- Constant Field Values
END_PUB_KEY
public static final java.lang.String END_PUB_KEY
- See Also:
- Constant Field Values
FILE_SUBJECT
public static final java.lang.String FILE_SUBJECT
- See Also:
- Constant Field Values
FILE_COMMENT
public static final java.lang.String FILE_COMMENT
- See Also:
- Constant Field Values
SSH2PublicKeyFile
public SSH2PublicKeyFile(PublicKey publicKey,
java.lang.String subject,
java.lang.String comment)
- This is the constructor used for storing a public key.
- Parameters:
publicKey
- the public key to storesubject
- the subject name of the key ownercomment
- a comment to accompany the key
SSH2PublicKeyFile
public SSH2PublicKeyFile()
- This is the constructor used for loading a public key.
getAlgorithmName
public java.lang.String getAlgorithmName()
isSSHComFormat
public boolean isSSHComFormat()
load
public void load(java.lang.String fileName)
throws java.io.IOException,
SSH2Exception
- Throws:
java.io.IOException
SSH2Exception
load
public void load(java.io.InputStream in)
throws java.io.IOException,
SSH2Exception
- Throws:
java.io.IOException
SSH2Exception
store
public java.lang.String store(java.lang.String fileName)
throws java.io.IOException,
SSH2Exception
- Throws:
java.io.IOException
SSH2Exception
store
public java.lang.String store(java.lang.String fileName,
boolean sshComFormat)
throws java.io.IOException,
SSH2Exception
- Throws:
java.io.IOException
SSH2Exception
store
public java.lang.String store(boolean sshComFormat)
throws SSH2Exception
- Throws:
SSH2Exception
getPublicKey
public PublicKey getPublicKey()
getRaw
public byte[] getRaw()
throws SSH2Exception
- Throws:
SSH2Exception
getSubject
public java.lang.String getSubject()
setSubject
public void setSubject(java.lang.String subject)
getComment
public java.lang.String getComment()
setComment
public void setComment(java.lang.String comment)
sameAs
public boolean sameAs(PublicKey other)