public class OpenSSHPrivateKeyFile extends java.lang.Object implements SshPrivateKeyFile
| Constructor and Description |
|---|
OpenSSHPrivateKeyFile() |
OpenSSHPrivateKeyFile(byte[] formattedkey) |
| Modifier and Type | Method and Description |
|---|---|
void |
changePassphrase(java.lang.String oldpassphrase,
java.lang.String newpassphrase)
Change the passphrase of the key file.
|
byte[] |
encryptKey(SshKeyPair pair,
java.lang.String passphrase) |
java.lang.String |
getComment()
The private key comment (if any).
|
byte[] |
getFormattedKey()
Get the formatted key
|
java.lang.String |
getType()
Get a description of the format type e.g.
|
static boolean |
isFormatted(byte[] formattedkey) |
boolean |
isPassphraseProtected()
Determine if the private key file is protected by a passphrase.
|
java.lang.String |
oidByteArrayToString(byte[] o) |
boolean |
supportsPassphraseChange()
Method to determine whether the format supports changing of passphrases.
|
SshKeyPair |
toKeyPair(java.lang.String passphrase)
Decode the private key using the users passphrase.
|
public OpenSSHPrivateKeyFile(byte[] formattedkey)
throws java.io.IOException
java.io.IOExceptionpublic OpenSSHPrivateKeyFile()
public java.lang.String getComment()
SshPrivateKeyFilegetComment in interface SshPrivateKeyFilepublic boolean isPassphraseProtected()
SshPrivateKeyFileisPassphraseProtected in interface SshPrivateKeyFilepublic java.lang.String getType()
SshPrivateKeyFilegetType in interface SshPrivateKeyFilepublic boolean supportsPassphraseChange()
SshPrivateKeyFilesupportsPassphraseChange in interface SshPrivateKeyFilepublic SshKeyPair toKeyPair(java.lang.String passphrase) throws java.io.IOException, InvalidPassphraseException
SshPrivateKeyFiletoKeyPair in interface SshPrivateKeyFilepassphrase - the users passphrasejava.io.IOExceptionInvalidPassphraseExceptionpublic java.lang.String oidByteArrayToString(byte[] o)
public byte[] encryptKey(SshKeyPair pair, java.lang.String passphrase) throws java.io.IOException
java.io.IOExceptionpublic void changePassphrase(java.lang.String oldpassphrase,
java.lang.String newpassphrase)
throws java.io.IOException,
InvalidPassphraseException
SshPrivateKeyFilechangePassphrase in interface SshPrivateKeyFileoldpassphrase - the old passphrasenewpassphrase - the new passphrasejava.io.IOExceptionInvalidPassphraseExceptionpublic byte[] getFormattedKey()
SshPrivateKeyFilegetFormattedKey in interface SshPrivateKeyFilepublic static boolean isFormatted(byte[] formattedkey)
Copyright © 2022. All rights reserved.