Private-Key Encryption
Private-key encryption algorithms use a single private key to encrypt and decrypt data. You must secure the key from access by unauthorized agents because any party that has the key can use it to decrypt data. Private-key encryption is also referred to as symmetric encryption because the same key is used for encryption and decryption. Private-key encryption algorithms are extremely fast (compared to public-key algorithms) and are well suited for performing cryptographic transformations on large streams of data.
Typically, private-key algorithms, called block ciphers, are used to encrypt one block of data at a time. Block ciphers (like RC2, DES, TrippleDES, and Rijndael) cryptographically transform an input block of n bytes into an output block of encrypted bytes. If you want to encrypt or decrypt a sequence of bytes, you have to do it block by block. Because the size of n is small (n = 8 bytes for RC2, DES, and TripleDES; n = 16 [the default]; n = 24; or n = 32 bytes for Rijndael), values larger than n have to be encrypted one block at a time.
The block cipher classes provided in the base class library use a chaining mode called cipher block chaining (CBC), which uses a key and an initialization vector (IV) to perform cryptographic transformations on data. For a given private key k, a simple block cipher that does not use an initialization vector will encrypt the same input block of plaintext into the same output block of ciphertext. If you have duplicate blocks within your plaintext stream, you will have duplicate blocks within your ciphertext stream. If an unauthorized user knows anything about the structure of a block of your plaintext, she can use that information to decipher the known ciphertext block and possibly recover your key. To combat this problem, information from the previous block is mixed into the process of encrypting the next block. Thus, the output of two identical plaintext blocks is different. Because this technique uses the previous block to encrypt the next block, an IV is used to encrypt the first block of data. Using this system, common message headers that might be known to an unauthorized user cannot be used to reverse engineer a key.
One way to compromise data encrypted with this type of cipher is to perform an exhaustive search of every possible key. Depending on the size of the key used to perform encryption, this type of search is extremely time consuming using even the fastest computers and is therefore unfeasible. Larger key sizes are more difficult to decipher. Though encryption does not make it theoretically impossible for an adversary to retrieve the encrypted data, it does raise the cost of doing so prohibitively. If it takes three months to perform an exhaustive search to retrieve data that is only meaningful for a few days, then the exhaustive search method is impractical.
The disadvantage of private-key encryption is that it presumes two parties have agreed on a key and IV and communicated their values. Also, the key must be kept secret from unauthorized users. Because of these problems, private-key encryption is often used in conjunction with public-key encryption to privately communicate the values of the key and IV.
Assuming that Alice and Bob are two parties who wish to communicate over an insecure channel, they might use private-key encryption as follows. Both Alice and Bob agree to use one particular algorithm (Rijndael, for example) with a particular key and IV. Alice composes a message and creates a network stream on which to send the message. Next she encrypts the text using the key and IV, and sends it across the Internet. She does not send the key and IV to Bob. Bob receives the encrypted text and decrypts it using the previously agreed upon key and IV. If the transmission is intercepted, the interceptor cannot recover the original message because he doesn't know the key or IV. In this scenario, the key must remain secret, but the IV does not need to remain secret. In a real world scenario, either Alice or Bob generate a private key and use public-key (asymmetric) encryption to transfer the private (symmetric) key to the other party. For more information, see Public-Key Encryption.
The .NET Framework provides the following classes that implement private key encryption algorithms:
--DESCryptoServiceProvider
--RC2CryptoServiceProvider
--RijndaelManaged
--TripleDESCryptoServiceProvider
(Source: .NET Framework SDK, "Cryptography Overview", ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconcryptographyoverview.htm)
没有合适的资源?快使用搜索试试~ 我知道了~
101个C#例子[示例源码]
共2000个文件
resources:524个
cs:508个
exe:372个
需积分: 9 38 下载量 3 浏览量
2018-02-27
08:57:00
上传
评论 1
收藏 6.17MB 7Z 举报
温馨提示
学习C#的各种例子,包括数据库、窗体、控件、GDI、多线程、序列化、文件读写等等,是学习C#的入门级源码
资源推荐
资源详情
资源评论
收起资源包目录
101个C#例子[示例源码] (2000个子文件)
Global.asax 96B
Global.asax 93B
Global.asax 92B
Global.asax 88B
Global.asax 88B
Global.asax 66B
Global.asax 66B
ImageService.asmx 88B
main.asmx 72B
main.aspx 6KB
main.aspx 4KB
main.aspx 3KB
main.aspx 2KB
main.aspx 2KB
ReceiveImage.aspx 2KB
SendData.aspx 2KB
ReceiveData.aspx 2KB
about.aspx 1KB
about.aspx 1KB
about.aspx 1KB
about.aspx 1KB
about.aspx 1KB
PassText.aspx 1005B
Default.aspx 596B
imagestrip.bmp 46KB
imagestrip.bmp 46KB
EXE.BMP 246B
CLSDFOLD.BMP 246B
OPENFOLD.BMP 246B
35FLOPPY.BMP 246B
DOC.BMP 246B
ResolveAssemblyReference.cache 8KB
ResolveAssemblyReference.cache 7KB
ResolveAssemblyReference.cache 5KB
ResolveAssemblyReference.cache 4KB
ResolveAssemblyReference.cache 4KB
ResolveAssemblyReference.cache 4KB
ResolveAssemblyReference.cache 3KB
ResolveAssemblyReference.cache 3KB
ResolveAssemblyReference.cache 3KB
ResolveAssemblyReference.cache 3KB
ResolveAssemblyReference.cache 3KB
ResolveAssemblyReference.cache 3KB
How-To Office Automation.csproj.ResolveComReference.cache 1KB
How-To Create an Explorer-Style Application.csproj.GenerateResource.Cache 1KB
How-To Create an Explorer-Style Application.csproj.GenerateResource.Cache 1KB
XMLDocumentationTool.csproj.GenerateResource.Cache 1KB
How-To Work with Resource Files.csproj.GenerateResource.Cache 1KB
How-To Work with Resource Files.csproj.GenerateResource.Cache 1KB
How-To Validating TextBoxes.csproj.GenerateResource.Cache 1KB
How-To Validating TextBoxes.csproj.GenerateResource.Cache 1KB
How-To Forms Inheritance.csproj.GenerateResource.Cache 1KB
How-To Forms Inheritance.csproj.GenerateResource.Cache 1KB
How-To Owner Drawn Menus.csproj.GenerateResource.Cache 1KB
How-To Owner Drawn Menus.csproj.GenerateResource.Cache 1KB
How-To Use the EventLog.csproj.GenerateResource.Cache 1KB
How-To Use the EventLog.csproj.GenerateResource.Cache 1KB
How-To ShellEx API Functionality.csproj.GenerateResource.Cache 967B
How-To ShellEx API Functionality.csproj.GenerateResource.Cache 967B
How-To Use Regular Expressions.csproj.GenerateResource.Cache 966B
How-To Use Regular Expressions.csproj.GenerateResource.Cache 966B
How-To Crystal Reports Print Preview.csproj.GenerateResource.Cache 966B
How-To Crystal Reports Print Preview.csproj.GenerateResource.Cache 966B
How-To Benefits.csproj.GenerateResource.Cache 965B
How-To Benefits.csproj.GenerateResource.Cache 965B
HowToUseSimpleWebControls.csproj.GenerateResource.Cache 905B
How-To Multithreading.csproj.GenerateResource.Cache 905B
How-To Multithreading.csproj.GenerateResource.Cache 905B
How-To Sockets Client.csproj.GenerateResource.Cache 904B
How-To Sockets Client.csproj.GenerateResource.Cache 904B
How-To Dynamic Control Creation.csproj.GenerateResource.Cache 903B
How-To Dynamic Control Creation.csproj.GenerateResource.Cache 903B
How-To Windows Role-Based Security.csproj.GenerateResource.Cache 902B
How-To Windows Role-Based Security.csproj.GenerateResource.Cache 902B
How-To Arrays.csproj.GenerateResource.Cache 901B
How-To Arrays.csproj.GenerateResource.Cache 901B
How-To Process Viewer.csproj.GenerateResource.Cache 900B
How-To Process Viewer.csproj.GenerateResource.Cache 900B
How-To ADO 2.6.csproj.GenerateResource.Cache 899B
How-To ADO 2.6.csproj.GenerateResource.Cache 899B
How-To DataGrid Sorting and Filtering.csproj.GenerateResource.Cache 899B
How-To Create Database.csproj.GenerateResource.Cache 899B
How-To DataGrid Sorting and Filtering.csproj.GenerateResource.Cache 899B
How-To Use Simple Windows Forms Controls.csproj.GenerateResource.Cache 899B
How-To Create Database.csproj.GenerateResource.Cache 899B
How-To Read-Write Images to Database.csproj.GenerateResource.Cache 899B
How-To Use Simple Windows Forms Controls.csproj.GenerateResource.Cache 899B
How-To DataGrid Formatting.csproj.GenerateResource.Cache 899B
How-To Data Binding with Navigation.csproj.GenerateResource.Cache 899B
How-To Data Binding with Navigation.csproj.GenerateResource.Cache 899B
How-To DataGrid Formatting.csproj.GenerateResource.Cache 899B
How-To Use Cryptographic Hash Algorithms.csproj.GenerateResource.Cache 899B
How-To Automate IE.csproj.GenerateResource.Cache 899B
How-To Sort and Filter with a DataView.csproj.GenerateResource.Cache 899B
How-To Bind Data to a ComboBox.csproj.GenerateResource.Cache 899B
How-To Bind Data to a ComboBox.csproj.GenerateResource.Cache 899B
How-To Automate IE.csproj.GenerateResource.Cache 899B
How-To Sample N-Tier Data Form App.csproj.GenerateResource.Cache 899B
How-To Use Stored Procedures.csproj.GenerateResource.Cache 899B
How-To Sort and Filter with a DataView.csproj.GenerateResource.Cache 899B
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
liguicd
- 粉丝: 66
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- unity读取excel工具 使用3.5即可
- Matplotlib 是一个 Python 的绘图库 Matplotlib 绘图指南与功能介绍.docx
- 基于TMS320F2808设计光伏并网发电模拟器AD09设计硬件(原理图 PCB)+CCS软件源码 +说明文档.zip
- 在微电网中采用粒子群算法在matlab环境下进行了仿真,最后给出了微网各微源的最优机组组合方式和最佳电能交易计划 (注释完全,可
- 在matlab中通过yalmip平台调用cplex求解器,可用于求解MILP问题,适合于综合能源系统优化求解(注释完全,可直接运
- MT8852B labview 驱动,MT8852B labview 代码,蓝牙测试仪MT8852B代码,蓝牙低功耗测试
- 导照片2.0(只适合索尼微单)
- KMP算法python代码实现与使用场景.docx
- 基于MATLABCPLEX 的机组最优组合,成功求解表格化,图示化的机组组合结果(注释完全,可直接运行)(文档加Matlab源码
- postgresql-9.5.3-1-windows-x64
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功