Class OpenSSHKeyFile
- java.lang.Object
-
- net.schmizz.sshj.userauth.keyprovider.BaseFileKeyProvider
-
- net.schmizz.sshj.userauth.keyprovider.PKCS8KeyFile
-
- net.schmizz.sshj.userauth.keyprovider.OpenSSHKeyFile
-
- All Implemented Interfaces:
FileKeyProvider
,KeyProvider
public class OpenSSHKeyFile extends PKCS8KeyFile
Represents an OpenSSH identity that consists of a PKCS8-encoded private key file and an unencrypted public key file of the same name with the".pub"
extension. This allows to delay requesting of the passphrase until the private key is requested.- See Also:
PKCS8KeyFile
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OpenSSHKeyFile.Factory
-
Field Summary
Fields Modifier and Type Field Description private java.security.PublicKey
pubKey
-
Fields inherited from class net.schmizz.sshj.userauth.keyprovider.PKCS8KeyFile
log
-
Fields inherited from class net.schmizz.sshj.userauth.keyprovider.BaseFileKeyProvider
kp, pwdf, resource, type
-
-
Constructor Summary
Constructors Constructor Description OpenSSHKeyFile()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.security.PublicKey
getPublic()
void
init(java.io.File location, PasswordFinder pwdf)
void
init(java.io.Reader privateKey, java.io.Reader publicKey, PasswordFinder pwdf)
void
init(java.lang.String privateKey, java.lang.String publicKey, PasswordFinder pwdf)
private void
initPubKey(java.io.Reader publicKey)
Read and store the separate public key provided alongside the private key-
Methods inherited from class net.schmizz.sshj.userauth.keyprovider.PKCS8KeyFile
readKeyPair, toString
-
Methods inherited from class net.schmizz.sshj.userauth.keyprovider.BaseFileKeyProvider
getPrivate, getType, init, init, init, init, init
-
-
-
-
Method Detail
-
getPublic
public java.security.PublicKey getPublic() throws java.io.IOException
- Specified by:
getPublic
in interfaceKeyProvider
- Overrides:
getPublic
in classBaseFileKeyProvider
- Returns:
- the public key.
- Throws:
java.io.IOException
- if there is an I/O error retrieving the public key
-
init
public void init(java.io.File location, PasswordFinder pwdf)
- Specified by:
init
in interfaceFileKeyProvider
- Overrides:
init
in classBaseFileKeyProvider
-
init
public void init(java.lang.String privateKey, java.lang.String publicKey, PasswordFinder pwdf)
- Specified by:
init
in interfaceFileKeyProvider
- Overrides:
init
in classBaseFileKeyProvider
-
init
public void init(java.io.Reader privateKey, java.io.Reader publicKey, PasswordFinder pwdf)
- Specified by:
init
in interfaceFileKeyProvider
- Overrides:
init
in classBaseFileKeyProvider
-
initPubKey
private void initPubKey(java.io.Reader publicKey) throws java.io.IOException
Read and store the separate public key provided alongside the private key- Parameters:
publicKey
- Public key accessible through aReader
- Throws:
java.io.IOException
-
-