Game Development Reference
In-Depth Information
who would discover flaws. Experts were hired to implement the algorithms pro-
vided in the .NET Class Framework, and it is advisable to use their implementa-
tions because they more than likely have a better understanding of encryption
than you do.
This chapter covers the encryption ciphers available in the .NET Class Framework,
how to implement encryption properly, and common pitfalls and issues when
securing data with encryption.
Encryption Rudiments
Encryption is a complex subject, and it is impossible to cover all aspects in a single
chapter. While still quite ambitious, in this chapter, I will attempt to summarize the
common characteristics of encryption and present a solution that takes care of the
majority of the underlying mechanisms and theory behind encryption. This chap-
ter will only cover the usage of algorithm implementations currently provided by
the .NET Class Framework, and not how to implement the algorithms yourself.
To fully understand this chapter and encryption in general, we must define a few
common characteristics and terms.
Public-Key Encryption
This type of encryption is commonly referred to as asymmetric encryption and
uses a public and private key pair to perform encryption or decryption of data.
The public key is available to everyone and is used to encrypt data that will be
decrypted by the owner of the private key. The private key is kept secure by the
owner and is used to decrypt data that has been encrypted with the public key.
Asymmetric encryption is generally only efficient on relatively small sets of data.
The .NET Class Framework contains two asymmetric encryption algorithms:
Digital Signature Algorithm (DSA) and RSA.
Private-Key Encryption
This type of encryption is commonly referred to as symmetric encryption and uses
a single key to perform encryption or decryption of data. The private key must be
kept safe from anyone other than the owner of the data.
Symmetric encryption is generally fast and can operate on large sets of data. The
.NET Class Framework contains four symmetric encryption algorithms: DES, Triple
DES, RC2, and Rijndael.