Skip to content

Commit 8a0fdc8

Browse files
committed
Update example
1 parent c49eda8 commit 8a0fdc8

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,14 @@ with open('cert.pem', 'rb') as f:
6060
>>>
6161
for cert in chain:
6262
print(cert)
63+
print(cert.export()) # Export the certificate in PEM format
64+
6365
<Cert common_name="cert-chain-resolver.remcokoopmans.com" subject="CN=cert-chain-resolver.remcokoopmans.com" issuer="CN=R3,O=Let's Encrypt,C=US">
66+
"-----BEGIN CERTIFICATE-----...."
6467
<Cert common_name="R3" subject="CN=R3,O=Let's Encrypt,C=US" issuer="CN=DST Root CA X3,O=Digital Signature Trust Co.">
68+
"-----BEGIN CERTIFICATE-----...."
6569
<Cert common_name="DST Root CA X3" subject="CN=DST Root CA X3,O=Digital Signature Trust Co." issuer="CN=DST Root CA X3,O=Digital Signature Trust Co.">
70+
"-----BEGIN CERTIFICATE-----...."
6671
```
6772

6873
## Dependencies

docs/api.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@ To resolve the full certificate chain for a certificate in PEM format:
2424
2525
# Output certificates
2626
for cert in chain:
27-
print(cert)
27+
print(cert) # Print the certificate object
28+
print(cert.export()) # Export the certificate in PEM format
2829
2930
3031
Expected output:
3132

3233
.. code-block:: none
3334
3435
<Cert common_name="cert-chain-resolver.remcokoopmans.com" subject="CN=cert-chain-resolver.remcokoopmans.com" issuer="CN=R3,O=Let's Encrypt,C=US">
36+
"-----BEGIN CERTIFICATE-----...."
3537
<Cert common_name="R3" subject="CN=R3,O=Let's Encrypt,C=US" issuer="CN=DST Root CA X3,O=Digital Signature Trust Co.">
38+
"-----BEGIN CERTIFICATE-----...."
3639
<Cert common_name="DST Root CA X3" subject="CN=DST Root CA X3,O=Digital Signature Trust Co." issuer="CN=DST Root CA X3,O=Digital Signature Trust Co.">
40+
"-----BEGIN CERTIFICATE-----...."
3741
3842
This will print each certificate in the chain, starting with the leaf and ending with the root, if available.
3943

0 commit comments

Comments
 (0)