Skip to content

candyjun/CandyJun.Aes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CandyJun.Aes

A .Core AES extensions.

  • 1.Extensions of RSA
  • 2.Compatible with Java
  • 3.BC model provide more than .net CLI

Thanks for bcgit's bc-csharp

Latest version

Install

Install-Package CandyJun.Aes

Demo

Init Aes

var aes = System.Security.Cryptography.Aes.Create();
aes.Mode = CipherMode.ECB;
aes.Padding = PaddingMode.PKCS7;
aes.BlockSize = 128;
//Generate key equal java SecureRandom (double SHA1)
aes.GenerateKey(8);
aes.GenerateIV(8);

Encrypt with csharp system library and BC library

var source = "test";
//Encrypt with csharp system library
var encCsharp = aes.Encrypt(source);

//Encrypt with BC library,params as string
var encBC = aes.EncryptBC(source, "AES/ECB/PKCS7");

Decrypt with csharp system library and BC library

//Decrypt with csharp system library
var strCsharp = aes.Decrypt(encCsharp, mode: CipherMode.ECB);

//Decrypt with BC library,params as enum
var strBC = aes.DecryptBC(encCsharp, CipherModeBC.ECB, CipherPaddingBC.PKCS7);

Reference component

bc-csharp - bcgit

Change Log

v1.0.0

Features

  • Add project