# < Summary

Information

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

Line coverage
50%

Covered lines: | 12
Uncovered lines: | 12
Coverable lines: | 24
Total lines: | 70
Line coverage: | 50%

Branch coverage
N/A

Covered branches: | 0
Total branches: | 0
Branch coverage: | N/A

Method coverage

Feature is only available for sponsors

Upgrade to PRO version

# Metrics

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
get_PublicKeyAlgorithmName() | 100% | 1 | 100%
get_PublicKeyData() | 100% | 1 | 100%
get_BufferCapacity() | 100% | 1 | 0%
Process(...) | 100% | 1 | 100%
LoadData() | 100% | 1 | 100%
SaveData() | 100% | 1 | 0%
ToString() | 100% | 1 | 100%

# File(s)

## \home\appveyor\projects\ssh-net\src\Renci.SshNet\Messages\Authentication\PublicKeyMessage.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `namespace Renci.SshNet.Messages.Authentication`
|  | `2` |  | `{`
|  | `3` |  | `/// <summary>`
|  | `4` |  | `/// Represents SSH_MSG_USERAUTH_PK_OK message.`
|  | `5` |  | `/// </summary>`
|  | `6` |  | `[Message("SSH_MSG_USERAUTH_PK_OK", 60)]`
|  | `7` |  | `internal sealed class PublicKeyMessage : Message`
|  | `8` |  | `{`
|  | `9` |  | `/// <summary>`
|  | `10` |  | `/// Gets the name of the public key algorithm as ASCII encoded byte array.`
|  | `11` |  | `/// </summary>`
|  | `12` |  | `/// <value>`
|  | `13` |  | `/// The name of the public key algorithm.`
|  | `14` |  | `/// </value>`
| 1350 | `15` |  | `public byte[] PublicKeyAlgorithmName { get; private set; }`
|  | `16` |  | ``
|  | `17` |  | `/// <summary>`
|  | `18` |  | `/// Gets the public key data.`
|  | `19` |  | `/// </summary>`
| 675 | `20` |  | `public byte[] PublicKeyData { get; private set; }`
|  | `21` |  | ``
|  | `22` |  | `/// <summary>`
|  | `23` |  | `/// Gets the size of the message in bytes.`
|  | `24` |  | `/// </summary>`
|  | `25` |  | `/// <value>`
|  | `26` |  | `/// The size of the messages in bytes.`
|  | `27` |  | `/// </value>`
|  | `28` |  | `protected override int BufferCapacity`
|  | `29` |  | `{`
|  | `30` |  | `get`
| 0 | `31` |  | `{`
| 0 | `32` |  | `var capacity = base.BufferCapacity;`
| 0 | `33` |  | `capacity += 4; // PublicKeyAlgorithmName length`
| 0 | `34` |  | `capacity += PublicKeyAlgorithmName.Length; // PublicKeyAlgorithmName`
| 0 | `35` |  | `capacity += 4; // PublicKeyData length`
| 0 | `36` |  | `capacity += PublicKeyData.Length; // PublicKeyData`
| 0 | `37` |  | `return capacity;`
| 0 | `38` |  | `}`
|  | `39` |  | `}`
|  | `40` |  | ``
|  | `41` |  | `internal override void Process(Session session)`
| 675 | `42` |  | `{`
| 675 | `43` |  | `session.OnUserAuthenticationPublicKeyReceived(this);`
| 675 | `44` |  | `}`
|  | `45` |  | ``
|  | `46` |  | `/// <summary>`
|  | `47` |  | `/// Called when type specific data need to be loaded.`
|  | `48` |  | `/// </summary>`
|  | `49` |  | `protected override void LoadData()`
| 675 | `50` |  | `{`
| 675 | `51` |  | `PublicKeyAlgorithmName = ReadBinary();`
| 675 | `52` |  | `PublicKeyData = ReadBinary();`
| 675 | `53` |  | `}`
|  | `54` |  | ``
|  | `55` |  | `/// <summary>`
|  | `56` |  | `/// Called when type specific data need to be saved.`
|  | `57` |  | `/// </summary>`
|  | `58` |  | `protected override void SaveData()`
| 0 | `59` |  | `{`
| 0 | `60` |  | `WriteBinaryString(PublicKeyAlgorithmName);`
| 0 | `61` |  | `WriteBinaryString(PublicKeyData);`
| 0 | `62` |  | `}`
|  | `63` |  | ``
|  | `64` |  | `/// <inheritdoc/>`
|  | `65` |  | `public override string ToString()`
| 675 | `66` |  | `{`
| 675 | `67` |  | `return $"SSH_MSG_USERAUTH_PK_OK ({Ascii.GetString(PublicKeyAlgorithmName)})";`
| 675 | `68` |  | `}`
|  | `69` |  | `}`
|  | `70` |  | `}`

# Methods/Properties

get_PublicKeyAlgorithmName()
get_PublicKeyData()
get_BufferCapacity()
Process(Renci.SshNet.Session)
LoadData()
SaveData()
ToString()