Skip to content

Commit

Permalink
Drop RIPEMD160 (#1324)
Browse files Browse the repository at this point in the history
  • Loading branch information
scott-xu authored Feb 18, 2024
1 parent 06af2ec commit 59a0f90
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 41 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ Private keys can be encrypted using one of the following cipher methods:
* hmac-sha2-256-96
* hmac-sha2-512
* hmac-sha2-512-96
* hmac-ripemd160
* hmac-ripemd160<span></span>@openssh.com
* hmac-md5-etm<span></span>@openssh.com
* hmac-md5-96-etm<span></span>@openssh.com
* hmac-sha1-etm<span></span>@openssh.com
Expand Down
32 changes: 0 additions & 32 deletions src/Renci.SshNet/Abstractions/CryptoAbstraction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,6 @@ public static System.Security.Cryptography.SHA512 CreateSHA512()
return System.Security.Cryptography.SHA512.Create();
}

#if FEATURE_HASH_RIPEMD160_CREATE || FEATURE_HASH_RIPEMD160_MANAGED
public static System.Security.Cryptography.RIPEMD160 CreateRIPEMD160()
{
#if FEATURE_HASH_RIPEMD160_CREATE
#pragma warning disable CA5350 // Do not use weak cryptographic algorithms
return System.Security.Cryptography.RIPEMD160.Create();
#pragma warning restore CA5350 // Do not use weak cryptographic algorithms
#else
return new System.Security.Cryptography.RIPEMD160Managed();
#endif
}
#else
public static global::SshNet.Security.Cryptography.RIPEMD160 CreateRIPEMD160()
{
return new global::SshNet.Security.Cryptography.RIPEMD160();
}
#endif // FEATURE_HASH_RIPEMD160

public static System.Security.Cryptography.HMACMD5 CreateHMACMD5(byte[] key)
{
#pragma warning disable CA5351 // Do not use broken cryptographic algorithms
Expand Down Expand Up @@ -141,19 +123,5 @@ public static HMACSHA512 CreateHMACSHA512(byte[] key, int hashSize)
{
return new HMACSHA512(key, hashSize);
}

#if FEATURE_HMAC_RIPEMD160
public static System.Security.Cryptography.HMACRIPEMD160 CreateHMACRIPEMD160(byte[] key)
{
#pragma warning disable CA5350 // Do not use weak cryptographic algorithms
return new System.Security.Cryptography.HMACRIPEMD160(key);
#pragma warning restore CA5350 // Do not use weak cryptographic algorithms
}
#else
public static global::SshNet.Security.Cryptography.HMACRIPEMD160 CreateHMACRIPEMD160(byte[] key)
{
return new global::SshNet.Security.Cryptography.HMACRIPEMD160(key);
}
#endif // FEATURE_HMAC_RIPEMD160
}
}
2 changes: 0 additions & 2 deletions src/Renci.SshNet/ConnectionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,6 @@ public ConnectionInfo(string host, int port, string username, ProxyTypes proxyTy
{ "hmac-sha2-512", new HashInfo(64*8, key => CryptoAbstraction.CreateHMACSHA512(key), isEncryptThenMAC: false) },
{ "hmac-sha2-512-96", new HashInfo(64*8, key => CryptoAbstraction.CreateHMACSHA512(key, 96), isEncryptThenMAC: false) },
{ "hmac-sha2-256-96", new HashInfo(32*8, key => CryptoAbstraction.CreateHMACSHA256(key, 96), isEncryptThenMAC: false) },
{ "hmac-ripemd160", new HashInfo(160, key => CryptoAbstraction.CreateHMACRIPEMD160(key), isEncryptThenMAC: false) },
{ "[email protected]", new HashInfo(160, key => CryptoAbstraction.CreateHMACRIPEMD160(key), isEncryptThenMAC: false) },
{ "hmac-sha1", new HashInfo(20*8, key => CryptoAbstraction.CreateHMACSHA1(key), isEncryptThenMAC: false) },
{ "hmac-sha1-96", new HashInfo(20*8, key => CryptoAbstraction.CreateHMACSHA1(key, 96), isEncryptThenMAC: false) },
{ "hmac-md5", new HashInfo(16*8, key => CryptoAbstraction.CreateHMACMD5(key), isEncryptThenMAC: false) },
Expand Down
6 changes: 1 addition & 5 deletions src/Renci.SshNet/Renci.SshNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net462' ">
<DefineConstants>$(DefineConstants);FEATURE_BINARY_SERIALIZATION;FEATURE_HASH_RIPEMD160_CREATE;FEATURE_HMAC_RIPEMD160</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_BINARY_SERIALIZATION</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard2.1')) ">
<PackageReference Include="SshNet.Security.Cryptography" Version="[1.3.0]" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0" />
</ItemGroup>
Expand Down

0 comments on commit 59a0f90

Please sign in to comment.