Online Book Reader

Home Category

Apache Security - Ivan Ristic [53]

By Root 1918 0
Signing Request

The next step is to create a certificate-signing request (CSR). This is a formal request asking a certificate authority to sign a certificate, and it contains the public key of the entity requesting the certificate and information about the entity. The information becomes part of the certificate.

CSR creation is an interactive process, which takes the private server key as input. Read the instructions given by the openssl tool carefully: if you want a field to be empty, you must enter a single dot (.) and not just press Return because doing so would populate the field with the default value.

# openssl req -new -key server.key -out server.csr

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) [GB]:

State or Province Name (full name) [Berkshire]:.

Locality Name (eg, city) [Newbury]:London

Organization Name (eg, company) [My Company Ltd]:Apache Security

Organizational Unit Name (eg, section) [ ]:.

Common Name (eg, your name or your server's hostname) [ ]:

www.apachesecurity.net

Email Address [ ]:webmaster@apachesecurity.net

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password [ ]:

An optional company name [ ]:

After a CSR is generated, you use it to sign your own certificate and/or send it to a public CA and ask him to sign the certificate. Both approaches are described in the sections that follow.

Signing Your Own Certificate

For testing purposes, you should sign your own certificate; it may be days before the CA completes the certificate generation process. You have the files you need: the CSR and the private key. The x509 command with the -req switch creates a self-signed certificate. Other switches on the following command line instruct openssl to create a certificate valid for 365 days using the private key specified in server.key:

# openssl x509 -req -days 365 -in server.csr \

> -signkey server.key -out server.crt

Signature ok

subject=/C=GB/L=London/O=Apache

Security/CN=www.apachesecurity.net/emailAddress=webmaster@apachesecurity.net

Getting Private key

Use the x509 command to examine the contents of the certificate you have created:

# openssl x509 -text -in server.crt

Certificate:

Data:

Version: 1 (0x0)

Serial Number: 0 (0x0)

Signature Algorithm: md5WithRSAEncryption

Issuer: C=GB, L=London, O=Apache Security,

CN=www.apachesecurity.net/emailAddress=webmaster@apachesecurity.net

Validity

Not Before: Jul 26 13:36:34 2004 GMT

Not After : Jul 26 13:36:34 2005 GMT

Subject: C=GB, L=London, O=Apache Security,

CN=www.apachesecurity.net/emailAddress=webmaster@apachesecurity.net

Subject Public Key Info:

Public Key Algorithm: rsaEncryption

RSA Public Key: (1024 bit)

Modulus (1024 bit):

00:d0:b6:1e:63:f1:39:9c:17:d2:56:97:e9:6d:0d:

a5:a1:de:80:6b:66:f9:62:53:91:43:bf:b9:ff:57:

b3:54:0b:89:34:3e:93:5f:46:bc:74:f8:88:92:bd:

3c:0a:bb:43:b4:57:81:e7:aa:b6:f0:3f:e7:70:bf:

84:2e:04:aa:05:61:fb:c9:f7:65:9a:95:23:d7:24:

97:75:6e:14:dc:94:48:c0:cd:7b:c7:2e:5b:8c:ad:

ad:db:6c:ab:c4:dd:a3:90:5b:84:4f:94:6c:eb:6e:

93:f4:0f:f9:76:9f:70:94:5e:99:12:15:8f:b7:d8:

f0:ff:db:f6:ee:0c:85:44:43

Exponent: 65537 (0x10001)

Signature Algorithm: md5WithRSAEncryption

9e:3b:59:a4:89:7e:30:c7:b3:3d:82:ea:3e:f5:99:4a:e9:b2:

53:25:9f:04:66:e0:b7:43:47:48:a2:b9:27:bc:b6:37:bb:6a:

2f:66:d2:58:bf:b8:50:19:4f:7f:51:54:ba:a9:c9:8a:3c:70:

25:0d:29:d1:af:78:f2:3a:0b:74:de:a6:36:c1:f8:f9:6c:b2:

9d:4e:f5:3a:e6:87:99:99:b9:c6:25:33:c2:84:4e:81:e8:b3:

e4:e3:5b:20:1e:09:3c:b3:60:88:90:1c:a2:29:dd:91:25:3e:

cb:44:55:97:9e:96:97:52:49:38:77:03:0d:59:b8:7d:4f:32:

44:45

-----BEGIN CERTIFICATE-----

MIICfTCCAeYCAQAwDQYJKoZIhvcNAQEEBQAwgYYxCzAJBgNVBAYTAkdCMQ8wDQYD

VQQHEwZMb25kb24xGDAWBgNVBAoTD0FwYWNoZSBTZWN1cml0eTEfMB0GA1UEAxMW

Return Main Page Previous Page Next Page

®Online Book Reader