The OpenSSL Project has developed a open source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security TLS (v1) protocols as well as a full-strength general purpose cryptography library.

OpenSSL is based on the SSLeay library developed by Eric A. Young and Tim J. Hudson. The OpenSSL toolkit is licensed under an Apache-style licence, which basically means that you are free to get and use it for commercial and non-commercial purposes subject to some simple license conditions.

The OpenSSL toolkit can be used to generate the keys that a web server (e.g. Apache) needs to encrypt the data sent between the client (browser) and the web server.
A simple overview of this process can be found here below:
  • A client browser connects to the Apache HTTP server via a Web request.

  • The browser asks to start a secure session with the server.

  • The server returns the site's certificate (= mobilefish.com_cert.pem) which also includes the server public key.

  • The browser analyzes the certificate and informs the user about its validity (e.g., was it issued by a recognized, trusted certificate authority?).

  • The browser creates a session key, which is encrypted with the server's public key, which is then sent to the server. This public or asymmetric key is generally 1024 bits. Much stronger public keys of 2048 bits could be provided but, perhaps for performance reasons, these are not in general use.

  • The server then decrypts this information using its private key (mobilefish.com_key.pem).

  • Both the browser and the server now are using the same session key. This is a symmetric key used to encrypt and decrypt data exchanged by the browser and server. Browsers and servers usually negotiate the strongest mutually supported session. This means that if the user's browser and your Web server both support 128-bit SSL sessions, a 128-bit session is established. If the user's browser only supports 40-bit SSL sessions, then a 40-bit session is established even if your Web server supports 128-bit sessions.

More information about the OpenSSL Project can be found at:

The latest OpenSSL version (no binary distributions) can be downloaded from:

Links to OpenSSL binary distributions can be found at:

Create self signed certificate and private key.

In order for a web server to use SSL a SSL Certificate is required (also known as Web Server Certificates and Secure Server Certificates). SSL Certificates are installed onto the web server hosting the particular website and allow access to the security functionality of the web server itself.

You can implement SSL in either 40-bit and 128-bit encryption, (40-bit and 128-bit refer to the size of the session key). A session key is a pair of secret words that a server and client share; these keys are used in the encryption process of every SSL session. Mathematically speaking, the longer the session key, the harder it is to break the encryption of the SSL session and read the transmitted data.

Operating system used
Windows XP Home Edition Version 5.1 SP 2

Software prerequisites
OpenSSL v0.9.7d or higher

  1. Open a dos window and goto OpenSSL bin directory:
    e.g.: cd C:\Tools\openssl\bin

  2. Generate a RSA private key:
    C:\Tools\OpenSSL\bin>openssl genrsa -out key.pem 1024

    You should see and do the following:

    Loading 'screen' into random state - done
    Generating RSA private key, 1024 bit long modulus
    e is 65537 (0x10001)

    Item Remark
    1024 In this example a 1024 bit RSA private key is created.

    The private key sizes for SSL must be either 512 or 1024 for compatibility with certain web browsers. A keysize of 1024 bits is recommended because keys larger than 1024 bits are incompatible with some versions of Netscape Navigator and Microsoft Internet Explorer, and with other browsers that use RSA's BSAFE cryptography toolkit.
    key.pem In this example the private key is called "key.pem".

    Note: If you want to be more secure, create a 1024 bit key and encrypt it using
              the triple-DES cipher. Instead of issuing above command, enter the following:
              openssl genrsa -des3 -out enc_key.pem 1024
              During creation of the private key you are asked to enter a pass phrase.

  3. The file C:\Tools\OpenSSL\bin\key.pem is created.

  4. To view the content of the key.pem:
    C:\Tools\OpenSSL\bin>openssl rsa -noout -text -in key.pem

    You should see the following:

    Private-Key: (1024 bit)
    publicExponent: 65537 (0x10001)

    The numbers prime1 (p) and prime2 (q) are randomly chosen large prime numbers.
    The public modulus (n) is calculated by multiplying the prime numbers n=p*q.
    The strength of a RSA key actually refers to the bit length of the public modulus.

    The prime numbers should never be disclosed!
    The publicExponent (e) is a small randomly chosen integer (in practice is usually either 3 or 65537) such that it and (p-1)*(q-1) are relatively prime.
    Two numbers are relatively prime if they share no factors than one; they may or may not actually be prime.

    Using e, p, and q, the value of d is computed.

    The n and e members are the public key, and the d member is the private key.

  5. Create a Certificate Signing Request (CSR) with the RSA private key.
    Please note that the following characters can not be accepted:

    <   >   ~   !  @   #   $   %   ^   *   /   \   (   )   ?   .   ,  &

    openssl req -new -key key.pem -out req.pem

    You should see the following:

    You are about to be asked to enter information that will be incorporated
    into your certificate request.
    What you are about to enter is what is called a Distinguished Name or a DN.
    There are quite a few fields but you can leave some blank
    For some fields there will be a default value,
    If you enter '.', the field will be left blank.
    Country Name (2 letter code) [AU]:NL
    State or Province Name (full name) [Some-State]:Noord-Holland
    Locality Name (eg, city) []:Zaandam
    Organization Name (eg, company) [Internet Widgits Pty Ltd]
    Organizational Unit Name (eg, section) []:
    Common Name (eg, YOUR name) []:
    Email Address []:

    Please enter the following 'extra' attributes
    to be sent with your certificate request
    A challenge password []:
    An optional company name []:

    Note: The Certificate Signing Request (CSR) includes the public key.

    DN Field Remark
    Country Name The two-letter ISO 3166 abbreviation for your country.
    State or Province Name. The state or province where your organization is legally located. Do not abbreviate.

    In this example: Noord-Holland
    Locality Name The city where your organization is legally located. Do not abbreviate.

    In this example: Zaandam
    Organization Name The exact legal name of your organization. Do not abbreviate your organization name.

    In this example:
    Organization Unit Name Section of the organization. does not have any organizational units but in yours it maybe Marketing, Research and Development, Human Resources, Sales
    Common Name The fully qualified domain name for your web server. This must be an exact match.

    In this example the url will be used. The common name must be:
    Email Address Enter your organization general email address.

    In this example
    Challenge password and optional company name Leave both fields empty.

  6. The file C:\Tools\OpenSSL\bin\req.pem is created.

  7. Now create a self signed certificate which means no Root Certificate Authority has signed this certificate:

    openssl req -x509 -key key.pem -in req.pem -out cert.pem -days 365

  8. The file C:\Tools\OpenSSL\bin\cert.pem is created.

  9. The certificate (cert.pem) and private key (key.pem) are now both created and can be used to setup SSL for the web server. It is recommended to rename these files:

    cert.pem into mobilefish.com_cert.pem
    key.pem into mobilefish.com_key.pem

    More information on how to setup SSL for Apache 2 on Windows XP.

    To give you a preview of how the self signed certificate looks like:
    Unfortunately all text are in ducth.

    Certificate self signed General

    Certificate self signed Details

    Certificate self signed Path

  10. Instead of using the OpenSSL tool, provides a free service to create self-signed SSL certificates online.