Revize 348a4758
Přidáno uživatelem Michal Seják před asi 4 roky(ů)
- ID 348a475852ac9024878248588b263930266fa4e8
- Rodič 02c4d11b
doc/README.txt | ||
---|---|---|
1 |
general info (creating CA, CA chain, certificate key usage setup) -> https://gist.github.com/Soarez/9688998 |
|
2 |
ocsp (ocsp server), certificate revocation -> https://bhashineen.medium.com/create-your-own-ocsp-server-ffb212df8e63 |
src/cert/root.key | ||
---|---|---|
1 |
-----BEGIN RSA PRIVATE KEY----- |
|
2 |
Proc-Type: 4,ENCRYPTED |
|
3 |
DEK-Info: DES-EDE3-CBC,639D2F92AFFD3C68 |
|
4 |
|
|
5 |
ARokGwkac6+e4cozIQjgYhdYvh8SPfpltsFOIo9h5AI4g6WRVJ/ep1xWfz7Bctp6 |
|
6 |
+bPaxGLedA/GST0D26HlQdJJIXrx0X7FRaGgfCRKzbAed9XWUG/ebBJcRHor9L2I |
|
7 |
tCUxpZM1EoAEYaiIiQ7MnBCuCp+QQ1HhSISE/GAjw6YgzVrEaUZjbmSM5ycNelSp |
|
8 |
zAxde8AVJ2wb7laKNseheuXPtBFMulzhlhVNDxzOmUm5Tm/dVL8Ae+JtREVUWw9X |
|
9 |
egHTqC9c2pVTOGhjSla6P62EoOOLixzyUlKGhlsoiq18G6PfT2DVAv+fdO+H6uey |
|
10 |
4nH6/G7/YXVH9qeokKpTSvE8M8kOjzHeR3sGXUCW9kupjKIz/JbGE2gYliplCaIV |
|
11 |
fh1G4LmgrI5MRqUrIFU5wcClueK2KTPPQeMvNv72Rgsh17rKuQyCvfwCWnvNnR6C |
|
12 |
elhzSXXhLKayrDzsJGkq+TzL8kZJ4XDWAKRbwd3wgUaUCTfrfVblB9JQHS2Vf5P8 |
|
13 |
MV8kf2rKsJkNo8w6lOYSTmz2NbS3xiUEtPgX4lLBnEO+tnvUBjwIFHTz0/NmOjn/ |
|
14 |
16jjmGcvMEgf+7rObi203dVQ7vacTpk6N3z39sThw75sIJwQ4s4NlGMR+zZPQ1gh |
|
15 |
cQrSbNHMey/JpS4cwR8QLJXXjCrA+ZKXDuZ/ezw8r6r+z7CPKvT7HZrZyMgF2SEn |
|
16 |
0PH6+TaOVOi2I19y8jNpPhowJE0zaJ9QwKuo3+XHxiwe4eITJ9FWe+6E+3zcbIUs |
|
17 |
Ec7GS37QkiP9gmb33FoqNLxstV47LJ5sFVUlsQd8WlgdNbDbj1wxldTK2eHYG3VW |
|
18 |
dLf0SDYg0PqLFNWbjAw8M2A/PQOtkgtc/6nvmiwZXvR4rzZR9wLrUlxOmFuKNfa7 |
|
19 |
OgRiQxeRbyuqGRJdZuFhS36+0o6IzpcOy/TbyelmqRvzVK/rAEhT4RTm3Uvgb0Z0 |
|
20 |
z8EFSn+evmyS2mqy3hiw8TyjS3cwk/dHzhBfBclMytKCDjBBeISZ4y9YrIwREVdv |
|
21 |
zyiOAhH+e/1XJ7qr7K0NEtkjGUy3K/c1KYNNMnS1t7BgCsTMGbMd+xsvMssdOHRY |
|
22 |
TAheCEotaH8QYSkZaHKZJXmPb29LDAzzJV3XNlG52M8YxYO1k+fCGqW2aUe3qF2I |
|
23 |
9LKjl39o8rQjK4O0KeRXd+vRKvPlJVzn6uL9mS/YtENXJKnqkU8vrxupPIcMkO1m |
|
24 |
lb5veTVBd43aFhCy2BP1sbCHXTa9+3Hf1/4uouwxiw0UWO35SpQvg7tWGOaBxgJI |
|
25 |
Wwzg/gDP7S3dMmwoQZtAeCV0M5xlNt6mSV9m5QbF7c93unP/JFDPExKso7M4uMmQ |
|
26 |
/6aG6RQubuAXKrcZqmTa3zHWTohrGh3OMSWXRxC3060NdJpeBdY8nhM5USLji4cv |
|
27 |
vZ4NpZf+0v1Ka/hD/pSpQGusZp53dMUWkDI0NTeLL1DrxRl400AjR/L4uaB68d9U |
|
28 |
Ahe04OLAv+2eybxsiAFfrc9L9gNk77nMCRq+oD+86eAQanlFtmPPoQl6l2auP5m3 |
|
29 |
XBKHVNk3W994mZwQnLFFS3aPK7vaj/e9ozVygsEF/gt9G2rmenopIg== |
|
30 |
-----END RSA PRIVATE KEY----- |
src/config.ext | ||
---|---|---|
1 |
authorityKeyIdentifier=keyid,issuer |
|
2 |
basicConstraints=CA:FALSE |
|
3 |
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment |
|
4 |
subjectAltName = @alt_names |
|
5 |
|
|
6 |
[alt_names] |
|
7 |
DNS.1 = www.alternativename.com.gov.net.biz |
src/crypto.py | ||
---|---|---|
1 |
from cryptography import x509 |
|
2 |
from cryptography.x509.oid import NameOID |
|
3 |
from cryptography.hazmat.primitives import hashes |
|
4 |
from cryptography.hazmat.primitives import serialization |
|
5 |
from cryptography.hazmat.primitives.asymmetric import rsa |
|
6 |
import datetime |
|
7 |
from time import time |
|
8 |
|
|
9 |
# Generate our key |
|
10 |
key = rsa.generate_private_key( |
|
11 |
public_exponent=65537, |
|
12 |
key_size=2048, |
|
13 |
) |
|
14 |
# Write our key to disk for safe keeping |
|
15 |
with open("cert/key.pem", "wb") as f: |
|
16 |
f.write(key.private_bytes( |
|
17 |
encoding=serialization.Encoding.PEM, |
|
18 |
format=serialization.PrivateFormat.TraditionalOpenSSL, |
|
19 |
encryption_algorithm=serialization.BestAvailableEncryption(b"passphrase"), |
|
20 |
)) |
|
21 |
|
|
22 |
# Generate a CSR |
|
23 |
csr = x509.CertificateSigningRequestBuilder().subject_name(x509.Name([ |
|
24 |
# Provide various details about who we are. |
|
25 |
x509.NameAttribute(NameOID.COUNTRY_NAME, u"US"), |
|
26 |
x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, u"California"), |
|
27 |
x509.NameAttribute(NameOID.LOCALITY_NAME, u"San Francisco"), |
|
28 |
x509.NameAttribute(NameOID.ORGANIZATION_NAME, u"My Company"), |
|
29 |
x509.NameAttribute(NameOID.COMMON_NAME, u"mysite.com"), |
|
30 |
])).add_extension( |
|
31 |
x509.SubjectAlternativeName([ |
|
32 |
# Describe what sites we want this certificate for. |
|
33 |
x509.DNSName(u"mysite.com"), |
|
34 |
x509.DNSName(u"www.mysite.com"), |
|
35 |
x509.DNSName(u"subdomain.mysite.com"), |
|
36 |
]), |
|
37 |
critical=False, |
|
38 |
# Sign the CSR with our private key. |
|
39 |
).sign(key, hashes.SHA256()) |
|
40 |
# Write our CSR out to disk. |
|
41 |
with open("cert/csr.pem", "wb") as f: |
|
42 |
f.write(csr.public_bytes(serialization.Encoding.PEM)) |
|
43 |
|
|
44 |
# Various details about who we are. For a self-signed certificate the |
|
45 |
# subject and issuer are always the same. |
|
46 |
subject = issuer = x509.Name([ |
|
47 |
x509.NameAttribute(NameOID.COUNTRY_NAME, u"US"), |
|
48 |
x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, u"California"), |
|
49 |
x509.NameAttribute(NameOID.LOCALITY_NAME, u"San Francisco"), |
|
50 |
x509.NameAttribute(NameOID.ORGANIZATION_NAME, u"My Company"), |
|
51 |
x509.NameAttribute(NameOID.COMMON_NAME, u"mysite.com"), |
|
52 |
]) |
|
53 |
cert = x509.CertificateBuilder().subject_name( |
|
54 |
subject |
|
55 |
).issuer_name( |
|
56 |
issuer |
|
57 |
).public_key( |
|
58 |
key.public_key() |
|
59 |
).serial_number( |
|
60 |
x509.random_serial_number() |
|
61 |
).not_valid_before( |
|
62 |
datetime.datetime.utcnow() |
|
63 |
).not_valid_after( |
|
64 |
# Our certificate will be valid for 10 days |
|
65 |
datetime.datetime.utcnow() + datetime.timedelta(days=10) |
|
66 |
).add_extension( |
|
67 |
x509.SubjectAlternativeName([x509.DNSName(u"localhost")]), |
|
68 |
critical=False, |
|
69 |
# Sign our certificate with our private key |
|
70 |
).sign(key, hashes.SHA256()) |
|
71 |
# Write our certificate out to disk. |
|
72 |
with open("cert/certificate.pem", "wb") as f: |
|
73 |
f.write(cert.public_bytes(serialization.Encoding.PEM)) |
src/intermediate_ca_conf.cnf | ||
---|---|---|
1 |
# OpenSSL intermediate CA configuration file. |
|
2 |
# Copy to `/root/ca/intermediate/openssl.cnf`. |
|
3 |
|
|
4 |
[ ca ] |
|
5 |
# `man ca` |
|
6 |
default_ca = CA_default |
|
7 |
|
|
8 |
[ CA_default ] |
|
9 |
# Directory and file locations. |
|
10 |
dir = /root/ca/intermediate |
|
11 |
certs = $dir/certs |
|
12 |
crl_dir = $dir/crl |
|
13 |
new_certs_dir = $dir/newcerts |
|
14 |
database = $dir/index.txt |
|
15 |
serial = $dir/serial |
|
16 |
RANDFILE = $dir/private/.rand |
|
17 |
|
|
18 |
# The root key and root certificate. |
|
19 |
private_key = $dir/private/intermediate.key.pem |
|
20 |
certificate = $dir/certs/intermediate.cert.pem |
|
21 |
|
|
22 |
# For certificate revocation lists. |
|
23 |
crlnumber = $dir/crlnumber |
|
24 |
crl = $dir/crl/intermediate.crl.pem |
|
25 |
crl_extensions = crl_ext |
|
26 |
default_crl_days = 30 |
|
27 |
|
|
28 |
# SHA-1 is deprecated, so use SHA-2 instead. |
|
29 |
default_md = sha256 |
|
30 |
|
|
31 |
name_opt = ca_default |
|
32 |
cert_opt = ca_default |
|
33 |
default_days = 375 |
|
34 |
preserve = no |
|
35 |
policy = policy_loose |
|
36 |
|
|
37 |
[ policy_strict ] |
|
38 |
# The root CA should only sign intermediate certificates that match. |
|
39 |
# See the POLICY FORMAT section of `man ca`. |
|
40 |
countryName = match |
|
41 |
stateOrProvinceName = match |
|
42 |
organizationName = match |
|
43 |
organizationalUnitName = optional |
|
44 |
commonName = supplied |
|
45 |
emailAddress = optional |
|
46 |
|
|
47 |
[ policy_loose ] |
|
48 |
# Allow the intermediate CA to sign a more diverse range of certificates. |
|
49 |
# See the POLICY FORMAT section of the `ca` man page. |
|
50 |
countryName = optional |
|
51 |
stateOrProvinceName = optional |
|
52 |
localityName = optional |
|
53 |
organizationName = optional |
|
54 |
organizationalUnitName = optional |
|
55 |
commonName = supplied |
|
56 |
emailAddress = optional |
|
57 |
|
|
58 |
[ req ] |
|
59 |
# Options for the `req` tool (`man req`). |
|
60 |
default_bits = 2048 |
|
61 |
distinguished_name = req_distinguished_name |
|
62 |
string_mask = utf8only |
|
63 |
|
|
64 |
# SHA-1 is deprecated, so use SHA-2 instead. |
|
65 |
default_md = sha256 |
|
66 |
|
|
67 |
# Extension to add when the -x509 option is used. |
|
68 |
x509_extensions = v3_ca |
|
69 |
|
|
70 |
[ req_distinguished_name ] |
|
71 |
# See <https://en.wikipedia.org/wiki/Certificate_signing_request>. |
|
72 |
countryName = Country Name (2 letter code) |
|
73 |
stateOrProvinceName = State or Province Name |
|
74 |
localityName = Locality Name |
|
75 |
0.organizationName = Organization Name |
|
76 |
organizationalUnitName = Organizational Unit Name |
|
77 |
commonName = Common Name |
|
78 |
emailAddress = Email Address |
|
79 |
|
|
80 |
# Optionally, specify some defaults. |
|
81 |
countryName_default = GB |
|
82 |
stateOrProvinceName_default = England |
|
83 |
localityName_default = |
|
84 |
0.organizationName_default = Alice Ltd |
|
85 |
organizationalUnitName_default = |
|
86 |
emailAddress_default = |
|
87 |
|
|
88 |
[ v3_ca ] |
|
89 |
# Extensions for a typical CA (`man x509v3_config`). |
|
90 |
subjectKeyIdentifier = hash |
|
91 |
authorityKeyIdentifier = keyid:always,issuer |
|
92 |
basicConstraints = critical, CA:true |
|
93 |
keyUsage = critical, digitalSignature, cRLSign, keyCertSign |
|
94 |
|
|
95 |
[ v3_intermediate_ca ] |
|
96 |
# Extensions for a typical intermediate CA (`man x509v3_config`). |
|
97 |
subjectKeyIdentifier = hash |
|
98 |
authorityKeyIdentifier = keyid:always,issuer |
|
99 |
basicConstraints = critical, CA:true, pathlen:0 |
|
100 |
keyUsage = critical, digitalSignature, cRLSign, keyCertSign |
|
101 |
|
|
102 |
[ usr_cert ] |
|
103 |
# Extensions for client certificates (`man x509v3_config`). |
|
104 |
basicConstraints = CA:FALSE |
|
105 |
nsCertType = client, email |
|
106 |
nsComment = "OpenSSL Generated Client Certificate" |
|
107 |
subjectKeyIdentifier = hash |
|
108 |
authorityKeyIdentifier = keyid,issuer |
|
109 |
keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment |
|
110 |
extendedKeyUsage = clientAuth, emailProtection |
|
111 |
|
|
112 |
[ server_cert ] |
|
113 |
# Extensions for server certificates (`man x509v3_config`). |
|
114 |
basicConstraints = CA:FALSE |
|
115 |
nsCertType = server |
|
116 |
nsComment = "OpenSSL Generated Server Certificate" |
|
117 |
subjectKeyIdentifier = hash |
|
118 |
authorityKeyIdentifier = keyid,issuer:always |
|
119 |
keyUsage = critical, digitalSignature, keyEncipherment |
|
120 |
extendedKeyUsage = serverAuth |
|
121 |
|
|
122 |
[ crl_ext ] |
|
123 |
# Extension for CRLs (`man x509v3_config`). |
|
124 |
authorityKeyIdentifier=keyid:always |
|
125 |
|
|
126 |
[ ocsp ] |
|
127 |
# Extension for OCSP signing certificates (`man ocsp`). |
|
128 |
basicConstraints = CA:FALSE |
|
129 |
subjectKeyIdentifier = hash |
|
130 |
authorityKeyIdentifier = keyid,issuer |
|
131 |
keyUsage = critical, digitalSignature |
|
132 |
extendedKeyUsage = critical, OCSPSigning |
src/openssl.py | ||
---|---|---|
1 |
import subprocess |
|
2 |
import os |
|
3 |
from time import time |
|
4 |
|
|
5 |
CONFIG_NAME = "../config" |
|
6 |
|
|
7 |
ROOT_KEY_NAME = "root" |
|
8 |
ROOT_KEY_PASS = "secret_pass" |
|
9 |
ROOT_CERT_NAME = "rootCA" |
|
10 |
|
|
11 |
SOME_CERT_KEY_NAME = "somecert" |
|
12 |
SOME_CERT_KEY_PASS = "another_secret_pass" |
|
13 |
SOME_CERT_NAME = "somecert" |
|
14 |
|
|
15 |
|
|
16 |
def make_private_key(name, passphrase): |
|
17 |
subprocess.run(["openssl", |
|
18 |
"genrsa", # generate a private key for RSA encryption scheme |
|
19 |
"-des3", # use DES3 for encryption by passphrase |
|
20 |
"-out", f"{name}.key", # output specification |
|
21 |
"2048"], # bits |
|
22 |
|
|
23 |
input=bytes( # input required to interact with openssl's CLI |
|
24 |
f'{passphrase}\n' # openssl queries for passphrase, respond and return |
|
25 |
f'{passphrase}\n', # openssl queries for passphrase verification, respond and return |
|
26 |
encoding='utf-8') # use standard encoding for input stream |
|
27 |
) |
|
28 |
|
|
29 |
|
|
30 |
def declare_root_CA(name, key_name, key_passphrase): |
|
31 |
print("declare root CA") |
|
32 |
subprocess.run( |
|
33 |
["openssl", "req", "-x509", "-new", "-nodes", "-key", key_name + ".key", "-sha256", "-days", "1825", "-out", |
|
34 |
name + ".crt", "-config", "../root_ca_conf.cnf"], input=bytes(f'{key_passphrase}\nCZ\nPilsen Region\nPilsen\nJSMD\nDepartment of Mysteries\nMd, Js\ninfo@jsmd.gov\n', encoding='utf-8')) |
|
35 |
|
|
36 |
|
|
37 |
def make_certificate_sign_request(name, key_name, key_passphrase): |
|
38 |
print("make CSR") |
|
39 |
subprocess.run( |
|
40 |
["openssl", "req", "-new", "-key", key_name + ".key", "-out", |
|
41 |
name + ".csr"], input=bytes(f'{key_passphrase}\nCZ\nPilsen Region\nPilsen\nSome Randoes, a. s.\nBruh\nRando, A\neggsdee@centrum.cz.seznam\n\n\n', encoding='utf-8')) |
|
42 |
|
|
43 |
|
|
44 |
def sign_certificate(name, request_name, ca_certificate, ca_key, ca_pass, config_name): |
|
45 |
print("sign certificate by CA") |
|
46 |
subprocess.run( |
|
47 |
["openssl", "x509", "-req", "-in", request_name + ".csr", "-CA", ca_certificate + ".crt", "-CAkey", ca_key + ".key", |
|
48 |
"-CAcreateserial", "-out", name + ".crt", "-days", "123", "-sha256", "-extfile", config_name + ".ext"], input=bytes(ca_pass + "\n", encoding='utf-8')) |
|
49 |
|
|
50 |
|
|
51 |
def setup(): |
|
52 |
make_private_key(ROOT_KEY_NAME, ROOT_KEY_PASS) |
|
53 |
declare_root_CA(ROOT_CERT_NAME, ROOT_KEY_NAME, ROOT_KEY_PASS) |
|
54 |
|
|
55 |
|
|
56 |
def cert(): |
|
57 |
make_private_key(SOME_CERT_KEY_NAME, SOME_CERT_KEY_PASS) |
|
58 |
make_certificate_sign_request(SOME_CERT_NAME, SOME_CERT_KEY_NAME, SOME_CERT_KEY_PASS) |
|
59 |
sign_certificate(SOME_CERT_NAME, SOME_CERT_NAME, ROOT_CERT_NAME, ROOT_KEY_NAME, ROOT_KEY_PASS, CONFIG_NAME) |
|
60 |
|
|
61 |
|
|
62 |
def test(): |
|
63 |
subprocess.run("openssl x509 -text -noout -in rootCA.crt") |
|
64 |
subprocess.run("openssl rsa -in some_cert.key -check") |
|
65 |
|
|
66 |
|
|
67 |
if __name__ == '__main__': |
|
68 |
os.chdir("cert") |
|
69 |
setup() |
|
70 |
cert() |
|
71 |
# test() |
src/root_ca_conf.cnf | ||
---|---|---|
1 |
# OpenSSL root CA configuration file. |
|
2 |
# Copy to `/root/ca/openssl.cnf`. |
|
3 |
|
|
4 |
[ ca ] |
|
5 |
# `man ca` |
|
6 |
default_ca = CA_default |
|
7 |
|
|
8 |
[ CA_default ] |
|
9 |
# Directory and file locations. |
|
10 |
dir = /root/ca |
|
11 |
certs = $dir/certs |
|
12 |
crl_dir = $dir/crl |
|
13 |
new_certs_dir = $dir/newcerts |
|
14 |
database = $dir/index.txt |
|
15 |
serial = $dir/serial |
|
16 |
RANDFILE = $dir/private/.rand |
|
17 |
|
|
18 |
# The root key and root certificate. |
|
19 |
private_key = $dir/private/ca.key.pem |
|
20 |
certificate = $dir/certs/ca.cert.pem |
|
21 |
|
|
22 |
# For certificate revocation lists. |
|
23 |
crlnumber = $dir/crlnumber |
|
24 |
crl = $dir/crl/ca.crl.pem |
|
25 |
crl_extensions = crl_ext |
|
26 |
default_crl_days = 30 |
|
27 |
|
|
28 |
# SHA-1 is deprecated, so use SHA-2 instead. |
|
29 |
default_md = sha256 |
|
30 |
|
|
31 |
name_opt = ca_default |
|
32 |
cert_opt = ca_default |
|
33 |
default_days = 375 |
|
34 |
preserve = no |
|
35 |
policy = policy_strict |
|
36 |
|
|
37 |
[ policy_strict ] |
|
38 |
# The root CA should only sign intermediate certificates that match. |
|
39 |
# See the POLICY FORMAT section of `man ca`. |
|
40 |
countryName = match |
|
41 |
stateOrProvinceName = match |
|
42 |
organizationName = match |
|
43 |
organizationalUnitName = optional |
|
44 |
commonName = supplied |
|
45 |
emailAddress = optional |
|
46 |
|
|
47 |
[ policy_loose ] |
|
48 |
# Allow the intermediate CA to sign a more diverse range of certificates. |
|
49 |
# See the POLICY FORMAT section of the `ca` man page. |
|
50 |
countryName = optional |
|
51 |
stateOrProvinceName = optional |
|
52 |
localityName = optional |
|
53 |
organizationName = optional |
|
54 |
organizationalUnitName = optional |
|
55 |
commonName = supplied |
|
56 |
emailAddress = optional |
|
57 |
|
|
58 |
[ req ] |
|
59 |
# Options for the `req` tool (`man req`). |
|
60 |
default_bits = 2048 |
|
61 |
distinguished_name = req_distinguished_name |
|
62 |
string_mask = utf8only |
|
63 |
|
|
64 |
# SHA-1 is deprecated, so use SHA-2 instead. |
|
65 |
default_md = sha256 |
|
66 |
|
|
67 |
# Extension to add when the -x509 option is used. |
|
68 |
x509_extensions = v3_ca |
|
69 |
|
|
70 |
[ req_distinguished_name ] |
|
71 |
# See <https://en.wikipedia.org/wiki/Certificate_signing_request>. |
|
72 |
countryName = Country Name (2 letter code) |
|
73 |
stateOrProvinceName = State or Province Name |
|
74 |
localityName = Locality Name |
|
75 |
0.organizationName = Organization Name |
|
76 |
organizationalUnitName = Organizational Unit Name |
|
77 |
commonName = Common Name |
|
78 |
emailAddress = Email Address |
|
79 |
|
|
80 |
# Optionally, specify some defaults. |
|
81 |
countryName_default = GB |
|
82 |
stateOrProvinceName_default = England |
|
83 |
localityName_default = |
|
84 |
0.organizationName_default = Alice Ltd |
|
85 |
organizationalUnitName_default = |
|
86 |
emailAddress_default = |
|
87 |
|
|
88 |
[ v3_ca ] |
|
89 |
# Extensions for a typical CA (`man x509v3_config`). |
|
90 |
subjectKeyIdentifier = hash |
|
91 |
authorityKeyIdentifier = keyid:always,issuer |
|
92 |
basicConstraints = critical, CA:true |
|
93 |
keyUsage = critical, digitalSignature, cRLSign, keyCertSign |
|
94 |
|
|
95 |
[ v3_intermediate_ca ] |
|
96 |
# Extensions for a typical intermediate CA (`man x509v3_config`). |
|
97 |
subjectKeyIdentifier = hash |
|
98 |
authorityKeyIdentifier = keyid:always,issuer |
|
99 |
basicConstraints = critical, CA:true, pathlen:0 |
|
100 |
keyUsage = critical, digitalSignature, cRLSign, keyCertSign |
|
101 |
|
|
102 |
[ usr_cert ] |
|
103 |
# Extensions for client certificates (`man x509v3_config`). |
|
104 |
basicConstraints = CA:FALSE |
|
105 |
nsCertType = client, email |
|
106 |
nsComment = "OpenSSL Generated Client Certificate" |
|
107 |
subjectKeyIdentifier = hash |
|
108 |
authorityKeyIdentifier = keyid,issuer |
|
109 |
keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment |
|
110 |
extendedKeyUsage = clientAuth, emailProtection |
|
111 |
|
|
112 |
[ server_cert ] |
|
113 |
# Extensions for server certificates (`man x509v3_config`). |
|
114 |
basicConstraints = CA:FALSE |
|
115 |
nsCertType = server |
|
116 |
nsComment = "OpenSSL Generated Server Certificate" |
|
117 |
subjectKeyIdentifier = hash |
|
118 |
authorityKeyIdentifier = keyid,issuer:always |
|
119 |
keyUsage = critical, digitalSignature, keyEncipherment |
|
120 |
extendedKeyUsage = serverAuth |
|
121 |
|
|
122 |
[ crl_ext ] |
|
123 |
# Extension for CRLs (`man x509v3_config`). |
|
124 |
authorityKeyIdentifier=keyid:always |
|
125 |
|
|
126 |
[ ocsp ] |
|
127 |
# Extension for OCSP signing certificates (`man ocsp`). |
|
128 |
basicConstraints = CA:FALSE |
|
129 |
subjectKeyIdentifier = hash |
|
130 |
authorityKeyIdentifier = keyid,issuer |
|
131 |
keyUsage = critical, digitalSignature |
|
132 |
extendedKeyUsage = critical, OCSPSigning |
Také k dispozici: Unified diff
#8226 - deep individual research
Examined both raw openssl's and python-cryptography's utility for our project. Basic certificate functionality implemented and profiled.