Smart.Security
3.0.1
dotnet add package Smart.Security --version 3.0.1
NuGet\Install-Package Smart.Security -Version 3.0.1
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="Smart.Security" Version="3.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Smart.Security --version 3.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Smart.Security, 3.0.1"
#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 Smart.Security as a Cake Addin #addin nuget:?package=Smart.Security&version=3.0.1 // Install Smart.Security as a Cake Tool #tool nuget:?package=Smart.Security&version=3.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Smart.Security
基于 BouncyCastle.Cryptography 实现的.NET安全组件库,支持数据加解密、签名验签、哈希计算等核心功能,兼容.NET6/8/9平台。
功能特性
- 对称加密:AES(128/256位)、国密SM4(128位分组加密)
- 非对称加密:RSA(公钥加密/私钥解密)、国密SM2(椭圆曲线加密)
- 哈希算法:MD5/SHA系列(SHA1/256/384/512)、HMAC系列、国密SM3
- 密码安全:密码校验、加盐哈希、盐值生成
- 随机数生成:安全随机字节/字符串
- 文件完整性:多算法文件哈希校验
核心类说明
SmartAESCipher
- AES对称加密/解密(CBC模式)
- 支持128/256位密钥长度
SmartRSACipher
- RSA公钥加密/私钥解密
- 私钥签名/公钥验签(支持MD5/SHA1/SHA256)
SmartSM2Cipher
- 国密SM2非对称加密(公钥加密/私钥解密)
- 私钥签名/公钥验签(基于SM3哈希)
SmartSM4Cipher
- 国密SM4对称加密(ECB/CBC模式)
- 固定128位密钥和分组长度
SmartHash
- 支持MD5/SHA1/SHA256/SHA384/SHA512
- HMAC系列算法(HMAC-MD5/HMAC-SHA1等)
SmartFileHash
- 文件哈希计算(MD5/SHA1/SHA256/SHA384/SHA512)
- 大文件流式处理优化
SmartPassword
- PBKDF2密码哈希(默认10000次迭代)
- 自动盐值生成与验证
SmartRandomGenerate
- 密码学安全随机数生成
- 支持字节数组/HEX字符串/Base64字符串
SmartSM3Hash
- 国密SM3哈希算法(等效SHA-256安全强度)
- 输出32字节哈希值
平台兼容
目标框架 | 支持版本 |
---|---|
.NET | 6/8/9 |
安全建议
- 国密算法需配合BouncyCastle扩展使用
- RSA密钥长度建议≥2048位
- 优先使用SHA256/384/512替代MD5/SHA1
- 密钥应存储于安全介质(如HSM)
Developed by zenglei
Product | Versions 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 is compatible. 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- BouncyCastle.Cryptography (>= 2.5.1)
-
net8.0
- BouncyCastle.Cryptography (>= 2.5.1)
-
net9.0
- BouncyCastle.Cryptography (>= 2.5.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.