SshPrivateKey Class
Namespace: Rebex.Net
Assembly: Rebex.Networking.dll (version 7.0.9313)
Represents SSH private key (RSA, DSA, EcDSA, EdDSA, certificate-based). Private key data also includes the public key.
Syntax
public class SshPrivateKey : SshPublicKey
Inherited Members
Constructors
| Name | Description |
|---|---|
| SshPrivateKey(Certificate) | Creates a certificate-based SSH key for use with SSH/SFTP servers that support X.509 certificate authentication. |
| SshPrivateKey(CertificateChain) | Creates a certificate-based SSH key for use with SSH/SFTP client that support X.509 certificate authentication. |
| SshPrivateKey(AsymmetricKeyAlgorithm) | Creates an SSH private key based on the specified AsymmetricKeyAlgorithm object. |
| SshPrivateKey(Byte[], String) | Loads a private key in PKCS #8, PuTTY, OpenSSH or SSLeay-format from the specified raw data. |
| SshPrivateKey(Stream, String) | Loads a private key in PKCS #8, PuTTY, OpenSSH or SSLeay-format from the specified stream. |
| SshPrivateKey(AsymmetricAlgorithm) | Creates an SSH private key based on the specified AsymmetricAlgorithm object, such as RSA (all platforms), DSA (all platforms) or ECDsa (.NET 5 or higher). |
| SshPrivateKey(String, String) | Loads a private key in PKCS #8, PuTTY, OpenSSH or SSLeay-format from the specified path. |
Properties
| Name | Description |
|---|---|
| Certificate | Gets a certificate of a certificate-based SSH key. |
| Comment | Gets or sets the key comment. The comment is used while saving in some formats. Inherited from SshPublicKey. |
| Fingerprint | Gets the public key fingerprint. Inherited from SshPublicKey. |
| KeyAlgorithm | Gets the key algorithm. Inherited from SshPublicKey. |
| KeyAlgorithmId | Gets the key algorithm ID Inherited from SshPublicKey. |
| KeySize | Gets the key size, in bits. Inherited from SshPublicKey. |
Methods
| Name | Description |
|---|---|
| CreateFrom(PrivateKeyInfo) | Creates an SSH private key from the specified private key info object. |
| CreateFrom(DSAParameters) | Creates an SSH private key from the specified DSA parameters. |
| CreateFrom(RSAParameters) | Creates an SSH private key from the specified RSA parameters. |
| Equals(SshPublicKey) | Determines whether the specified key is the same key as the specified key. Inherited from SshPublicKey. |
| Equals(Object) | Determines whether the specified object is the same key as the specified key. Inherited from SshPublicKey. |
| Generate() | Generates an SSH private key using the RSA algorithm with a key size of 1024. |
| Generate(SshHostKeyAlgorithm) | Generates an SSH private key using the specified algorithm and a default key size. |
| Generate(SshHostKeyAlgorithm, Int32) | Generates an SSH private key using the specified algorithm and key size. |
| GetCertificate() | Returns the underlying X509 certificate. Inherited from SshPublicKey. |
| GetCertificateChain() | Returns the underlying X509 certificate and its chain (for certificate-based keys). Inherited from SshPublicKey. |
| GetDSAParameters() | Gets the DSA parameters for a DSA key. May only be used for DSA private keys. |
| GetHashCode() | A hash function for this type. Inherited from SshPublicKey. |
| GetPrivateKey() | Gets the raw form of the private key. |
| GetPrivateKeyInfo() | Returns the private key info for this key. |
| GetPublicKey() | Gets the public key in SSH format (or raw X.509 data of the leaf certificate). Inherited from SshPublicKey. |
| GetPublicKeyInfo() | Returns the public key info for this key. Inherited from SshPublicKey. |
| GetRSAParameters() | Gets the RSA parameters for a RSA key. May only be used for RSA private keys. |
| LoadPublicKeys(Stream) | Loads public keys in ~/.ssh/authorized_keys file format. Inherited from SshPublicKey. |
| LoadPublicKeys(String) | Loads public keys in ~/.ssh/authorized_keys file format. Inherited from SshPublicKey. |
| Parse(String) | Parses a single SSH public key in ~/.ssh/authorized_keys format. Inherited from SshPublicKey. |
| Save(Stream, String, SshPrivateKeyFormat) | Saves the private key into the supplied stream in the specified format. |
| Save(String, String, SshPrivateKeyFormat) | Saves the private key into the supplied stream in the specified format. |
| SavePublicKey(Stream) | Saves the public key into the supplied stream in Base64-encoded SSH2 public key format. Inherited from SshPublicKey. |
| SavePublicKey(Stream, SshPublicKeyFormat) | Saves the public key into the supplied stream in the specified format. Inherited from SshPublicKey. |
| SavePublicKey(String) | Saves the public key into the supplied stream in Base64-encoded SSH2 public key format. Inherited from SshPublicKey. |
| SavePublicKey(String, SshPublicKeyFormat) | Saves the public key into the supplied stream in the specified format. Inherited from SshPublicKey. |