wan24-Crypto-BC 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package wan24-Crypto-BC --version 1.0.0                
NuGet\Install-Package wan24-Crypto-BC -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="wan24-Crypto-BC" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add wan24-Crypto-BC --version 1.0.0                
#r "nuget: wan24-Crypto-BC, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install wan24-Crypto-BC as a Cake Addin
#addin nuget:?package=wan24-Crypto-BC&version=1.0.0

// Install wan24-Crypto-BC as a Cake Tool
#tool nuget:?package=wan24-Crypto-BC&version=1.0.0                

wan24-Crypto-BC

This library adopts The Bouncy Castle Cryptography Library For .NET to wan24-Crypto and extends the wan24-Crypto library with these algorithms:

Algorithm ID Name
Asymmetric
CRYSTALS-Kyber 2 CRYSTALSKYBER
CRYSTALS-Dilithium 3 CRYSTALSDILITHIUM
FALCON 4 FALCON
SPHINCS+ 5 SPHINCSPLUS

CAUTION: The underlaying Bouncy Castle library is forked from its original GitHub repository, and it's using the main branch. The main branch is not yet released! So this library should be seen as experimental and not being used in a productive environment! The Bouncy Castle build will be updated from time to time. As soon as the official NuGet package has PQC support, this library will switch to the NuGet package.

How to get it

This library is available as NuGet package.

Usage

In case you don't use the wan24-Core bootstrapper logic, you need to initialize the Bouncy Castle extension first, before you can use it:

wan24.Crypo.BC.Bootstrapper.Boot();

This will register the algorithms to the wan24-Crypto library.

Post quantum safety

These algorithms are designed for post quantum cryptography:

  • CRYSTALS-Kyber (key exchange)
  • CRYSTALS-Dilithium (signature)
  • FALCON (signature)
  • SPHINCS+ (signature)

Normally you want to use them in hybrid mode as counter algorithm for extending a default algorithm of the wan24-Crypto package. To do this per default:

// Enable the post quantum algorithms as counter-defaults
CryptoHelper.ForcePostQuantumSafety();

This will use these algorithms as counter algorithms for asymmetric cryptography, in case you didn't define other post quantum algorithms already:

  • CRYSTALS-Kyber (key exchange)
  • CRYSTALS-Dilithium (signature)

For using FALCON or SPHINCS+ for signature instead:

// FALCON
HybridAlgorithmHelper.SignatureAlgorithm = 
    AsymmetricHelper.GetAlgorithm(AsymmetricFalconAlgorithm.ALGORITHM_NAME);

// SPHINCS+
HybridAlgorithmHelper.SignatureAlgorithm = 
    AsymmetricHelper.GetAlgorithm(AsymmetricSphincsPlusAlgorithm.ALGORITHM_NAME);

The counter algorithm will come in effect, if you use asymmetric keys for encryption:

// Create options having a counter private key
CryptoOptions options = EncryptionHelper.GetDefaultOptions();
options.SetCounterPrivateKey(yourKyberPrivateKey);

// Encrypt using the options and your normal private key
byte[] cipherData = rawData.Encrypt(yourNormalPrivateKey, options);
rawData = cipherData.Decrypt(yourNormalPrivateKey, options);

And for signature:

// Create options having a counter private key
CryptoOptions options = AsymmetricHelper.GetDefaultSignatureOptions();
options.SetCounterPrivateKey(yourDilithiumPrivateKey);

// Sign using the options and your normal private key
SignatureContainer signature = dataToSign.Sign(yourNormalPrivateKey, options: options);

Algorithm parameters used

For CRYSTALS-Kyber and CRYSTALS-Dilithium the AES parameters are being used. When using SPHINCS+, the Haraka F hashing parameters will be used.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.14.0 88 10/27/2024
3.13.0 88 9/21/2024
3.12.0 84 9/9/2024
3.11.0 115 8/16/2024
3.10.1 99 7/13/2024
3.10.0 119 7/6/2024 3.10.0 is deprecated because it is no longer maintained.
3.9.0 103 6/29/2024
3.8.0 111 6/22/2024
3.7.0 92 6/16/2024
3.6.0 102 5/26/2024
3.5.1 133 4/13/2024
3.5.0 119 4/13/2024
3.4.0 136 3/9/2024
3.3.0 139 3/2/2024
3.2.0 120 2/24/2024
3.1.0 102 2/17/2024
3.0.0 126 2/11/2024
2.0.0 109 1/21/2024
1.19.3 172 11/11/2023
1.19.2 107 11/1/2023
1.19.1 140 10/29/2023
1.19.0 158 10/21/2023
1.18.0 155 10/15/2023
1.17.0 131 10/8/2023
1.16.0 149 10/1/2023
1.15.0 143 9/19/2023
1.14.0 115 9/16/2023
1.13.0 167 9/10/2023
1.12.0 163 9/3/2023
1.11.1 167 7/30/2023
1.11.0 151 7/30/2023
1.10.0 160 7/22/2023
1.9.0 158 6/8/2023
1.8.0 150 6/3/2023
1.7.0 143 5/29/2023
1.6.0 153 5/27/2023
1.5.0 164 5/20/2023
1.4.1 153 5/13/2023
1.4.0 178 5/11/2023
1.3.0 190 5/7/2023 1.3.0 is deprecated because it is no longer maintained.
1.2.0 192 5/1/2023 1.2.0 is deprecated because it is no longer maintained.
1.1.0 190 4/30/2023 1.1.0 is deprecated because it is no longer maintained.
1.0.1 192 4/28/2023 1.0.1 is deprecated because it is no longer maintained.
1.0.0 210 4/28/2023 1.0.0 is deprecated because it is no longer maintained.