Uh oh!
There was an error while loading. Please reload this page.
Use native AesGcm for .NET Framework from nuget - #1619
Conversation
Rob-Hague
commented
Mar 25, 2025
LGTM once the package is stable |
b93e470 to
b9d888bCompared49b548 to
c43bdb5Comparec43bdb5 to
fc1add9Comparee3c63a5 to
177dfbaCompareThere was a problem hiding this comment.
Pull Request Overview
This PR enables the use of the native BCL AesGcm implementation for .NET Framework by adding the Microsoft.Bcl.Cryptography NuGet package. Previously, only .NET (Core) targets could use the native implementation, while .NET Framework and .NET Standard had to fall back to a BouncyCastle implementation.
Key changes:
- Changed conditional compilation from
NETto!NETSTANDARDto include .NET Framework targets - Added fallback handling for Mono environments that lack
BCrypt.dll - Added
Microsoft.Bcl.Cryptographypackage reference fornet462target
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
AesGcmCipher.cs | Updated preprocessor directives and added Mono-specific exception handling for missing BCrypt.dll |
AesGcmCipher.BclImpl.cs | Updated preprocessor directive to enable BCL implementation for .NET Framework |
Renci.SshNet.csproj | Added package reference for Microsoft.Bcl.Cryptography for net462 target |
Directory.Packages.props | Added version specification for Microsoft.Bcl.Cryptography package |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
177dfba to
b239f3cCompare| { | ||
| _impl = new BclImpl(key, _iv); | ||
| } | ||
| catch (DllNotFoundException) |
There was a problem hiding this comment.
have you hit this? I don't think we need to be that worried about it anymore
There was a problem hiding this comment.
The CI test was ran at Ubuntu and hit this issue before.
I can unwrap "try catch" if you want.
Based on dotnet/runtime#89718, we can use native
AesGcmfor .NET Framework from Microsoft.Bcl.Cryptography nuget package