iCat.Crypto
1.0.0
dotnet add package iCat.Crypto --version 1.0.0
NuGet\Install-Package iCat.Crypto -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="iCat.Crypto" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add iCat.Crypto --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: iCat.Crypto, 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 iCat.Crypto as a Cake Addin
#addin nuget:?package=iCat.Crypto&version=1.0.0
// Install iCat.Crypto as a Cake Tool
#tool nuget:?package=iCat.Crypto&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
iCat.Crypto
iCat.Crypto integrate some hasher, crypto methods.
Installation
dotnet add package iCat.Crypto
Configuration
using iCat.Crypto.Interfaces;
using iCat.Crypto.Implements.Cryptors;
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
var rsaPrivateKey = "fill your RSA private key";
var rsaPublicKey = "fill your RSA public key";
// Add services to the container.
services.AddControllers();
services.AddSingleton<ICryptor>(p => new iCat.Crypto.Implements.Cryptors.AES("AES", "12345678"));
services.AddSingleton<ICryptor>(p => new iCat.Crypto.Implements.Cryptors.DES("DES", "12345678"));
services.AddSingleton<ICryptor>(p => new iCat.Crypto.Implements.Cryptors.RSA("RSA", rsaPublicKey, rsaPrivateKey));
services.AddSingleton<IHasher>(p => new iCat.Crypto.Implements.Hashes.Hasher("Hash", "12345678"));
var app = builder.Build();
// Configure the HTTP request pipeline.
app.UseAuthorization();
app.MapControllers();
app.Run();
}
}
Sample
using iCat.Crypto;
using iCat.Crypto.Interfaces;
[ApiController]
[Route("[controller]")]
public class DemoController : ControllerBase
{
private readonly IEnumerable<ICryptor> _cryptors;
private readonly IHasher _hasher;
public DemoController(IEnumerable<ICryptor> cryptors, IHasher hasher)
{
_cryptors = cryptors ?? throw new ArgumentNullException(nameof(cryptors));
_hasher = hasher ?? throw new ArgumentNullException(nameof(hasher));
}
[HttpGet]
public IActionResult Get()
{
var plainText = "plainText";
// use by DI
var cipherTextAES = _cryptors.First(p => p.Category == "AES").Encrypt(plainText);
var cipherTextDES = _cryptors.First(p => p.Category == "DES").Encrypt(plainText);
var cipherTextRSA = _cryptors.First(p => p.Category == "RSA").Encrypt(plainText);
var resultAES = _cryptors.First(p => p.Category == "AES").Decrypt(cipherTextAES);
var resultDES = _cryptors.First(p => p.Category == "DES").Decrypt(cipherTextDES);
var resultRSA = _cryptors.First(p => p.Category == "RSA").Decrypt(cipherTextRSA);
var hashMD5 = _hasher.MD5(plainText);
var hashSH1 = _hasher.SHA1(plainText);
var hashSH256 = _hasher.SHA256(plainText);
var hashSH384 = _hasher.SHA384(plainText);
var hashSH512 = _hasher.SHA512(plainText);
// use by static method
cipherTextAES = AES.Encrypt("your key", plainText);
cipherTextDES = DES.Encrypt("your key", plainText);
cipherTextRSA = RSA.Encrypt("your RSA public key", plainText);
resultAES = AES.Decrypt("your key", plainText);
resultDES = DES.Decrypt("your key", plainText);
resultRSA = RSA.Decrypt("your RSA private key", plainText);
hashMD5 = Hash.MD5("your key", plainText);
hashSH1 = Hash.SHA1("your key", plainText);
hashSH256 = Hash.SHA256("your key", plainText);
hashSH384 = Hash.SHA384("your key", plainText);
hashSH512 = Hash.SHA512("your key", plainText);
var signed = RSA.Sign("your RSA private key", plainText);
var verifyResult = RSA.Verify("your RSA public key", signed, plainText);
return Ok();
}
}
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 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 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Portable.BouncyCastle (>= 1.9.0)
-
net7.0
- Portable.BouncyCastle (>= 1.9.0)
-
net8.0
- Portable.BouncyCastle (>= 1.9.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on iCat.Crypto:
Package | Downloads |
---|---|
iCat.Token
iCat Token processor, integrated generator and validator |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 201 | 12/31/2023 |
Version 1.0.0