net.schmizz.sshj.userauth.keyprovider
Class PKCS8KeyFile
java.lang.Object
net.schmizz.sshj.userauth.keyprovider.PKCS8KeyFile
- All Implemented Interfaces:
- FileKeyProvider, KeyProvider
- Direct Known Subclasses:
- OpenSSHKeyFile
public class PKCS8KeyFile
- extends Object
- implements FileKeyProvider
Represents a PKCS8-encoded key file. This is the format used by OpenSSH and OpenSSL.
log
protected final org.slf4j.Logger log
pwdf
protected PasswordFinder pwdf
resource
protected Resource<?> resource
kp
protected KeyPair kp
type
protected KeyType type
passphrase
protected char[] passphrase
PKCS8KeyFile
public PKCS8KeyFile()
getPrivate
public PrivateKey getPrivate()
throws IOException
- Specified by:
getPrivate
in interface KeyProvider
- Returns:
- the private key.
- Throws:
IOException
- if there is an I/O error retrieving the private key
getPublic
public PublicKey getPublic()
throws IOException
- Specified by:
getPublic
in interface KeyProvider
- Returns:
- the public key.
- Throws:
IOException
- if there is an I/O error retrieving the public key
getType
public KeyType getType()
throws IOException
- Specified by:
getType
in interface KeyProvider
- Returns:
- the
KeyType
.
- Throws:
IOException
- if there is an I/O error retrieving the key type
init
public void init(File location)
- Specified by:
init
in interface FileKeyProvider
init
public void init(File location,
PasswordFinder pwdf)
- Specified by:
init
in interface FileKeyProvider
init
public void init(String privateKey,
String publicKey)
- Specified by:
init
in interface FileKeyProvider
init
public void init(String privateKey,
String publicKey,
PasswordFinder pwdf)
- Specified by:
init
in interface FileKeyProvider
makeBouncyPasswordFinder
protected org.bouncycastle.openssl.PasswordFinder makeBouncyPasswordFinder()
readKeyPair
protected KeyPair readKeyPair()
throws IOException
- Throws:
IOException
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2009-2012. All Rights Reserved.