Skip to content

Commit e7cb93d

Browse files
committed
Use native AesGcm for .NET Framework from nuget
1 parent b803932 commit e7cb93d

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

Directory.Packages.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
<!-- Must be kept at version 1.0.0, see https://github.com/sshnet/SSH.NET/pull/1288 for details. -->
1818
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0" />
19-
19+
<PackageVersion Include="Microsoft.Bcl.Cryptography" Version="10.0.0-preview.2.25163.2" />
20+
2021
<!-- No reason to require later than 6.0.0 at this time. -->
2122
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
2223
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.2" />

src/Renci.SshNet/Renci.SshNet.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@
4949
</PackageReference>
5050
</ItemGroup>
5151

52-
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0' ">
52+
<ItemGroup Condition=" '$(TargetFramework)' == 'net462'">
53+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
54+
<PackageReference Include="Microsoft.Bcl.Cryptography" />
55+
</ItemGroup>
56+
57+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
5358
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
5459
<PackageReference Include="System.Formats.Asn1" />
5560
</ItemGroup>

src/Renci.SshNet/Security/Cryptography/Ciphers/AesGcmCipher.BclImpl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NET
1+
#if !NETSTANDARD
22
using System;
33
using System.Security.Cryptography;
44

src/Renci.SshNet/Security/Cryptography/Ciphers/AesGcmCipher.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal sealed partial class AesGcmCipher : SymmetricCipher, IDisposable
1515
private const int TagSizeInBytes = 16;
1616
private readonly byte[] _iv;
1717
private readonly int _aadLength;
18-
#if NET
18+
#if !NETSTANDARD
1919
private readonly Impl _impl;
2020
#else
2121
private readonly BouncyCastleImpl _impl;
@@ -62,7 +62,7 @@ public AesGcmCipher(byte[] key, byte[] iv, int aadLength)
6262
// SSH AES-GCM requires a 12-octet Initial IV
6363
_iv = iv.Take(12);
6464
_aadLength = aadLength;
65-
#if NET
65+
#if !NETSTANDARD
6666
if (System.Security.Cryptography.AesGcm.IsSupported)
6767
{
6868
_impl = new BclImpl(key, _iv);

0 commit comments

Comments
 (0)