-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
481 additions
and
505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// | ||
// | ||
// AgentClient.cs | ||
// | ||
// Author(s): David Lechner <[email protected]> | ||
|
@@ -161,7 +161,7 @@ public void RemoveKey(ISshKey key) | |
|
||
public void RemoveAllKeys(SshVersion version) | ||
{ | ||
BlobBuilder builder = new BlobBuilder(); | ||
var builder = new BlobBuilder(); | ||
ICollection<ISshKey> keys = null; | ||
if (KeyRemoved != null) | ||
keys = ListKeys(version); | ||
|
@@ -186,7 +186,7 @@ public void RemoveAllKeys(SshVersion version) | |
|
||
public ICollection<ISshKey> ListKeys(SshVersion aVersion) | ||
{ | ||
BlobBuilder builder = new BlobBuilder(); | ||
var builder = new BlobBuilder(); | ||
switch (aVersion) | ||
{ | ||
case SshVersion.SSH1: | ||
|
@@ -198,7 +198,7 @@ public ICollection<ISshKey> ListKeys(SshVersion aVersion) | |
default: | ||
throw new Exception(cUnsupportedSshVersion); | ||
} | ||
BlobParser replyParser = SendMessage(builder); | ||
var replyParser = SendMessage(builder); | ||
var keyCollection = new List<ISshKey>(); | ||
var header = replyParser.ReadHeader(); | ||
switch (aVersion) | ||
|
@@ -228,9 +228,7 @@ public ICollection<ISshKey> ListKeys(SshVersion aVersion) | |
{ | ||
var publicKeyBlob = replyParser.ReadBlob(); | ||
var publicKeyParser = new BlobParser(publicKeyBlob); | ||
var publicKeyParams = publicKeyParser.ReadSsh2PublicKeyData( | ||
out OpensshCertificate cert | ||
); | ||
var publicKeyParams = publicKeyParser.ReadSsh2PublicKeyData(out var cert); | ||
var comment = replyParser.ReadString(); | ||
keyCollection.Add( | ||
new SshKey(SshVersion.SSH2, publicKeyParams, null, comment, cert) | ||
|
@@ -245,7 +243,7 @@ out OpensshCertificate cert | |
|
||
public byte[] SignRequest(ISshKey aKey, byte[] aSignData) | ||
{ | ||
BlobBuilder builder = new BlobBuilder(); | ||
var builder = new BlobBuilder(); | ||
switch (aKey.Version) | ||
{ | ||
case SshVersion.SSH1: | ||
|
@@ -272,7 +270,7 @@ public byte[] SignRequest(ISshKey aKey, byte[] aSignData) | |
throw new Exception(cUnsupportedSshVersion); | ||
} | ||
|
||
BlobParser replyParser = SendMessage(builder); | ||
var replyParser = SendMessage(builder); | ||
var header = replyParser.ReadHeader(); | ||
|
||
switch (aKey.Version) | ||
|
@@ -283,9 +281,9 @@ public byte[] SignRequest(ISshKey aKey, byte[] aSignData) | |
throw new AgentFailureException(); | ||
} | ||
|
||
byte[] response = new byte[16]; | ||
var response = new byte[16]; | ||
|
||
for (int i = 0; i < 16; i++) | ||
for (var i = 0; i < 16; i++) | ||
{ | ||
response[i] = replyParser.ReadByte(); | ||
} | ||
|
@@ -309,7 +307,7 @@ public void Lock(byte[] passphrase) | |
throw new ArgumentNullException(nameof(passphrase)); | ||
} | ||
|
||
BlobBuilder builder = new BlobBuilder(); | ||
var builder = new BlobBuilder(); | ||
builder.AddBlob(passphrase); | ||
builder.InsertHeader(Agent.Message.SSH_AGENTC_LOCK); | ||
SendMessageAndCheckSuccess(builder); | ||
|
@@ -322,7 +320,7 @@ public void Unlock(byte[] passphrase) | |
throw new ArgumentNullException(nameof(passphrase)); | ||
} | ||
|
||
BlobBuilder builder = new BlobBuilder(); | ||
var builder = new BlobBuilder(); | ||
builder.AddBlob(passphrase); | ||
builder.InsertHeader(Agent.Message.SSH_AGENTC_UNLOCK); | ||
SendMessageAndCheckSuccess(builder); | ||
|
@@ -450,7 +448,7 @@ private void FireKeyAdded(ISshKey key) | |
{ | ||
if (KeyAdded != null) | ||
{ | ||
SshKeyEventArgs args = new SshKeyEventArgs(key); | ||
var args = new SshKeyEventArgs(key); | ||
KeyAdded(this, args); | ||
} | ||
} | ||
|
@@ -459,7 +457,7 @@ private void FireKeyRemoved(ISshKey key) | |
{ | ||
if (KeyRemoved != null) | ||
{ | ||
SshKeyEventArgs args = new SshKeyEventArgs(key); | ||
var args = new SshKeyEventArgs(key); | ||
KeyRemoved(this, args); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.