Provides support for some cryptographic primitives for .NET Framework and .NET Standard.
$ dotnet add package Microsoft.Bcl.CryptographyThis library provides some cryptographic types and functionality for .NET Standard and .NET Framework. This library is not necessary nor recommended when targeting versions of .NET that include the relevant support.
This package should only be used by platforms where the desired functionality is not built-in.
using System.Security.Cryptography;
internal static class Program
{
private static void Main()
{
byte[] key = LoadKey();
using SP800108HmacCounterKdf kbkdf = new(key, HashAlgorithmName.SHA256);
byte[] derivedKey = kbkdf.DeriveKey("label"u8, "context"u8, derivedKeyLengthInBytes: 32);
}
}
The main types provided by this library are:
System.Security.Cryptography.AesGcmSystem.Security.Cryptography.CompositeMLDsaSystem.Security.Cryptography.MLDsaSystem.Security.Cryptography.MLKemSystem.Security.Cryptography.SlhDsaSystem.Security.Cryptography.SP800108HmacCounterKdfSystem.Security.Cryptography.X509Certificates.X509CertificateLoaderMicrosoft.Bcl.Cryptography is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.