Arric.Crypto.SM 1.1.0

dotnet add package Arric.Crypto.SM --version 1.1.0                
NuGet\Install-Package Arric.Crypto.SM -Version 1.1.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="Arric.Crypto.SM" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Arric.Crypto.SM --version 1.1.0                
#r "nuget: Arric.Crypto.SM, 1.1.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 Arric.Crypto.SM as a Cake Addin
#addin nuget:?package=Arric.Crypto.SM&version=1.1.0

// Install Arric.Crypto.SM as a Cake Tool
#tool nuget:?package=Arric.Crypto.SM&version=1.1.0                

Arric.Crypto.SM

国密加密算法,支持 SM2、SM3、SM4

SM2

生成密钥
var sm2 = new SM2.SM2Crypto();
var generateKeyHex = sm2.GenerateSecretKeyPair(true);
var generateKeyBase64 = sm2.GenerateSecretKeyPair(false);
加密
var encHex = sm2.EncryptToHex(Plaintext, PublicKeyHex, true);
var encBase64 = sm2.EncryptToBase64(Plaintext, PublicKeyHex, true);
解密
var decHex = sm2.DecryptFormHex(encHex, PrivateKeyHex, true);
var decBase64 = sm2.DecryptFormBase64(encBase64, PrivateKeyHex, true);

SM3

var sm3 = new SM3.SM3Crypto();
var encryptHex = sm3.EncryptToHex(Plaintext);
var encryptBase64= sm3.EncryptToBase64(Plaintext);

SM4

加密
var sm4Crypto = new Sm4Crypto();
var ecbBase64 = sm4Crypto.EncryptECBToBase64(Plaintext, SecretKey);
var ecbHex = sm4Crypto.EncryptECBToHex(Plaintext, SecretKey);
解密
var sm4Crypto = new Sm4Crypto();
var ecbBase64 = sm4Crypto.DecryptECBFormBase64(ciphertext, SecretKey);
var ecbHex = sm4Crypto.DecryptECBFormHex(ciphertext, SecretKey);
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 is compatible.  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. 
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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
1.1.0 440 10/3/2023
1.0.0 129 9/23/2023