Skip to content

Commit

Permalink
initial draft
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-toman committed Sep 11, 2024
1 parent 363ba84 commit bc8034d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ private RSA GetKeyFromFile()
return GetKeyFromNamedContainer();
}

var rsa = new RSACryptoServiceProvider();
var rsa = new RSACng(2048);
rsa.ImportParameters(result.rsaParameters);
return rsa;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Agent.Listener/MessageListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ private ICryptoTransform GetMessageDecryptor(
var keyManager = HostContext.GetService<IRSAKeyManager>();
using (var rsa = keyManager.GetKey())
{
return aes.CreateDecryptor(rsa.Decrypt(_session.EncryptionKey.Value, RSAEncryptionPadding.OaepSHA1), message.IV);
return aes.CreateDecryptor(rsa.Decrypt(_session.EncryptionKey.Value, RSAEncryptionPadding.OaepSHA256), message.IV);
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -38,6 +39,7 @@ public Task<List<Capability>> GetCapabilitiesAsync(AgentSettings settings, Cance
Add(capabilities, "Agent.Version", BuildConstants.AgentPackage.Version);
Add(capabilities, "Agent.ComputerName", Environment.MachineName ?? string.Empty);
Add(capabilities, "Agent.HomeDirectory", HostContext.GetDirectory(WellKnownDirectory.Root));
Add(capabilities, "Listener.RSAEncryptionMode", nameof(RSAEncryptionPadding.OaepSHA256));
return Task.FromResult(capabilities);
}

Expand Down

0 comments on commit bc8034d

Please sign in to comment.