Class PrivateKeyFile
Represents private key information.
public class PrivateKeyFile : IPrivateKeySource, IDisposable
- Inheritance
-
PrivateKeyFile
- Implements
- Inherited Members
Remarks
The following private keys are supported:
- RSA in OpenSSL PEM, ssh.com and OpenSSH key format
- DSA in OpenSSL PEM and ssh.com format
- ECDSA 256/384/521 in OpenSSL PEM and OpenSSH key format
- ED25519 in OpenSSH key format
The following encryption algorithms are supported:
- DES-EDE3-CBC
- DES-EDE3-CFB
- DES-CBC
- AES-128-CBC
- AES-192-CBC
- AES-256-CBC
Constructors
PrivateKeyFile(Key)
Initializes a new instance of the PrivateKeyFile class.
public PrivateKeyFile(Key key)
Parameters
key
KeyThe key.
PrivateKeyFile(Stream)
Initializes a new instance of the PrivateKeyFile class.
public PrivateKeyFile(Stream privateKey)
Parameters
privateKey
StreamThe private key.
PrivateKeyFile(Stream, string)
Initializes a new instance of the PrivateKeyFile class.
public PrivateKeyFile(Stream privateKey, string passPhrase)
Parameters
Exceptions
- ArgumentNullException
privateKey
orpassPhrase
is null.
PrivateKeyFile(string)
Initializes a new instance of the PrivateKeyFile class.
public PrivateKeyFile(string fileName)
Parameters
fileName
stringName of the file.
Remarks
This method calls Open(string, FileMode) internally, this method does not catch exceptions from Open(string, FileMode).
Exceptions
- ArgumentNullException
fileName
is null or empty.
PrivateKeyFile(string, string)
Initializes a new instance of the PrivateKeyFile class.
public PrivateKeyFile(string fileName, string passPhrase)
Parameters
Remarks
This method calls Open(string, FileMode) internally, this method does not catch exceptions from Open(string, FileMode).
Exceptions
Properties
HostKeyAlgorithms
Gets the supported host algorithms for this key file.
public IReadOnlyCollection<HostAlgorithm> HostKeyAlgorithms { get; }
Property Value
Key
Gets the key.
public Key Key { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected virtual void Dispose(bool disposing)
Parameters
disposing
booltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
~PrivateKeyFile()
Finalizes an instance of the PrivateKeyFile class.
protected ~PrivateKeyFile()