diff --git a/src/wan24-Crypto-BC/BouncyCastle.cs b/src/wan24-Crypto-BC/BouncyCastle.cs index 6ba92ae..2eeee4d 100644 --- a/src/wan24-Crypto-BC/BouncyCastle.cs +++ b/src/wan24-Crypto-BC/BouncyCastle.cs @@ -101,7 +101,7 @@ public static void ReplaceNetAlgorithms() /// /// Register (HMAC)SHA3-* algorithms to (replace the .NET defaults!) /// - public static void RegisterNetAlgrithms() + public static void RegisterNetAlgorithms() { HashBcSha3_256Algorithm.SHA3_256.Register(); HashBcSha3_384Algorithm.SHA3_384.Register(); diff --git a/src/wan24-Crypto-BC/README.md b/src/wan24-Crypto-BC/README.md index 4b73b52..777a382 100644 --- a/src/wan24-Crypto-BC/README.md +++ b/src/wan24-Crypto-BC/README.md @@ -84,6 +84,30 @@ and use the default output length of the `wan24-Crypto` implementations instead. The `NetShake128/256HashAlgorithmAdapter` can't be replaced for this reason. +In order to override the .NET default SHA3 hash and HMAC algorithms, you can +call: + +```cs +BouncyCastle.RegisterNetAlgorithms(); +``` + +This will use Bouncy Castle SHA3 implementations for the .NET implemented SHA3 +hash algorithms: + +| Name | Type | +| ---- | ---- | +| SHA3-256 | `HashBcSha3_256.SHA3_256` | +| SHA3-384 | `HashBcSha3_384.SHA3_384` | +| SHA3-512 | `HashBcSha3_512.SHA3_512` | +| HMACSHA3-256 | `MacBcHmacSha3_256.HMACSHA3_256` | +| HMACSHA3-384 | `MacBcHmacSha3_384.HMACSHA3_384` | +| HMACSHA3-512 | `MacBcHmacSha3_512.HMACSHA3_512` | + +This step is required, if you want to ensure that whenever a .NET crypto type +or any 3rd party crypto type requests a SHA3 hash or HMAC instance using the +static `HashAlgorithm.Create("NAME")` or `KeyedHashAlgorithm.Create("NAME")` +methods. + ### Use as default algorithms To set Bouncy Castle defaults as `wan24-Crypto` defaults: diff --git a/src/wan24-Crypto-BC/wan24-Crypto-BC.csproj b/src/wan24-Crypto-BC/wan24-Crypto-BC.csproj index 137ecd0..a515318 100644 --- a/src/wan24-Crypto-BC/wan24-Crypto-BC.csproj +++ b/src/wan24-Crypto-BC/wan24-Crypto-BC.csproj @@ -9,7 +9,7 @@ True wan24-Crypto-BC wan24-Crypto-BC - 3.5.0 + 3.5.1 nd1012 Andreas Zimmermann, wan24.de wan24-Crypto-BC