In
public key infrastructure
A public key infrastructure (PKI) is a set of roles, policies, hardware, software and procedures needed to create, manage, distribute, use, store and revoke digital certificates and manage public-key encryption. The purpose of a PKI is to facil ...
(PKI) systems, a certificate signing request (also CSR or certification request) is a message sent from an applicant to a
certificate authority
In cryptography, a certificate authority or certification authority (CA) is an entity that stores, signs, and issues digital certificates. A digital certificate certifies the ownership of a public key by the named subject of the certificate. Th ...
of the
public key infrastructure
A public key infrastructure (PKI) is a set of roles, policies, hardware, software and procedures needed to create, manage, distribute, use, store and revoke digital certificates and manage public-key encryption. The purpose of a PKI is to facil ...
in order to apply for a
digital identity certificate. It usually contains the public key for which the certificate should be issued, identifying information (such as a domain name) and a proof of authenticity including integrity protection (e.g., a digital signature). The most common format for CSRs is the
PKCS #10 specification;
others include the more capable
CRMF
and the Signed Public Key and Challenge
SPKAC format generated by some
web browser
A web browser is application software for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's screen. Browsers are used on ...
s.
Procedure
Before creating a CSR for an
X.509 certificate, the applicant first generates a
key pair, keeping the
private key
Public-key cryptography, or asymmetric cryptography, is the field of cryptographic systems that use pairs of related keys. Each key pair consists of a public key and a corresponding private key. Key pairs are generated with cryptographic alg ...
secret. The CSR contains information identifying the applicant (such as a
distinguished name), the
public key
Public-key cryptography, or asymmetric cryptography, is the field of cryptographic systems that use pairs of related keys. Each key pair consists of a public key and a corresponding private key. Key pairs are generated with cryptographic a ...
chosen by the applicant, and possibly further information. When using the PKCS #10 format, the request must be self-signed using the applicant's
private key
Public-key cryptography, or asymmetric cryptography, is the field of cryptographic systems that use pairs of related keys. Each key pair consists of a public key and a corresponding private key. Key pairs are generated with cryptographic alg ...
, which provides proof-of-possession of the private key but limits the use of this format to keys that can be used for signing. The CSR should be accompanied by a proof of origin (i.e., proof of identity of the applicant) that is required by the certificate authority, and the certificate authority may contact the applicant for further information.
Typical information required in a CSR (sample column from
sample X.509 certificate). Note that there are often alternatives for the Distinguished Names (DN), the preferred value is listed.
If the request is successful, the certificate authority will send back an identity certificate that has been digitally signed using the private key of the certificate authority.
Structure of a PKCS #10 CSR
A certification request in PKCS #10 format consists of three main parts: the certification request information, a signature algorithm identifier, and a digital signature on the certification request information. The first part contains the significant information, including the public key. The signature by the requester prevents an entity from requesting a bogus certificate of someone else's public key.
[ - PKCS #10: Certification Request Syntax Specification Version 1.7] Thus the private key is needed to produce a PKCS #10 CSR, but it is not part of, the CSR.
CSR for personal ID certificates and signing certificates must have the email address of the ID holder or name of organisation in case of business ID.
The first part, ASN.1 type ''CertificationRequestInfo'', consists of a version number (which is 0 for all known versions, 1.0, 1.5, and 1.7 of the specifications), the subject name, the public key (algorithm identifier + bit string), and a collection of attributes providing additional information about the subject of the certificate. The attributes can contain required certificate extensions, a challenge-password to restrict revocations, as well as any additional information about the subject of the certificate, possibly including local or future types.
Example of a PKCS #10 CSR
The PKCS#10
standard Standard may refer to:
Symbols
* Colours, standards and guidons, kinds of military signs
* Standard (emblem), a type of a large symbol or emblem used for identification
Norms, conventions or requirements
* Standard (metrology), an object ...
defines a binary format for encoding CSRs for use with
X.509. It is expressed in
ASN.1
Abstract Syntax Notation One (ASN.1) is a standard interface description language for defining data structures that can be serialized and deserialized in a cross-platform way. It is broadly used in telecommunications and computer networking, an ...
. Here is an example of how you can examine its ASN.1 structure using
OpenSSL
OpenSSL is a software library for applications that provide secure communications over computer networks against eavesdropping or need to identify the party at the other end. It is widely used by Internet servers, including the majority of HT ...
:
openssl asn1parse -i -in ''your_request''
A CSR may be represented as a
Base64
In computer programming, Base64 is a group of binary-to-text encoding schemes that represent binary data (more specifically, a sequence of 8-bit bytes) in sequences of 24 bits that can be represented by four 6-bit Base64 digits.
Common to all bina ...
encoded PKCS#10; an example of which is
given below:
The above certificate signing request's ASN.1 structure (as parsed by openssl) appears as the following, where the first number is the byte offset, d=depth, hl=header length of the current type, l=length of content:
0:d=0 hl=4 l= 716 cons: SEQUENCE
4:d=1 hl=4 l= 436 cons: SEQUENCE
8:d=2 hl=2 l= 1 prim: INTEGER :00
11:d=2 hl=3 l= 134 cons: SEQUENCE
14:d=3 hl=2 l= 11 cons: SET
16:d=4 hl=2 l= 9 cons: SEQUENCE
18:d=5 hl=2 l= 3 prim: OBJECT :countryName
23:d=5 hl=2 l= 2 prim: PRINTABLESTRING :EN
27:d=3 hl=2 l= 13 cons: SET
29:d=4 hl=2 l= 11 cons: SEQUENCE
31:d=5 hl=2 l= 3 prim: OBJECT :stateOrProvinceName
36:d=5 hl=2 l= 4 prim: UTF8STRING :none
42:d=3 hl=2 l= 13 cons: SET
44:d=4 hl=2 l= 11 cons: SEQUENCE
46:d=5 hl=2 l= 3 prim: OBJECT :localityName
51:d=5 hl=2 l= 4 prim: UTF8STRING :none
57:d=3 hl=2 l= 18 cons: SET
59:d=4 hl=2 l= 16 cons: SEQUENCE
61:d=5 hl=2 l= 3 prim: OBJECT :organizationName
66:d=5 hl=2 l= 9 prim: UTF8STRING :Wikipedia
77:d=3 hl=2 l= 13 cons: SET
79:d=4 hl=2 l= 11 cons: SEQUENCE
81:d=5 hl=2 l= 3 prim: OBJECT :organizationalUnitName
86:d=5 hl=2 l= 4 prim: UTF8STRING :none
92:d=3 hl=2 l= 24 cons: SET
94:d=4 hl=2 l= 22 cons: SEQUENCE
96:d=5 hl=2 l= 3 prim: OBJECT :commonName
101:d=5 hl=2 l= 15 prim: UTF8STRING :*.wikipedia.org
118:d=3 hl=2 l= 28 cons: SET
120:d=4 hl=2 l= 26 cons: SEQUENCE
122:d=5 hl=2 l= 9 prim: OBJECT :emailAddress
133:d=5 hl=2 l= 13 prim: IA5STRING :[email protected]
148:d=2 hl=4 l= 290 cons: SEQUENCE
152:d=3 hl=2 l= 13 cons: SEQUENCE
154:d=4 hl=2 l= 9 prim: OBJECT :rsaEncryption
165:d=4 hl=2 l= 0 prim: NULL
167:d=3 hl=4 l= 271 prim: BIT STRING
442:d=2 hl=2 l= 0 cons: cont 0
444:d=1 hl=2 l= 13 cons: SEQUENCE
446:d=2 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption
457:d=2 hl=2 l= 0 prim: NULL
459:d=1 hl=4 l= 257 prim: BIT STRING
This was generated by supplying the base64 encoding into the command
openssl asn1parse -in ''your_request'' -inform PEM -i
where PEM stands for
Privacy-Enhanced Mail
Privacy-Enhanced Mail (PEM) is a de facto file format for storing and sending cryptographic keys, certificates, and other data, based on a set of 1993 IETF standards defining "privacy-enhanced mail." While the original standards were never broadl ...
and describes the encoding of the ASN.1
Distinguished Encoding Rules X.690 is an ITU-T standard specifying several ASN.1 encoding formats:
* Basic Encoding Rules (BER)
* Canonical Encoding Rules (CER)
* Distinguished Encoding Rules (DER)
The Basic Encoding Rules (BER) were the original rules laid out by the AS ...
in base64.
See also
*
SPKAC
*
X.509
References
{{Cryptography navbox
Cryptography standards