certificates.txt 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <DRAFT!>
  2. HOWTO certificates
  3. 1. Introduction
  4. How you handle certificates depend a great deal on what your role is.
  5. Your role can be one or several of:
  6. - User of some client software
  7. - User of some server software
  8. - Certificate authority
  9. This file is for users who wish to get a certificate of their own.
  10. Certificate authorities should read ca.txt.
  11. In all the cases shown below, the standard configuration file, as
  12. compiled into openssl, will be used. You may find it in /etc/,
  13. /usr/local/ssl/ or somewhere else. The name is openssl.cnf, and
  14. is better described in another HOWTO <config.txt?>. If you want to
  15. use a different configuration file, use the argument '-config {file}'
  16. with the command shown below.
  17. 2. Relationship with keys
  18. Certificates are related to public key cryptography by containing a
  19. public key. To be useful, there must be a corresponding private key
  20. somewhere. With OpenSSL, public keys are easily derived from private
  21. keys, so before you create a certificate or a certificate request, you
  22. need to create a private key.
  23. Private keys are generated with 'openssl genrsa' if you want a RSA
  24. private key, or 'openssl gendsa' if you want a DSA private key.
  25. Further information on how to create private keys can be found in
  26. another HOWTO <keys.txt?>. The rest of this text assumes you have
  27. a private key in the file privkey.pem.
  28. 3. Creating a certificate request
  29. To create a certificate, you need to start with a certificate
  30. request (or, as some certificate authorities like to put
  31. it, "certificate signing request", since that's exactly what they do,
  32. they sign it and give you the result back, thus making it authentic
  33. according to their policies). A certificate request can then be sent
  34. to a certificate authority to get it signed into a certificate, or if
  35. you have your own certificate authority, you may sign it yourself, or
  36. if you need a self-signed certificate (because you just want a test
  37. certificate or because you are setting up your own CA).
  38. The certificate request is created like this:
  39. openssl req -new -key privkey.pem -out cert.csr
  40. Now, cert.csr can be sent to the certificate authority, if they can
  41. handle files in PEM format. If not, use the extra argument '-outform'
  42. followed by the keyword for the format to use (see another HOWTO
  43. <formats.txt?>). In some cases, that isn't sufficient and you will
  44. have to be more creative.
  45. When the certificate authority has then done the checks the need to
  46. do (and probably gotten payment from you), they will hand over your
  47. new certificate to you.
  48. Section 5 will tell you more on how to handle the certificate you
  49. received.
  50. 4. Creating a self-signed test certificate
  51. If you don't want to deal with another certificate authority, or just
  52. want to create a test certificate for yourself. This is similar to
  53. creating a certificate request, but creates a certificate instead of
  54. a certificate request. This is NOT the recommended way to create a
  55. CA certificate, see ca.txt.
  56. openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095
  57. 5. What to do with the certificate
  58. If you created everything yourself, or if the certificate authority
  59. was kind enough, your certificate is a raw DER thing in PEM format.
  60. Your key most definitely is if you have followed the examples above.
  61. However, some (most?) certificate authorities will encode them with
  62. things like PKCS7 or PKCS12, or something else. Depending on your
  63. applications, this may be perfectly OK, it all depends on what they
  64. know how to decode. If not, There are a number of OpenSSL tools to
  65. convert between some (most?) formats.
  66. So, depending on your application, you may have to convert your
  67. certificate and your key to various formats, most often also putting
  68. them together into one file. The ways to do this is described in
  69. another HOWTO <formats.txt?>, I will just mention the simplest case.
  70. In the case of a raw DER thing in PEM format, and assuming that's all
  71. right for yor applications, simply concatenating the certificate and
  72. the key into a new file and using that one should be enough. With
  73. some applications, you don't even have to do that.
  74. By now, you have your cetificate and your private key and can start
  75. using the software that depend on it.
  76. --
  77. Richard Levitte