Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from SHA1 to SHA256 #4989

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tagging this

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
Loading