com.sshtools.publickey
Class SshPrivateKeyFileFactory

java.lang.Object
  extended bycom.sshtools.publickey.SshPrivateKeyFileFactory

public class SshPrivateKeyFileFactory
extends java.lang.Object

Private key format factory used to decode private key files. This factory currently supports SSHTools, OpenSSH and SSH1 encrypted private keys.

Author:
Lee David Painter

Field Summary
static int OPENSSH_FORMAT
           
static int SSH1_FORMAT
           
static int SSHTOOLS_FORMAT
           
 
Constructor Summary
SshPrivateKeyFileFactory()
           
 
Method Summary
static void convertFile(java.io.File keyFile, java.lang.String passphrase, java.lang.String comment, int toFormat, java.io.File toFile)
          Take a file in any of the supported public key formats and convert to the requested format.
static SshPrivateKeyFile create(SshKeyPair pair, java.lang.String passphrase, java.lang.String comment, int format)
           
static void createFile(SshKeyPair key, java.lang.String passphrase, java.lang.String comment, int format, java.io.File toFile)
          Take a SshPrivateKey and write it to a file.
static SshPrivateKeyFile parse(byte[] formattedkey)
          Parse formatted data and return a suitable SshPrivateKeyFile implementation.
static SshPrivateKeyFile parse(java.io.InputStream in)
          Parse an InputStream and return a suitable SshPrivateKeyFile implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPENSSH_FORMAT

public static final int OPENSSH_FORMAT
See Also:
Constant Field Values

SSHTOOLS_FORMAT

public static final int SSHTOOLS_FORMAT
See Also:
Constant Field Values

SSH1_FORMAT

public static final int SSH1_FORMAT
See Also:
Constant Field Values
Constructor Detail

SshPrivateKeyFileFactory

public SshPrivateKeyFileFactory()
Method Detail

parse

public static SshPrivateKeyFile parse(byte[] formattedkey)
                               throws java.io.IOException
Parse formatted data and return a suitable SshPrivateKeyFile implementation.

Parameters:
formattedkey -
Returns:
SshPrivateKeyFile
Throws:
java.io.IOException

parse

public static SshPrivateKeyFile parse(java.io.InputStream in)
                               throws java.io.IOException
Parse an InputStream and return a suitable SshPrivateKeyFile implementation.

Parameters:
in -
Returns:
SshPrivateKeyFile
Throws:
java.io.IOException

create

public static SshPrivateKeyFile create(SshKeyPair pair,
                                       java.lang.String passphrase,
                                       java.lang.String comment,
                                       int format)
                                throws java.io.IOException
Throws:
java.io.IOException

createFile

public static void createFile(SshKeyPair key,
                              java.lang.String passphrase,
                              java.lang.String comment,
                              int format,
                              java.io.File toFile)
                       throws java.io.IOException
Take a SshPrivateKey and write it to a file.

Parameters:
key -
comment -
format -
toFile -
Throws:
java.io.IOException

convertFile

public static void convertFile(java.io.File keyFile,
                               java.lang.String passphrase,
                               java.lang.String comment,
                               int toFormat,
                               java.io.File toFile)
                        throws java.io.IOException,
                               InvalidPassphraseException
Take a file in any of the supported public key formats and convert to the requested format.

Parameters:
keyFile -
toFormat -
toFile -
Throws:
java.io.IOException
InvalidPassphraseException


Copyright © 2003-2008 SSHTools LTD. All Rights Reserved.