# < Summary

Information

Class: | Renci.SshNet.PrivateKeyConnectionInfo
Assembly: | Renci.SshNet
File(s): | \home\appveyor\projects\ssh-net\src\Renci.SshNet\PrivateKeyConnectionInfo.cs

Line coverage
28%

Covered lines: | 15
Uncovered lines: | 37
Coverable lines: | 52
Total lines: | 189
Line coverage: | 28.8%

Branch coverage
20%

Covered branches: | 2
Total branches: | 10
Branch coverage: | 20%

Method coverage

Feature is only available for sponsors

Upgrade to PRO version

# Metrics

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
get_KeyFiles() | 100% | 1 | 100%
.ctor(...) | 100% | 1 | 0%
.ctor(...) | 100% | 1 | 100%
.ctor(...) | 100% | 1 | 0%
.ctor(...) | 100% | 1 | 0%
.ctor(...) | 100% | 1 | 0%
.ctor(...) | 100% | 1 | 0%
.ctor(...) | 100% | 1 | 0%
.ctor(...) | 100% | 1 | 100%
Dispose() | 100% | 1 | 0%
Dispose(...) | 20% | 10 | 21.05%
Finalize() | 100% | 1 | 100%

# File(s)

## \home\appveyor\projects\ssh-net\src\Renci.SshNet\PrivateKeyConnectionInfo.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | `using System.Collections.Generic;`
|  | `3` |  | `using System.Collections.ObjectModel;`
|  | `4` |  | ``
|  | `5` |  | `namespace Renci.SshNet`
|  | `6` |  | `{`
|  | `7` |  | `/// <summary>`
|  | `8` |  | `/// Provides connection information when private key authentication method is used.`
|  | `9` |  | `/// </summary>`
|  | `10` |  | `/// <example>`
|  | `11` |  | `/// <code source="..\..\src\Renci.SshNet.Tests\Classes\PrivateKeyConnectionInfoTest.cs" region="Example PrivateKey`
|  | `12` |  | `/// </example>`
|  | `13` |  | `public class PrivateKeyConnectionInfo : ConnectionInfo, IDisposable`
|  | `14` |  | `{`
|  | `15` |  | `private bool _isDisposed;`
|  | `16` |  | ``
|  | `17` |  | `/// <summary>`
|  | `18` |  | `/// Gets the key files used for authentication.`
|  | `19` |  | `/// </summary>`
| 6 | `20` |  | `public ICollection<IPrivateKeySource> KeyFiles { get; private set; }`
|  | `21` |  | ``
|  | `22` |  | `/// <summary>`
|  | `23` |  | `/// Initializes a new instance of the <see cref="PrivateKeyConnectionInfo"/> class.`
|  | `24` |  | `/// </summary>`
|  | `25` |  | `/// <param name="host">Connection host.</param>`
|  | `26` |  | `/// <param name="username">Connection username.</param>`
|  | `27` |  | `/// <param name="keyFiles">Connection key files.</param>`
|  | `28` |  | `/// <example>`
|  | `29` |  | `/// <code source="..\..\src\Renci.SshNet.Tests\Classes\PrivateKeyConnectionInfoTest.cs" region="Example Priv`
|  | `30` |  | `/// <code source="..\..\src\Renci.SshNet.Tests\Classes\PrivateKeyConnectionInfoTest.cs" region="Example Priv`
|  | `31` |  | `/// </example>`
|  | `32` |  | `public PrivateKeyConnectionInfo(string host, string username, params PrivateKeyFile[] keyFiles)`
| 0 | `33` |  | `: this(host, DefaultPort, username, ProxyTypes.None, string.Empty, 0, string.Empty, string.Empty, keyFiles)`
| 0 | `34` |  | `{`
| 0 | `35` |  | `}`
|  | `36` |  | ``
|  | `37` |  | `/// <summary>`
|  | `38` |  | `/// Initializes a new instance of the <see cref="PrivateKeyConnectionInfo"/> class.`
|  | `39` |  | `/// </summary>`
|  | `40` |  | `/// <param name="host">Connection host.</param>`
|  | `41` |  | `/// <param name="port">Connection port.</param>`
|  | `42` |  | `/// <param name="username">Connection username.</param>`
|  | `43` |  | `/// <param name="keyFiles">Connection key files.</param>`
|  | `44` |  | `public PrivateKeyConnectionInfo(string host, int port, string username, params IPrivateKeySource[] keyFiles)`
| 6 | `45` |  | `: this(host, port, username, ProxyTypes.None, string.Empty, 0, string.Empty, string.Empty, keyFiles)`
| 6 | `46` |  | `{`
| 6 | `47` |  | `}`
|  | `48` |  | ``
|  | `49` |  | `/// <summary>`
|  | `50` |  | `/// Initializes a new instance of the <see cref="PrivateKeyConnectionInfo"/> class.`
|  | `51` |  | `/// </summary>`
|  | `52` |  | `/// <param name="host">Connection host.</param>`
|  | `53` |  | `/// <param name="port">The port.</param>`
|  | `54` |  | `/// <param name="username">Connection username.</param>`
|  | `55` |  | `/// <param name="proxyType">Type of the proxy.</param>`
|  | `56` |  | `/// <param name="proxyHost">The proxy host.</param>`
|  | `57` |  | `/// <param name="proxyPort">The proxy port.</param>`
|  | `58` |  | `/// <param name="keyFiles">The key files.</param>`
|  | `59` |  | `public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost,`
| 0 | `60` |  | `: this(host, port, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty, keyFiles)`
| 0 | `61` |  | `{`
| 0 | `62` |  | `}`
|  | `63` |  | ``
|  | `64` |  | `/// <summary>`
|  | `65` |  | `/// Initializes a new instance of the <see cref="PrivateKeyConnectionInfo"/> class.`
|  | `66` |  | `/// </summary>`
|  | `67` |  | `/// <param name="host">Connection host.</param>`
|  | `68` |  | `/// <param name="port">The port.</param>`
|  | `69` |  | `/// <param name="username">Connection username.</param>`
|  | `70` |  | `/// <param name="proxyType">Type of the proxy.</param>`
|  | `71` |  | `/// <param name="proxyHost">The proxy host.</param>`
|  | `72` |  | `/// <param name="proxyPort">The proxy port.</param>`
|  | `73` |  | `/// <param name="proxyUsername">The proxy username.</param>`
|  | `74` |  | `/// <param name="keyFiles">The key files.</param>`
|  | `75` |  | `public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost,`
| 0 | `76` |  | `: this(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty, keyFiles)`
| 0 | `77` |  | `{`
| 0 | `78` |  | `}`
|  | `79` |  | ``
|  | `80` |  | `/// <summary>`
|  | `81` |  | `/// Initializes a new instance of the <see cref="PrivateKeyConnectionInfo"/> class.`
|  | `82` |  | `/// </summary>`
|  | `83` |  | `/// <param name="host">Connection host.</param>`
|  | `84` |  | `/// <param name="username">Connection username.</param>`
|  | `85` |  | `/// <param name="proxyType">Type of the proxy.</param>`
|  | `86` |  | `/// <param name="proxyHost">The proxy host.</param>`
|  | `87` |  | `/// <param name="proxyPort">The proxy port.</param>`
|  | `88` |  | `/// <param name="keyFiles">The key files.</param>`
|  | `89` |  | `public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyP`
| 0 | `90` |  | `: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty, keyFiles)`
| 0 | `91` |  | `{`
| 0 | `92` |  | `}`
|  | `93` |  | ``
|  | `94` |  | `/// <summary>`
|  | `95` |  | `/// Initializes a new instance of the <see cref="PrivateKeyConnectionInfo"/> class.`
|  | `96` |  | `/// </summary>`
|  | `97` |  | `/// <param name="host">Connection host.</param>`
|  | `98` |  | `/// <param name="username">Connection username.</param>`
|  | `99` |  | `/// <param name="proxyType">Type of the proxy.</param>`
|  | `100` |  | `/// <param name="proxyHost">The proxy host.</param>`
|  | `101` |  | `/// <param name="proxyPort">The proxy port.</param>`
|  | `102` |  | `/// <param name="proxyUsername">The proxy username.</param>`
|  | `103` |  | `/// <param name="keyFiles">The key files.</param>`
|  | `104` |  | `public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyP`
| 0 | `105` |  | `: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty, keyFiles)`
| 0 | `106` |  | `{`
| 0 | `107` |  | `}`
|  | `108` |  | ``
|  | `109` |  | `/// <summary>`
|  | `110` |  | `/// Initializes a new instance of the <see cref="PrivateKeyConnectionInfo"/> class.`
|  | `111` |  | `/// </summary>`
|  | `112` |  | `/// <param name="host">Connection host.</param>`
|  | `113` |  | `/// <param name="username">Connection username.</param>`
|  | `114` |  | `/// <param name="proxyType">Type of the proxy.</param>`
|  | `115` |  | `/// <param name="proxyHost">The proxy host.</param>`
|  | `116` |  | `/// <param name="proxyPort">The proxy port.</param>`
|  | `117` |  | `/// <param name="proxyUsername">The proxy username.</param>`
|  | `118` |  | `/// <param name="proxyPassword">The proxy password.</param>`
|  | `119` |  | `/// <param name="keyFiles">The key files.</param>`
|  | `120` |  | `public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyP`
| 0 | `121` |  | `: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, keyFiles)`
| 0 | `122` |  | `{`
| 0 | `123` |  | `}`
|  | `124` |  | ``
|  | `125` |  | `/// <summary>`
|  | `126` |  | `/// Initializes a new instance of the <see cref="PrivateKeyConnectionInfo"/> class.`
|  | `127` |  | `/// </summary>`
|  | `128` |  | `/// <param name="host">Connection host.</param>`
|  | `129` |  | `/// <param name="port">The port.</param>`
|  | `130` |  | `/// <param name="username">Connection username.</param>`
|  | `131` |  | `/// <param name="proxyType">Type of the proxy.</param>`
|  | `132` |  | `/// <param name="proxyHost">The proxy host.</param>`
|  | `133` |  | `/// <param name="proxyPort">The proxy port.</param>`
|  | `134` |  | `/// <param name="proxyUsername">The proxy username.</param>`
|  | `135` |  | `/// <param name="proxyPassword">The proxy password.</param>`
|  | `136` |  | `/// <param name="keyFiles">The key files.</param>`
|  | `137` |  | `public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost,`
| 6 | `138` |  | `: base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new PrivateKeyAu`
| 6 | `139` |  | `{`
| 6 | `140` |  | `KeyFiles = new Collection<IPrivateKeySource>(keyFiles);`
| 6 | `141` |  | `}`
|  | `142` |  | ``
|  | `143` |  | `/// <summary>`
|  | `144` |  | `/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.`
|  | `145` |  | `/// </summary>`
|  | `146` |  | `public void Dispose()`
| 0 | `147` |  | `{`
| 0 | `148` |  | `Dispose(disposing: true);`
| 0 | `149` |  | `GC.SuppressFinalize(this);`
| 0 | `150` |  | `}`
|  | `151` |  | ``
|  | `152` |  | `/// <summary>`
|  | `153` |  | `/// Releases unmanaged and - optionally - managed resources.`
|  | `154` |  | `/// </summary>`
|  | `155` |  | `/// <param name="disposing"><see langword="true"/> to release both managed and unmanaged resources; <see langwor`
|  | `156` |  | `protected virtual void Dispose(bool disposing)`
| 6 | `157` |  | `{`
| 6 | `158` |  | `if (_isDisposed)`
| 0 | `159` |  | `{`
| 0 | `160` |  | `return;`
|  | `161` |  | `}`
|  | `162` |  | ``
| 6 | `163` |  | `if (disposing)`
| 0 | `164` |  | `{`
|  | `165` |  | `// Dispose managed resources.`
| 0 | `166` |  | `if (AuthenticationMethods != null)`
| 0 | `167` |  | `{`
| 0 | `168` |  | `foreach (var authenticationMethod in AuthenticationMethods)`
| 0 | `169` |  | `{`
| 0 | `170` |  | `if (authenticationMethod is IDisposable disposable)`
| 0 | `171` |  | `{`
| 0 | `172` |  | `disposable.Dispose();`
| 0 | `173` |  | `}`
| 0 | `174` |  | `}`
| 0 | `175` |  | `}`
|  | `176` |  | ``
| 0 | `177` |  | `_isDisposed = true;`
| 0 | `178` |  | `}`
| 6 | `179` |  | `}`
|  | `180` |  | ``
|  | `181` |  | `/// <summary>`
|  | `182` |  | `/// Finalizes an instance of the <see cref="PrivateKeyConnectionInfo"/> class.`
|  | `183` |  | `/// </summary>`
|  | `184` |  | `~PrivateKeyConnectionInfo()`
| 12 | `185` |  | `{`
| 6 | `186` |  | `Dispose(disposing: false);`
| 12 | `187` |  | `}`
|  | `188` |  | `}`
|  | `189` |  | `}`

