infuerno.github.io

Pluralsight: Web API v2 Security

Overview

HTTP Security Primer

Transport security (securing over the wire)

Simplified SSL handshake

All the gory details: http://www.moserware.com/2009/06/first-few-milliseconds-of-https.html

Developers and SSL

If you Google SSL issues, you often get answers on how to ignore the errors. If you do this, it is like not using SSL at all - which can be very dangerous. e.g. don’t use the ServicePointManager API allows you to ignore all validation errors

Where to get Certificates from

  1. Buy a certificate - choose a popular provider e.g. Verisign - prove your identity, that you own the domain, pay some money - they will send you a certificate and the corresponding private key
    • implicitly trusted by all clients
    • zero configuration on the client side
    • pay money
  2. Corporate PKI - only for applications which are intranet facing or used by members of that company. Easy to set up using Windows Certificate Services.
  3. Create yourself - create own certificate infrastructure by building your own issuer and then creating your own certificates - uses makecert.exe (openssl can be used on a mac)

Creating a Root Certificate

The following will create a root certificate - in order to create other certificates. This approach means you only need to trust this certificate, and you will then trust all other certificates created from this.

makecert.exe
    -r                  // self signed
    -n "CN=DevRoot"     // name
    -pe                 // exportable
    -sv DevRoot.pvk     // name of private key file
    -a sha1             // hashing algorithm
    -len 2048           // key length
    -b 01/22/2010       // valid from
    -e 01/22/2030       // valid to
    -cy authority       // certificate type
    DevRoot.cer         // name of certificate file

Creating an SSL Certificate

makecert.exe
    -iv DevRoot.pvk     // file name of the root private key
    -ic DevRoot.cer     // file name of the root cer
    -n "CN=DevRoot"     // name
    -pe                 // exportable
    -sv web.local.pvk   // name of private key file
    -a sha1             // hashing algorithm
    -len 2048           // key length
    -b 01/22/2010       // valid from
    -e 01/22/2030       // valid to
    -sky exchange       // certificate type
    web.local.cer       // name of certificate file
    -eku 1.3.6.1.5.5.7.3.1 // extended key usage

HTTP authentication framework (how do you submit credentials)