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)
没有合适的资源?快使用搜索试试~ 我知道了~
101C#Examples
共2000个文件
resources:524个
cs:508个
exe:372个
需积分: 0 4 下载量 59 浏览量
2009-11-26
14:59:40
上传
评论
收藏 18.69MB RAR 举报
温馨提示
101C#Examples Vs 2008 的一些C# 的例子,比较不错的小例子 微软的。 在CSDN上留做备份
资源推荐
资源详情
资源评论
收起资源包目录
101C#Examples (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
CLSDFOLD.BMP 246B
DOC.BMP 246B
OPENFOLD.BMP 246B
EXE.BMP 246B
35FLOPPY.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 Use Simple Windows Forms Controls.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 Create Database.csproj.GenerateResource.Cache 899B
How-To Read-Write Images to Database.csproj.GenerateResource.Cache 899B
How-To Use Custom DataBinding Format Handlers.csproj.GenerateResource.Cache 899B
How-To Use Custom DataBinding Format Handlers.csproj.GenerateResource.Cache 899B
How-To Read-Write Images to Database.csproj.GenerateResource.Cache 899B
How-To Build a Master-Details Windows Forms App.csproj.GenerateResource.Cache 899B
How-To Build a Master-Details Windows Forms App.csproj.GenerateResource.Cache 899B
How-To Retrieve and Process Data Using a DataReader.csproj.GenerateResource.Cache 899B
How-To Retrieve and Process Data Using a DataReader.csproj.GenerateResource.Cache 899B
How-To Typed Dataset.csproj.GenerateResource.Cache 899B
How-To Typed Dataset.csproj.GenerateResource.Cache 899B
How-To Create a Data Entry Form.csproj.GenerateResource.Cache 899B
How-To Create a Data Entry Form.csproj.GenerateResource.Cache 899B
How-To DataGrid Sorting and Filtering.csproj.GenerateResource.Cache 899B
How-To DataGrid Sorting and Filtering.csproj.GenerateResource.Cache 899B
How-To DataGrid Formatting.csproj.GenerateResource.Cache 899B
How-To DataGrid Formatting.csproj.GenerateResource.Cache 899B
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
诺莲爸爸
- 粉丝: 558
- 资源: 80
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功