Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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`

Field Summary
`static java.lang.String` | `BEGIN_PUB_KEY`
`static java.lang.String` | `END_PUB_KEY`
`static java.lang.String` | `FILE_COMMENT`
`static java.lang.String` | `FILE_SUBJECT`

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.

Method Summary
`java.lang.String` | `getAlgorithmName()`
`java.lang.String` | `getComment()`
`PublicKey` | `getPublicKey()`
`byte[]` | `getRaw()`
`java.lang.String` | `getSubject()`
`boolean` | `isPuttyFormat()`
`boolean` | `isSSHComFormat()`
`void` | `load(java.io.InputStream in)`
`void` | `load(java.io.InputStream in, java.lang.String password)`
`void` | `load(java.lang.String fileName)`
`void` | `load(java.lang.String fileName, java.lang.String password)`
`boolean` | `sameAs(PublicKey other)`
`void` | `setComment(java.lang.String comment)`
`void` | `setSubject(java.lang.String subject)`
`java.lang.String` | `store(boolean sshComFormat)`
`java.lang.String` | `store(java.lang.String fileName)`
`java.lang.String` | `store(java.lang.String fileName, boolean sshComFormat)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### 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

Constructor Detail

### 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 store
  `subject` - the subject name of the key owner
  `comment` - a comment to accompany the key

### SSH2PublicKeyFile

    public SSH2PublicKeyFile()

  This is the constructor used for loading a public key.

Method Detail

### getAlgorithmName

    public java.lang.String getAlgorithmName()

### isSSHComFormat

    public boolean isSSHComFormat()

### isPuttyFormat

    public boolean isPuttyFormat()

### load

    public void load(java.lang.String fileName)
              throws java.io.IOException,
                     SSH2Exception

  Throws:
    `java.io.IOException`
    `SSH2Exception`

### load

    public void load(java.lang.String fileName,
                     java.lang.String password)
              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`

### load

    public void load(java.io.InputStream in,
                     java.lang.String password)
              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)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD