本文转自:https://www.example-code.com/dotnet-core/crypt2_aes.asp

Chilkat.Crypt2 crypt = new Chilkat.Crypt2();

bool success = crypt.UnlockComponent("Anything for 30-day trial");
if (success != true) {
Console.WriteLine(crypt.LastErrorText);
return;
} // AES is also known as Rijndael.
crypt.CryptAlgorithm = "aes"; // CipherMode may be "ecb", "cbc", "ofb", "cfb", "gcm", etc.
// Note: Check the online reference documentation to see the Chilkat versions
// when certain cipher modes were introduced.
crypt.CipherMode = "cbc"; // KeyLength may be 128, 192, 256
crypt.KeyLength = ; // The padding scheme determines the contents of the bytes
// that are added to pad the result to a multiple of the
// encryption algorithm's block size. AES has a block
// size of 16 bytes, so encrypted output is always
// a multiple of 16.
crypt.PaddingScheme = ; // EncodingMode specifies the encoding of the output for
// encryption, and the input for decryption.
// It may be "hex", "url", "base64", or "quoted-printable".
crypt.EncodingMode = "hex"; // An initialization vector is required if using CBC mode.
// ECB mode does not use an IV.
// The length of the IV is equal to the algorithm's block size.
// It is NOT equal to the length of the key.
string ivHex = "000102030405060708090A0B0C0D0E0F";
crypt.SetEncodedIV(ivHex,"hex"); // The secret key must equal the size of the key. For
// 256-bit encryption, the binary secret key is 32 bytes.
// For 128-bit encryption, the binary secret key is 16 bytes.
string keyHex = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F";
crypt.SetEncodedKey(keyHex,"hex"); // Encrypt a string...
// The input string is 44 ANSI characters (i.e. 44 bytes), so
// the output should be 48 bytes (a multiple of 16).
// Because the output is a hex string, it should
// be 96 characters long (2 chars per byte).
string encStr = crypt.EncryptStringENC("The quick brown fox jumps over the lazy dog.");
Console.WriteLine(encStr); // Now decrypt:
string decStr = crypt.DecryptStringENC(encStr);
Console.WriteLine(decStr);

[转](.NET Core C#) AES Encryption的更多相关文章

  1. AES encryption of files (and strings) in java with randomization of IV (initialization vector)

    http://siberean.livejournal.com/14788.html Java encryption-decryption examples, I've seen so far in ...

  2. [JavaSecurity] - AES Encryption

    1. AES Algorithm The Advanced Encryption Standard (AES), also as known as Rijndael (its original nam ...

  3. AES加密 C++调用Crypto++加密库 样例

    这阵子写了一些数据加密的小程序,对照了好几种算法后,选择了AES,高级加密标准(英语:Advanced Encryption Standard,缩写:AES).听这名字就非常厉害的样子 预计会搜索到这 ...

  4. PHP的AES加密类

    PHP的AES加密类 aes.php <?php /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ...

  5. C++的AES加解密

    最近公司项目要做个WPF程序,但是底层加密部分要用C++来实现.通过网上搜索各种资料,地址已经记不下了,没发贴出来了! 下面看看如何加解密的~!先贴代码.... string tKey(sKey); ...

  6. Crypto++入门学习笔记(DES、AES、RSA、SHA-256)

    最先附上 下载地址 背景(只是个人感想,技术上不对后面的内容构成知识性障碍,可以skip): 最近,基于某些原因和需要,笔者需要去了解一下Crypto++库,然后对一些数据进行一些加密解密的操作. 笔 ...

  7. Windows10 VS2017 C++使用crypto++库加密解密(AES)

    参考文章: https://blog.csdn.net/tangcaijun/article/details/42110319 首先下载库: https://www.cryptopp.com/#dow ...

  8. AES Test vectors

    Table of content List of test vectors for AES/ECB encryption mode AES ECB 128-bit encryption mode AE ...

  9. aes加密/解密(转载)

    这篇文章是转载的康奈尔大学ece5760课程里边的一个final project,讲的比较通俗易懂,所以转载过来.附件里边是工程文件,需要注意一点,在用modelsim仿真过程中会出现错误,提示非法引 ...

随机推荐

  1. Hibernate学习第三天(2)(多对多关系映射)

    1.1.1      Hibernate多对多关系的配置 1.1.1.1   创建表 l   用户表 CREATE TABLE `sys_user` ( `user_id` bigint(32) NO ...

  2. 【ARC069F】Flags 2-sat+线段树优化建图+二分

    Description ​ 数轴上有 n 个旗子,第 ii 个可以插在坐标 xi或者 yi,最大化两两旗子之间的最小距离. Input ​ 第一行一个整数 N. ​ 接下来 N 行每行两个整数 xi, ...

  3. linux系统安全及应用——账号安全(基本安全措施)

    不开启桌面可以减少受攻击面 一.系统账号清理 1)非登录用户的shell改为/sbin/nologin ~] #usermod -s /sbin/nologin user1 2)锁定长期不用的账号 锁 ...

  4. input 和 select

    var source = $('input[name="source"]:checked').val(); var completenum = $("#completen ...

  5. AtCoder - 2568 最小割

    There is a pond with a rectangular shape. The pond is divided into a grid with H rows and W columns ...

  6. 消息队列 简单demo

    可以使用Windows自带计划任务执行Receive操作. 控制面板=>管理工具 计划任务 =>创建计划任务 step : http://www.2cto.com/kf/201402/27 ...

  7. Tomcat 连接数与线程池详解

    前言 在使用tomcat时,经常会遇到连接数.线程数之类的配置问题,要真正理解这些概念,必须先了解Tomcat的连接器(Connector). 在前面的文章 详解Tomcat配置文件server.xm ...

  8. QT中QWidget、QDialog以及MainWindow的区别

    参考 http://blog.csdn.net/u011619422/article/details/47311101 QT中QWidget.QDialog以及MainWindow的区别 QWidge ...

  9. promise的一个简单易懂实例

    Promise: <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...

  10. P4578 [FJOI2018]所罗门王的宝藏

    传送门 考虑一个位置答案传递性,如果某个位置的红宝石转动确定了,那么会引起连锁反应: 如图,绿色的转动确定了,那么那两个蓝色的转动也确定了 自己手玩一下,发现如果有解那么随便找一个开始然后一路玩下去最 ...