Basics of web cryptography:
(1) Symmetric:
- DES - fixed length key of 56 bits.
- 3DES - fixed length key of 168 bits (112 effective)
- Blowfish - variable length key up to 448 bits. Fast and free.
- IDEA - fixed length key of 128 bits. Fast, patented, and free for non-commercial use.
- RC4 - keys can be anywhere from 1 to 2,048 bits long (40 and 128-bit key lengths are commonly used.) RC4 is very fast and in widespread use.
- AES - keys can be 128, 192, or 256 bits long. Chosen to replace DES and 3DES.
(2) Asymmetric:
- RSA (Rivest, Shamir, Adleman) - public-key cryptography system.
- DSA (Digital Signature Algorithm) -
- Eliptic Curve - a mathematically different approach to public-key encryption.
(3) Hashing:
- MD5 - produces 128-bit output from input of any length. Released as RFC-1321.
- SHA-1 - produces 160-bit output from input of any length.
- SHA-256, SHA-384, and SHA-512.
(4) Certificates:
- Self-signed certificates - useful in some instances.
- Certificates signed by a private CA - used only for inernal purposes among a limited circle of users. This is similar to employee passes.
- Certificates signed by a public CA -
(5) SSL
- SSL3.1 is the same as TLS 1.0 is defined in RFC-2246
- SSL requires one exlcusive IP address per we site.
- RFC-2817 defines a way to upgrade from non-SSL to SSL communication.
A client MAY offer to switch to secured operation during any clear
HTTP request when an unsecured response would be acceptable:
GET http://example.bank.com/acct_stat.html?749394889300 HTTP/1.1
Host: example.bank.com
Upgrade: TLS/1.0
Connection: Upgrade
In this case, the server MAY respond to the clear HTTP operation
normally, OR switch to secured operation (as detailed in the next
section).
- SSL is a hybrid protocol. Every SSL connections consists of essentially two phases:
(a) Handshake phase - during this phase, the server sends the client its certificate and the client verifies the server's identity using public-key cryptography. In some cases, the server also requires the client to have a certificate, and client verification is also performed. After server verification is complete, the client and server agree on a common set of encryption protocols and generate a set of private cryptography secret keys.
(b) Data-exchange phase - with secret keys agreed on and known to both parties, the communication resumes using fast symmetric encryption protocols until both parties agree to close down the communication channel.
- OpenSSL:
$ openssl s_client -host www.thawte.com -port 443
- to generate a private key
$ openssl genrsa -out server.key 1024
- to extract the public key from the private key
$ openssl rsa -in server.key -pubout
- to generate a certificate signing request (CSR)
$ openssl req -new -key server.key -out server.csr
- to sign your own certificate
$ openssl x509 -req -days 35 -in server.csr -signkey server.key -out server.crt
ServerName www.apachesecurity.net
DirectoryRoot /var/www/empty
RedirectPermanent / https://www.apachesecurity.net/
Named-based Virtual Hosting