11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

174 Part III: Building Secure <strong>Web</strong> <strong>Application</strong>sCryptographyCryptography is one of the most important tools that you can use to protect data.Encryption can be used to provide data privacy <strong>and</strong> hash algorithms, which producea fixed <strong>and</strong> condensed representation of data, can be used to make data tamperproof.Also, digital signatures can be used for authentication purposes.You should use encryption when you want data to be secure in transit or in storage.Some encryption algorithms perform better than others while some provide strongerencryption. Typically, larger encryption key sizes increase security.Two of the most common mistakes made when using cryptography are developingyour own encryption algorithms <strong>and</strong> failing to secure your encryption keys.Encryption keys must be h<strong>and</strong>led with care. An attacker armed with your encryptionkey can gain access to your encrypted data.The main issues to consider are:● Use platform-provided cryptographic services● Key generation● Key storage● Key exchange● Key maintenanceUse Platform-provided Cryptographic ServicesDo not create your own cryptographic implementations. It is extremely unlikely thatthese implementations will be as secure as the industry st<strong>and</strong>ard algorithms providedby the platform; that is, the operating system <strong>and</strong> the .NET Framework. Managedcode should use the algorithms provided by the System.<strong>Security</strong>.Cryptographynamespace for encryption, decryption, hashing, r<strong>and</strong>om number generating, <strong>and</strong>digital signatures.Many of the types in this namespace wrap the operating system CryptoAPI, whileothers implement algorithms in managed code.Key GenerationThe following recommendations apply when you create encryption keys:●●●Generate r<strong>and</strong>om keys.Use PasswordDeriveBytes for password-based encryption.Prefer large keys.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!