ythy / blog

Give everything a shot
6 stars 0 forks source link

Certificate File #217

Open ythy opened 5 years ago

ythy commented 5 years ago

Certificate X.509 Standard and DER/PEM Formats

Conclusions:

ythy commented 5 years ago

What is a certificate

A digitally signed statement that binds the value of a public key to the identity of the person, device, or service that holds the corresponding private key.

What does a certificate typically contain

ythy commented 5 years ago

X.509

X.509 is an standard for PKI (Public Key Infrastructure) in cryptography, which, amongst many other things, defines specific formats for PKC (Public Key Certificates) and the algorithm that verifies a given certificate path is valid under a give PKI (called the certification path validation algorithm).

A X.509 version 3 digital certificate has three main variables – the certificate, the certificate signature algorithm and the certificate signature.

ythy commented 5 years ago

CSR

This is a Certificate Signing Request. Some applications can generate these for submission to certificate-authorities. It includes some/all of the key details of the requested certificate such as subject, organization, state, whatnot, as well as the public key of the certificate to get signed. These get signed by the CA and a certificate is returned. The returned certificate is the public certificate (which includes the public key but not the private key), which itself can be in a couple of formats.

The request can be base64 encoded as shown below and is enclosed between —–BEGIN NEW CERTIFICATE REQUEST—– and —–END NEW CERTIFICATE REQUEST—–.

—–BEGIN NEW CERTIFICATE REQUEST—– 
MIIERDCCAywCAQAwZDELMAkGA1UEBhMCVVMxEjAQBgNVBAgTCUthcm5hdGFrYTES
MBAGA1UEBxMJQmFuZ2Fsb3JlMQswCQYDVQQKEwJNUzEMMAoGA1UECxMDQ1NTMRIw
EAYDVQQDEwlhbmdlbC0yazMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
AQC8se11hL7I+nqePXGWaT9FNS9LisDbzG8Cb4IKIrLOlvtF7emO4mUxOzmBtXr+
nbpJkwZoY3/u9/0j6jpI8Uwh/VuWhWe16pIU0T0FODKGXhBre4E7aVsE0HyC/DRL
tpkV2cQZPBmO5ZcXchLkh8H63aiBuqLH4kOZht3JGGllqa5GjPjShGYLAm7SqIJJ
jbLFnKNW8ztdUn8cZhQfDlzpykqTAPY5XBo064D6fspKziGqgMiqMAW7ZKhAHWkF
Yrzp/YJCXHkajU+s79tdL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