# Methods/Properties

get_KeyFiles()
.ctor(System.String,System.String,Renci.SshNet.PrivateKeyFile[])
.ctor(System.String,System.Int32,System.String,Renci.SshNet.IPrivateKeySource[])
.ctor(System.String,System.Int32,System.String,Renci.SshNet.ProxyTypes,System.String,System.Int32,Renci.SshNet.IPrivateKeySource[])
.ctor(System.String,System.Int32,System.String,Renci.SshNet.ProxyTypes,System.String,System.Int32,System.String,Renci.SshNet.IPrivateKeySource[])
.ctor(System.String,System.String,Renci.SshNet.ProxyTypes,System.String,System.Int32,Renci.SshNet.IPrivateKeySource[])
.ctor(System.String,System.String,Renci.SshNet.ProxyTypes,System.String,System.Int32,System.String,Renci.SshNet.IPrivateKeySource[])
.ctor(System.String,System.String,Renci.SshNet.ProxyTypes,System.String,System.Int32,System.String,System.String,Renci.SshNet.IPrivateKeySource[])
.ctor(System.String,System.Int32,System.String,Renci.SshNet.ProxyTypes,System.String,System.Int32,System.String,System.String,Renci.SshNet.IPrivateKeySource[])
Dispose()
Dispose(System.Boolean)
Finalize()