RuoVea.ExCrypt
2.1.1
See the version list below for details.
dotnet add package RuoVea.ExCrypt --version 2.1.1
NuGet\Install-Package RuoVea.ExCrypt -Version 2.1.1
<PackageReference Include="RuoVea.ExCrypt" Version="2.1.1" />
paket add RuoVea.ExCrypt --version 2.1.1
#r "nuget: RuoVea.ExCrypt, 2.1.1"
// Install RuoVea.ExCrypt as a Cake Addin #addin nuget:?package=RuoVea.ExCrypt&version=2.1.1 // Install RuoVea.ExCrypt as a Cake Tool #tool nuget:?package=RuoVea.ExCrypt&version=2.1.1
RuoVea.ExCrypt
介绍
集成加密工具类 AES、 Base64、DESC、HMACSHA1、HMACSHA256、HMACSHA384、HMACSHA512、MD5、JsMD5、RSA、SHA1、SHA256、SHA384、、SHA512 加密算法; 字符串加密拓展 ToMD5Encrypt、ToAESEncrypt、ToAESDecrypt、ToDESCEncrypt、ToDESCDecrypt、ToRSAEncrpyt、ToRSADecrypt
使用示例
var aesKey = AESCrypt.CreateAesKey();
var key = aesKey.Key;
var iv = aesKey.IV;
/*
var _max = 10000;
var s1 = Stopwatch.StartNew();
for (int i = 0; i < _max; i++)
{
aesKey = EncryptProvider.CreateAesKey();
}
s1.Stop();
var s2 = Stopwatch.StartNew();
for (int i = 0; i < _max; i++)
{
aesKey = EncryptProvider.CreateAesKey(false);
}
s2.Stop();
Console.WriteLine(((double)(s1.Elapsed.TotalMilliseconds * 1000000) / _max).ToString("0.00 ns"));
Console.WriteLine(((double)(s2.Elapsed.TotalMilliseconds * 1000000) / _max).ToString("0.00 ns"));
Console.Read();
*/
var plaintext = "Hello world 123456789/*-+!@#$%^&*()-=_+";
var encrypted = AESCrypt.AESEncrypt(plaintext, key, iv);
var decrypted = AESCrypt.AESDecrypt(encrypted, key, iv);
Console.WriteLine("Plaintext to encrypt: " + plaintext);
Console.WriteLine();
Console.WriteLine("** AES SecureRandom **");
Console.WriteLine("Encrypted " + " (Length: " + encrypted.Length + ") " + encrypted);
Console.WriteLine("Decrypted " + " (Length: " + decrypted.Length + ") " + decrypted);
Console.WriteLine("Key: {0} IV: {1}", key, iv);
Console.WriteLine();
Console.WriteLine("** AES SecureRandom with Byte input/output **");
byte[] bencrypted = AESCrypt.AESEncrypt(Encoding.UTF8.GetBytes(plaintext), key, iv);
byte[] bdecrypted = AESCrypt.AESDecrypt(bencrypted, key, iv);
Console.WriteLine("Encrypted " + " (Length: " + bencrypted.Length + ") " + Encoding.UTF8.GetString(bencrypted));
Console.WriteLine("Decrypted " + " (Length: " + bdecrypted.Length + ") " + Encoding.UTF8.GetString(bdecrypted));
Console.WriteLine("Key: {0} IV: {1}", key, iv);
Console.WriteLine();
Console.WriteLine("** AES Non-SecureRandom **");
aesKey = AESCrypt.CreateAesKey();
key = aesKey.Key;
iv = aesKey.IV;
encrypted = AESCrypt.AESEncrypt(plaintext, key, iv);
decrypted = AESCrypt.AESDecrypt(encrypted, key, iv);
Console.WriteLine("Encrypted " + " (Length: " + encrypted.Length + ") " + encrypted);
Console.WriteLine("Decrypted " + " (Length: " + decrypted.Length + ") " + decrypted);
Console.WriteLine("Key: {0} IV: {1}", key, iv);
Console.WriteLine();
Console.WriteLine("** RSA **");
var rsaKey = RSACrypt.GenerateSecretKey();
var publicKey = rsaKey.publicKey;
var privateKey = rsaKey.privateKey;
////var exponent = rsaKey.Exponent;
////var modulus = rsaKey.Modulus;
//encrypted = RSACrypt.RSAEncrypt(publicKey, plaintext);
//encrypted = RSACrypt.RSAEncrypt(publicKey, plaintext, RSACrypt.Pkcs1);
//decrypted = RSACrypt.RSADecrypt(privateKey, encrypted, RSACrypt..Pkcs1);
//Console.WriteLine("Encrypted: " + encrypted);
//Console.WriteLine("Decrypted: " + decrypted);
//Console.WriteLine("publicKey: {0} privateKey: {1}", publicKey, privateKey);
Console.WriteLine();
Console.WriteLine("** SHA **");
Console.WriteLine("SHA1: " + SHA1Crypt.Encrypt(plaintext));
Console.WriteLine("SHA256: " + SHA256Crypt.Encrypt(plaintext));
Console.WriteLine("SHA384: " + SHA384Crypt.Encrypt(plaintext));
Console.WriteLine("SHA512: " + SHA512Crypt.Encrypt(plaintext));
Console.WriteLine();
Console.WriteLine("** Test issues #25 https://github.com/myloveCc/NETCore.Encrypt/issues/25 **");
//rsaKey = EncryptProvider.CreateRsaKey();
//publicKey = rsaKey.PublicKey;
//privateKey = rsaKey.PrivateKey;
var testStr = "test issues #25 ";
//Console.WriteLine($"Test str:{testStr}");
var saveDir = AppDomain.CurrentDomain.BaseDirectory;
//save public key
var publicKeySavePath = Path.Combine(saveDir, "privateKey.txt");
if (File.Exists(publicKeySavePath))
{
File.Delete(publicKeySavePath);
}
using (FileStream fs = new FileStream(publicKeySavePath, FileMode.CreateNew))
{
fs.Write(Encoding.UTF8.GetBytes(privateKey));
}
//save encrypt text
var encryptStr =RSACrypt.Encrypt(testStr, publicKey);
Console.WriteLine($"encryped str:{encryptStr}");
var encryptSavePath = Path.Combine(saveDir, "encrypt.txt");
if (File.Exists(encryptSavePath))
{
File.Delete(encryptSavePath);
}
using (FileStream fs = new FileStream(encryptSavePath, FileMode.CreateNew))
{
fs.Write(Encoding.UTF8.GetBytes(encryptStr));
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
.NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 is compatible. net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.5.1
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.7.1
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETFramework 4.8.1
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
NuGet packages (6)
Showing the top 5 NuGet packages that depend on RuoVea.ExCrypt:
Package | Downloads |
---|---|
RuoVea.ExFilter
注入 进行全局的异常日志收集、执行操作日志、参数验证,支持简体中文、繁体中文、粤语、日语、法语、英语. services.ExceptionSetup();// 注入 全局错误日志处 services.ExceptionSetup(ExceptionLog actionOptions);// 注入 全局错误日志处 services.ExceptionSetup(builder.Configuration.GetSection("AopOption:ExceptionLog"));// 注入 全局错误日志处 services.RequestActionSetup();// 注入 请求日志拦截 [执行操作日志、参数验证 ] services.RequestActionSetup(RequestLog actionOptions);// 注入 请求日志拦截 [执行操作日志、参数验证 ] services.RequestActionSetup(builder.Configuration.GetSection("AopOption:RequestLog"));// 注入 请求日志拦截 [执行操作日志、参数验证 ] services.ResourceSetup();//对资源型信息进行过滤 services.ResultSetup();//对结果进行统一 services.ApISafeSetup(AppSign actionOptions);//接口安全校验 services.ApISafeSetup(builder.Configuration.GetSection("AopOption:AppSign"));//接口安全校验 services.ApISignSetup(AppSign actionOptions);//签名验证 ( appKey + signKey + timeStamp + data ); services.ApISignSetup(builder.Configuration.GetSection("AopOption:AppSign"));//签名验证 ( appKey + signKey + timeStamp + data ); services.AddValidateSetup();//模型校验 services.AddUiFilesZipSetup();//将前端UI压缩文件进行解压 不进行接口安全校验 -> NonAplSafeAttribute 不签名验证 -> NonAplSignAttribute 不进行全局的异常日志收集 -> NonExceptionAttribute 不对资源型信息进行过滤 -> NonResourceAttribute 不对结果进行统一 -> NonRestfulResultAttribute |
|
RuoVea.OmiApi.UserRoleMenu
用户、角色、菜单管理 API |
|
RuoVea.OmiApi.SystemApp
用户、角色、菜单、机构、职位、权限管理 API |
|
RuoVea.OmiApi.Auth
用户登陆 API |
|
RuoVea.OmiApi.User
用户管理 API |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.1 | 123 | 8/28/2024 |
8.0.0 | 239 | 11/23/2023 |
7.0.1 | 120 | 8/28/2024 |
7.0.0 | 198 | 7/23/2024 |
6.0.3.1 | 1,688 | 8/28/2024 |
6.0.2 | 977 | 9/16/2022 |
6.0.1 | 394 | 8/24/2022 |
6.0.0 | 1,856 | 2/9/2022 |
5.0.8 | 137 | 8/28/2024 |
5.0.7.1 | 144 | 11/23/2023 |
5.0.7 | 705 | 11/13/2021 |
5.0.6 | 403 | 11/5/2021 |
5.0.5 | 322 | 11/4/2021 |
5.0.4 | 352 | 11/4/2021 |
5.0.3 | 331 | 10/5/2021 |
5.0.2 | 337 | 9/30/2021 |
5.0.1 | 312 | 9/27/2021 |
5.0.0 | 385 | 9/26/2021 |
2.1.2 | 80 | 8/28/2024 |
2.1.1 | 104 | 11/24/2023 |