Chain ¶
Bases: Certificates
Chain holds a list of certificates in a chain of trust
Examples¶
Create chain¶
import datetime
from pki_tools import (
Name,
RSAKeyPair,
SHA512,
Chain,
Certificate,
Validity,
)
issuer_key = RSAKeyPair.generate()
issuer = Name(cn=["Issuer"])
validity = Validity(
not_before=datetime.datetime.today() - datetime.timedelta(days=1),
not_after=datetime.datetime.today() + datetime.timedelta(days=1),
)
# Create self-signed issuer cert
issuer_cert = Certificate(
subject=issuer,
issuer=issuer,
validity=validity,
)
issuer_cert.sign(issuer_key, SHA512)
cert_key = RSAKeyPair.generate()
name = Name(cn=["Cert CN"])
# Create certificate singed by issuer key
cert = Certificate(
subject=name,
issuer=issuer,
validity=validity,
)
cert.sign(issuer_key, SHA512, req_key=cert_key.public_key)
chain = Chain(certificates=[issuer_cert, cert])
print(chain)
Print output
----------Certificate #1----------
Issuer: 'CN: Issuer'
Serial Number: 000000000000000000000000F324B06B
Signature Algorithm: SHA512
Subject: 'CN: Issuer'
Subject Public Key Info:
Parameters:
Key Size: '2048'
Modulus N: |-
24512908490847419959148488546578707070361977414313095859803549266406631884467943
47736185510432352513271587231190286401974946318587796724342072653654191481860861
54934391020121010189615110080522347088148793634069809754960483000826386632203570
74720270852010035225315636529994239462493606316311687886543630281434421744491326
99111730259813825998131004835114120995481108520887460934191068529079773779999065
31595156496070224454783095279056429406983893698625734439655201026783277966361911
36803965509223476031606668074978340836583934819366549600757429589418053972419117
808170255864069660657928965745093887687188375095145919859
Public Exponent E: '65537'
Public Key Algorithm:
key_size: '2048'
modulus_n: |-
24512908490847419959148488546578707070361977414313095859803549266406631884467943
47736185510432352513271587231190286401974946318587796724342072653654191481860861
54934391020121010189615110080522347088148793634069809754960483000826386632203570
74720270852010035225315636529994239462493606316311687886543630281434421744491326
99111730259813825998131004835114120995481108520887460934191068529079773779999065
31595156496070224454783095279056429406983893698625734439655201026783277966361911
36803965509223476031606668074978340836583934819366549600757429589418053972419117
808170255864069660657928965745093887687188375095145919859
public_exponent_e: '65537'
Validity:
Not After: '2024-03-20 19:33:18.892956+00:00'
Not Before: '2024-03-18 19:33:18.892942+00:00'
----------------------------------
----------Certificate #2----------
Issuer: 'CN: Issuer'
Serial Number: 000000000000000000000000803635E6
Signature Algorithm: SHA512
Subject: 'CN: Cert CN'
Subject Public Key Info:
Parameters:
Key Size: '2048'
Modulus N: |-
19722525837243147256729707527743424501691201966358125011176035630852019620432684
33888280452899997110070739130214603301492233663748271149582925009584034197398605
65529687610044811183554986390205164425813989860258205218774903363071682672036937
90000253019595505038363546573367958766989435918323824165029690193800047593345327
10740975096800488765378675539885938133592084071647692686980410524799633255683361
89145937767282660220211128492179314412670386243074846072009966825956121063566320
94722321854694457820606911775347912746675654229128937423685679272102158133109672
787437074247278159877057337119200281262914762865880161033
Public Exponent E: '65537'
Public Key Algorithm:
key_size: '2048'
modulus_n: |-
19722525837243147256729707527743424501691201966358125011176035630852019620432684
33888280452899997110070739130214603301492233663748271149582925009584034197398605
65529687610044811183554986390205164425813989860258205218774903363071682672036937
90000253019595505038363546573367958766989435918323824165029690193800047593345327
10740975096800488765378675539885938133592084071647692686980410524799633255683361
89145937767282660220211128492179314412670386243074846072009966825956121063566320
94722321854694457820606911775347912746675654229128937423685679272102158133109672
787437074247278159877057337119200281262914762865880161033
public_exponent_e: '65537'
Validity:
Not After: '2024-03-20 19:33:18.892956+00:00'
Not Before: '2024-03-18 19:33:18.892942+00:00'
----------------------------------
Chain certificate count: 2
InitCryptoParser.from_pem_string¶
chain_pem
chain_pem = """
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEp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u+decIsH4YaTw7mP3GFxJSqv3+0lUFJoi5Lc5da149p90Ids
hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+
HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv
MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX
nLRbwHOoq7hHwg==
-----END CERTIFICATE-----
"""
from pki_tools import Chain
chain = Chain.from_pem_string(chain_pem)
print(chain)
Print output
----------Certificate #1----------
Extensions:
Basic Constraints (critical):
CA: true
Key Usage (critical): Key Cert Sign, Crl Sign
Subject Key Identifier:
Subject Key Identifier: 79B459E67BB6E5E40173800888C81A58F6E99B6E
Issuer: 'C: US, CN: ISRG Root X1, O: Internet Security Research Group'
Serial Number: 8210CFB0D240E3594463E0BB63828B00
Signature Algorithm: SHA256
Signature Value: |-
551F58A9BCB2A850D00CB1D81A6920272908AC61755C8A6EF882E5692FD5F6564BB9B8731059D321
977EE74C71FBB2D260AD39A80BEA17215685F1500E59EBCEE059E9BAC915EF869D8F8480F6E4E991
90DC179B621B45F06695D27C6FC2EA3BEF1FCFCBD6AE27F1A9B0C8AEFD7D7E9AFA2204EBFFD97FEA
912B22B1170E8FF28A345B58D8FC01C954B9B826CC8A8833894C2D843C82DFEE965705BA2CBBF7C4
B7C74E3B82BE31C822737392D1C280A43939103323824C3C9F86B255981DBE29868C229B9EE26B3B
573A82704DDC09C789CB0A074D6CE85D8EC9EFCEABC7BBB52B4E45D64AD026CCE572CA086AA595E3
15A1F7A4EDC92C5FA5FBFFAC28022EBED77BBBE3717B9016D3075E46537C3707428CD3C4969CD599
B52AE0951A8048AE4C3907CECC47A452952BBAB8FBADD233537DE51D4D6DD5A1B1C7426FE6402735
5CA328B7078DE78D3390E7239FFB509C796C46D5B415B3966E7E9B0C963AB8522D3FD65BE1FB08C2
84FE24A8A389DAAC6AE1182AB1A843615BD31FDC3B8D76F22DE88D75DF17336C3D53FB7BCB415FFF
DCA2D06138E196B8AC5D8B37D775D533C09911AE9D41C1727584BE0241425F67244894D19B27BE07
3FB9B84F817451E17AB7ED9D23E2BEE0D52804133C31039EDD7A6C8FC60718C67FDE478E3F289E04
06CFA5543477BDEC899BE91743DF5BDB5FFE8E1E57A2CD409D7E6222DADE1827
Subject: 'C: US, CN: ISRG Root X1, O: Internet Security Research Group'
Subject Public Key Info:
Parameters:
Key Size: '4096'
Modulus N: |-
70947787041544537301535901656242666061055377068594452089329839660022676089997787
91910048985433508318421191741886136781365102624725505327222341317544391810900098
24131001234702144200501816519311599904090606194984753842587622398776018408050245
57411602855060870889647897710470310136457737755482389335033937689298408667684282
15066373765614712211786775130358118845898882309478554825547809248442806614129828
27405878164907670403886160896655313460186264922042760067692235383478494519985672
05969875291596599841244594625422741323225727652524000665148313079224811241742584
64519514387812606321376453589275681583619617101851155025771270109223443949930789
48994750404287047493247048147066090211292167313905862438457453781042040498702821
43201376550202410506577825775917835692549415644757032237331025699960908320177827
85885998547062417881194489430344773709593495168731620634615217078096898397109727
53590949570167489887658749686740890549110678989462474318310617765270337415238713
77080071123656361017110132805242414547822099301651526247854381379689967721519278
96126828451450089931445135474441311260295571475700053699431432135256711052888170
16183804256755470528641042403865830064493168693765438364296560479053823886598989
258655438933191724193029337334607
Public Exponent E: '65537'
Public Key Algorithm:
key_size: '4096'
modulus_n: |-
70947787041544537301535901656242666061055377068594452089329839660022676089997787
91910048985433508318421191741886136781365102624725505327222341317544391810900098
24131001234702144200501816519311599904090606194984753842587622398776018408050245
57411602855060870889647897710470310136457737755482389335033937689298408667684282
15066373765614712211786775130358118845898882309478554825547809248442806614129828
27405878164907670403886160896655313460186264922042760067692235383478494519985672
05969875291596599841244594625422741323225727652524000665148313079224811241742584
64519514387812606321376453589275681583619617101851155025771270109223443949930789
48994750404287047493247048147066090211292167313905862438457453781042040498702821
43201376550202410506577825775917835692549415644757032237331025699960908320177827
85885998547062417881194489430344773709593495168731620634615217078096898397109727
53590949570167489887658749686740890549110678989462474318310617765270337415238713
77080071123656361017110132805242414547822099301651526247854381379689967721519278
96126828451450089931445135474441311260295571475700053699431432135256711052888170
16183804256755470528641042403865830064493168693765438364296560479053823886598989
258655438933191724193029337334607
public_exponent_e: '65537'
Validity:
Not After: '2035-06-04 11:04:38+00:00'
Not Before: '2015-06-04 11:04:38+00:00'
Version: 2
----------------------------------
----------Certificate #2----------
Extensions:
Authority Information Access:
Access Description:
- Access Location:
name: UniformResourceIdentifier
value: http://x1.i.lencr.org/
Access Method: CA_ISSUERS
Authority Key Identifier:
Key Identifier: 79B459E67BB6E5E40173800888C81A58F6E99B6E
Basic Constraints (critical):
CA: true
Certificate Policies:
- Policy 2.23.140.1.2.1: []
- Policy 1.3.6.1.4.1.44947.1.1.1: []
Crl Distribution Points:
- Full Name:
- name: UniformResourceIdentifier
value: http://x1.c.lencr.org/
Extended Key Usage:
- Client Authentication
- Server Authentication
Key Usage (critical): Digital Signature, Key Cert Sign, Crl Sign
Path Lenght: 0
Subject Key Identifier:
Subject Key Identifier: 142EB317B75856CBAE500940E61FAF9D8B14C2C6
Issuer: 'C: US, CN: ISRG Root X1, O: Internet Security Research Group'
Serial Number: 912B084ACF0C18A753F6D62E25A75F5A
Signature Algorithm: SHA256
Signature Value: |-
85CA4E473EA3F7854485BCD56778B29863AD754D1E963D336572542D81A0EAC3EDF820BF5FCCB770
00B76E3BF65E94DEE4209FA6EF8BB203E7A2B5163C91CEB4ED3902E77C258A47E6656E3F46F4D9F0
CE942BEE54CE12BC8C274BB8C1982FA2AFCD71914A08B7C8B8237B042D08F908573E83D904330A47
2178098227C32AC89BB9CE5CF264C8C0BE79C04F8E6D440C5E92BB2EF78B10E1E81D4429DB5920ED
63B921F81226949357A01D6504C10A22AE100D4397A1181F7EE0E08637B55AB1BD30BF876E2B2AFF
214E1B05C3F51897F05EACC3A5B86AF02EBC3B33B9EE4BDECCFCE4AF840B863FC0554336F668E136
176A8E99D1FFA540A734B7C0D063393539756EF2BA76C89302E9A94B6C17CE0C02D9BD81FB9FB768
D40665B3823D7753F88E7903AD0A3107752A43D8559772C4290EF7C45D4EC8AE468430D7F2855F18
A179BBE75E708B07E18693C3B98FDC6171252AAFDFED255052688B92DCE5D6B5E3DA7DD0876C8421
31AE82F5FBB9ABC889173DE14CE5380EF6BD2BBD968114EBD5DB3D20A77E59D3E2F858F95BB848CD
FE5C4F1629FE1E5523AFC811B08DEA7C9390172FFDACA20947463FF0E9B0B7FF284D6832D6675E1E
69A393B8F59D8B2F0BD25243A66F3257654D3281DF3853855D7E5D6629EAB8DDE495B5CDB5561242
CDC44EC6253844506DECCE005518FEE94964D44ECA979CB45BC073A8ABB847C2
Subject: 'C: US, CN: R3, O: Let''s Encrypt'
Subject Public Key Info:
Parameters:
Key Size: '2048'
Modulus N: |-
23607590023527405233483514815960094733025362836439268915823566209453533788829410
72961269318866403396560128488938220067229162371221935157944246629213402577917087
19030296756413322277205133704994143921747776293784333332814927820066440035084066
69842374574620445942041275265465205367002253387972103578862358103547035353751037
98689289193893953701371227696203175830312817811815601999781845906479379770505161
19310429773226949916112639110772354331197195042061738975342154862253911562311683
13218127765624386188467360149426877213161912342004781300247624712380387337803861
727744706241919394251136381590874774264144198228326996757
Public Exponent E: '65537'
Public Key Algorithm:
key_size: '2048'
modulus_n: |-
23607590023527405233483514815960094733025362836439268915823566209453533788829410
72961269318866403396560128488938220067229162371221935157944246629213402577917087
19030296756413322277205133704994143921747776293784333332814927820066440035084066
69842374574620445942041275265465205367002253387972103578862358103547035353751037
98689289193893953701371227696203175830312817811815601999781845906479379770505161
19310429773226949916112639110772354331197195042061738975342154862253911562311683
13218127765624386188467360149426877213161912342004781300247624712380387337803861
727744706241919394251136381590874774264144198228326996757
public_exponent_e: '65537'
Validity:
Not After: '2025-09-15 16:00:00+00:00'
Not Before: '2020-09-04 00:00:00+00:00'
Version: 2
----------------------------------
Chain certificate count: 2
InitCryptoParser.from_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heAmCJ8MqyJu5zlzyZMjAvnnAT45tRAxekrsu94sQ4egdRCnbWSDtY7kh+BIm
lJNXoB1lBMEKIq4QDUOXoRgffuDghje1WrG9ML+Hbisq/yFOGwXD9RiX8F6sw6W4
avAuvDszue5L3sz85K+EC4Y/wFVDNvZo4TYXao6Z0f+lQKc0t8DQYzk1OXVu8rp2
yJMC6alLbBfODALZvYH7n7do1AZls4I9d1P4jnkDrQoxB3UqQ9hVl3LEKQ73xF1O
yK5GhDDX8oVfGKF5u+decIsH4YaTw7mP3GFxJSqv3+0lUFJoi5Lc5da149p90Ids
hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+
HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv
MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX
nLRbwHOoq7hHwg==
-----END CERTIFICATE-----
from pki_tools import Chain
chain = Chain.from_file("chain.pem")
print(chain)
Print output
----------Certificate #1----------
Extensions:
Basic Constraints (critical):
CA: true
Key Usage (critical): Key Cert Sign, Crl Sign
Subject Key Identifier:
Subject Key Identifier: 79B459E67BB6E5E40173800888C81A58F6E99B6E
Issuer: 'C: US, CN: ISRG Root X1, O: Internet Security Research Group'
Serial Number: 8210CFB0D240E3594463E0BB63828B00
Signature Algorithm: SHA256
Signature Value: |-
551F58A9BCB2A850D00CB1D81A6920272908AC61755C8A6EF882E5692FD5F6564BB9B8731059D321
977EE74C71FBB2D260AD39A80BEA17215685F1500E59EBCEE059E9BAC915EF869D8F8480F6E4E991
90DC179B621B45F06695D27C6FC2EA3BEF1FCFCBD6AE27F1A9B0C8AEFD7D7E9AFA2204EBFFD97FEA
912B22B1170E8FF28A345B58D8FC01C954B9B826CC8A8833894C2D843C82DFEE965705BA2CBBF7C4
B7C74E3B82BE31C822737392D1C280A43939103323824C3C9F86B255981DBE29868C229B9EE26B3B
573A82704DDC09C789CB0A074D6CE85D8EC9EFCEABC7BBB52B4E45D64AD026CCE572CA086AA595E3
15A1F7A4EDC92C5FA5FBFFAC28022EBED77BBBE3717B9016D3075E46537C3707428CD3C4969CD599
B52AE0951A8048AE4C3907CECC47A452952BBAB8FBADD233537DE51D4D6DD5A1B1C7426FE6402735
5CA328B7078DE78D3390E7239FFB509C796C46D5B415B3966E7E9B0C963AB8522D3FD65BE1FB08C2
84FE24A8A389DAAC6AE1182AB1A843615BD31FDC3B8D76F22DE88D75DF17336C3D53FB7BCB415FFF
DCA2D06138E196B8AC5D8B37D775D533C09911AE9D41C1727584BE0241425F67244894D19B27BE07
3FB9B84F817451E17AB7ED9D23E2BEE0D52804133C31039EDD7A6C8FC60718C67FDE478E3F289E04
06CFA5543477BDEC899BE91743DF5BDB5FFE8E1E57A2CD409D7E6222DADE1827
Subject: 'C: US, CN: ISRG Root X1, O: Internet Security Research Group'
Subject Public Key Info:
Parameters:
Key Size: '4096'
Modulus N: |-
70947787041544537301535901656242666061055377068594452089329839660022676089997787
91910048985433508318421191741886136781365102624725505327222341317544391810900098
24131001234702144200501816519311599904090606194984753842587622398776018408050245
57411602855060870889647897710470310136457737755482389335033937689298408667684282
15066373765614712211786775130358118845898882309478554825547809248442806614129828
27405878164907670403886160896655313460186264922042760067692235383478494519985672
05969875291596599841244594625422741323225727652524000665148313079224811241742584
64519514387812606321376453589275681583619617101851155025771270109223443949930789
48994750404287047493247048147066090211292167313905862438457453781042040498702821
43201376550202410506577825775917835692549415644757032237331025699960908320177827
85885998547062417881194489430344773709593495168731620634615217078096898397109727
53590949570167489887658749686740890549110678989462474318310617765270337415238713
77080071123656361017110132805242414547822099301651526247854381379689967721519278
96126828451450089931445135474441311260295571475700053699431432135256711052888170
16183804256755470528641042403865830064493168693765438364296560479053823886598989
258655438933191724193029337334607
Public Exponent E: '65537'
Public Key Algorithm:
key_size: '4096'
modulus_n: |-
70947787041544537301535901656242666061055377068594452089329839660022676089997787
91910048985433508318421191741886136781365102624725505327222341317544391810900098
24131001234702144200501816519311599904090606194984753842587622398776018408050245
57411602855060870889647897710470310136457737755482389335033937689298408667684282
15066373765614712211786775130358118845898882309478554825547809248442806614129828
27405878164907670403886160896655313460186264922042760067692235383478494519985672
05969875291596599841244594625422741323225727652524000665148313079224811241742584
64519514387812606321376453589275681583619617101851155025771270109223443949930789
48994750404287047493247048147066090211292167313905862438457453781042040498702821
43201376550202410506577825775917835692549415644757032237331025699960908320177827
85885998547062417881194489430344773709593495168731620634615217078096898397109727
53590949570167489887658749686740890549110678989462474318310617765270337415238713
77080071123656361017110132805242414547822099301651526247854381379689967721519278
96126828451450089931445135474441311260295571475700053699431432135256711052888170
16183804256755470528641042403865830064493168693765438364296560479053823886598989
258655438933191724193029337334607
public_exponent_e: '65537'
Validity:
Not After: '2035-06-04 11:04:38+00:00'
Not Before: '2015-06-04 11:04:38+00:00'
Version: 2
----------------------------------
----------Certificate #2----------
Extensions:
Authority Information Access:
Access Description:
- Access Location:
name: UniformResourceIdentifier
value: http://x1.i.lencr.org/
Access Method: CA_ISSUERS
Authority Key Identifier:
Key Identifier: 79B459E67BB6E5E40173800888C81A58F6E99B6E
Basic Constraints (critical):
CA: true
Certificate Policies:
- Policy 2.23.140.1.2.1: []
- Policy 1.3.6.1.4.1.44947.1.1.1: []
Crl Distribution Points:
- Full Name:
- name: UniformResourceIdentifier
value: http://x1.c.lencr.org/
Extended Key Usage:
- Client Authentication
- Server Authentication
Key Usage (critical): Digital Signature, Key Cert Sign, Crl Sign
Path Lenght: 0
Subject Key Identifier:
Subject Key Identifier: 142EB317B75856CBAE500940E61FAF9D8B14C2C6
Issuer: 'C: US, CN: ISRG Root X1, O: Internet Security Research Group'
Serial Number: 912B084ACF0C18A753F6D62E25A75F5A
Signature Algorithm: SHA256
Signature Value: |-
85CA4E473EA3F7854485BCD56778B29863AD754D1E963D336572542D81A0EAC3EDF820BF5FCCB770
00B76E3BF65E94DEE4209FA6EF8BB203E7A2B5163C91CEB4ED3902E77C258A47E6656E3F46F4D9F0
CE942BEE54CE12BC8C274BB8C1982FA2AFCD71914A08B7C8B8237B042D08F908573E83D904330A47
2178098227C32AC89BB9CE5CF264C8C0BE79C04F8E6D440C5E92BB2EF78B10E1E81D4429DB5920ED
63B921F81226949357A01D6504C10A22AE100D4397A1181F7EE0E08637B55AB1BD30BF876E2B2AFF
214E1B05C3F51897F05EACC3A5B86AF02EBC3B33B9EE4BDECCFCE4AF840B863FC0554336F668E136
176A8E99D1FFA540A734B7C0D063393539756EF2BA76C89302E9A94B6C17CE0C02D9BD81FB9FB768
D40665B3823D7753F88E7903AD0A3107752A43D8559772C4290EF7C45D4EC8AE468430D7F2855F18
A179BBE75E708B07E18693C3B98FDC6171252AAFDFED255052688B92DCE5D6B5E3DA7DD0876C8421
31AE82F5FBB9ABC889173DE14CE5380EF6BD2BBD968114EBD5DB3D20A77E59D3E2F858F95BB848CD
FE5C4F1629FE1E5523AFC811B08DEA7C9390172FFDACA20947463FF0E9B0B7FF284D6832D6675E1E
69A393B8F59D8B2F0BD25243A66F3257654D3281DF3853855D7E5D6629EAB8DDE495B5CDB5561242
CDC44EC6253844506DECCE005518FEE94964D44ECA979CB45BC073A8ABB847C2
Subject: 'C: US, CN: R3, O: Let''s Encrypt'
Subject Public Key Info:
Parameters:
Key Size: '2048'
Modulus N: |-
23607590023527405233483514815960094733025362836439268915823566209453533788829410
72961269318866403396560128488938220067229162371221935157944246629213402577917087
19030296756413322277205133704994143921747776293784333332814927820066440035084066
69842374574620445942041275265465205367002253387972103578862358103547035353751037
98689289193893953701371227696203175830312817811815601999781845906479379770505161
19310429773226949916112639110772354331197195042061738975342154862253911562311683
13218127765624386188467360149426877213161912342004781300247624712380387337803861
727744706241919394251136381590874774264144198228326996757
Public Exponent E: '65537'
Public Key Algorithm:
key_size: '2048'
modulus_n: |-
23607590023527405233483514815960094733025362836439268915823566209453533788829410
72961269318866403396560128488938220067229162371221935157944246629213402577917087
19030296756413322277205133704994143921747776293784333332814927820066440035084066
69842374574620445942041275265465205367002253387972103578862358103547035353751037
98689289193893953701371227696203175830312817811815601999781845906479379770505161
19310429773226949916112639110772354331197195042061738975342154862253911562311683
13218127765624386188467360149426877213161912342004781300247624712380387337803861
727744706241919394251136381590874774264144198228326996757
public_exponent_e: '65537'
Validity:
Not After: '2025-09-15 16:00:00+00:00'
Not Before: '2020-09-04 00:00:00+00:00'
Version: 2
----------------------------------
Chain certificate count: 2
InitCryptoParser.to_file¶
chain_pem
chain_pem = """
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6aw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qAYhhZodHRw
Oi8veDEuYy5sZW5jci5vcmcvMCIGA1UdIAQbMBkwCAYGZ4EMAQIBMA0GCysGAQQB
gt8TAQEBMA0GCSqGSIb3DQEBCwUAA4ICAQCFyk5HPqP3hUSFvNVneLKYY611TR6W
PTNlclQtgaDqw+34IL9fzLdwALduO/ZelN7kIJ+m74uyA+eitRY8kc607TkC53wl
ikfmZW4/RvTZ8M6UK+5UzhK8jCdLuMGYL6KvzXGRSgi3yLgjewQtCPkIVz6D2QQz
CkcheAmCJ8MqyJu5zlzyZMjAvnnAT45tRAxekrsu94sQ4egdRCnbWSDtY7kh+BIm
lJNXoB1lBMEKIq4QDUOXoRgffuDghje1WrG9ML+Hbisq/yFOGwXD9RiX8F6sw6W4
avAuvDszue5L3sz85K+EC4Y/wFVDNvZo4TYXao6Z0f+lQKc0t8DQYzk1OXVu8rp2
yJMC6alLbBfODALZvYH7n7do1AZls4I9d1P4jnkDrQoxB3UqQ9hVl3LEKQ73xF1O
yK5GhDDX8oVfGKF5u+decIsH4YaTw7mP3GFxJSqv3+0lUFJoi5Lc5da149p90Ids
hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+
HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv
MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX
nLRbwHOoq7hHwg==
-----END CERTIFICATE-----
"""
from pki_tools import Chain
chain = Chain.from_pem_string(chain_pem)
chain.to_file("out_chain.pem")
out_cert.pem
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb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LbBfODALZvYH7n7do1AZls4I9d1P4jnkDrQoxB3UqQ9hVl3LEKQ73xF1O
yK5GhDDX8oVfGKF5u+decIsH4YaTw7mP3GFxJSqv3+0lUFJoi5Lc5da149p90Ids
hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+
HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv
MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX
nLRbwHOoq7hHwg==
-----END CERTIFICATE-----
Certificates.from_cryptography¶
chain_pem
from cryptography import x509
chain_pem = """
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
B5T0Y3Hs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XOACIjIGlj26ZtuMDIGCCsGAQUFBwEBBCYwJDAiBggrBgEFBQcw
AoYWaHR0cDovL3gxLmkubGVuY3Iub3JnLzAnBgNVHR8EIDAeMBygGqAYhhZodHRw
Oi8veDEuYy5sZW5jci5vcmcvMCIGA1UdIAQbMBkwCAYGZ4EMAQIBMA0GCysGAQQB
gt8TAQEBMA0GCSqGSIb3DQEBCwUAA4ICAQCFyk5HPqP3hUSFvNVneLKYY611TR6W
PTNlclQtgaDqw+34IL9fzLdwALduO/ZelN7kIJ+m74uyA+eitRY8kc607TkC53wl
ikfmZW4/RvTZ8M6UK+5UzhK8jCdLuMGYL6KvzXGRSgi3yLgjewQtCPkIVz6D2QQz
CkcheAmCJ8MqyJu5zlzyZMjAvnnAT45tRAxekrsu94sQ4egdRCnbWSDtY7kh+BIm
lJNXoB1lBMEKIq4QDUOXoRgffuDghje1WrG9ML+Hbisq/yFOGwXD9RiX8F6sw6W4
avAuvDszue5L3sz85K+EC4Y/wFVDNvZo4TYXao6Z0f+lQKc0t8DQYzk1OXVu8rp2
yJMC6alLbBfODALZvYH7n7do1AZls4I9d1P4jnkDrQoxB3UqQ9hVl3LEKQ73xF1O
yK5GhDDX8oVfGKF5u+decIsH4YaTw7mP3GFxJSqv3+0lUFJoi5Lc5da149p90Ids
hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+
HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv
MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX
nLRbwHOoq7hHwg==
-----END CERTIFICATE-----
"""
crypto_certs = x509.load_pem_x509_certificates(chain_pem.encode())
from pki_tools import Chain
chain = Chain.from_cryptography(crypto_certs)
print(chain)
Print output
----------Certificate #1----------
Extensions:
Basic Constraints (critical):
CA: true
Key Usage (critical): Key Cert Sign, Crl Sign
Subject Key Identifier:
Subject Key Identifier: 79B459E67BB6E5E40173800888C81A58F6E99B6E
Issuer: 'C: US, CN: ISRG Root X1, O: Internet Security Research Group'
Serial Number: 8210CFB0D240E3594463E0BB63828B00
Signature Algorithm: SHA256
Signature Value: |-
551F58A9BCB2A850D00CB1D81A6920272908AC61755C8A6EF882E5692FD5F6564BB9B8731059D321
977EE74C71FBB2D260AD39A80BEA17215685F1500E59EBCEE059E9BAC915EF869D8F8480F6E4E991
90DC179B621B45F06695D27C6FC2EA3BEF1FCFCBD6AE27F1A9B0C8AEFD7D7E9AFA2204EBFFD97FEA
912B22B1170E8FF28A345B58D8FC01C954B9B826CC8A8833894C2D843C82DFEE965705BA2CBBF7C4
B7C74E3B82BE31C822737392D1C280A43939103323824C3C9F86B255981DBE29868C229B9EE26B3B
573A82704DDC09C789CB0A074D6CE85D8EC9EFCEABC7BBB52B4E45D64AD026CCE572CA086AA595E3
15A1F7A4EDC92C5FA5FBFFAC28022EBED77BBBE3717B9016D3075E46537C3707428CD3C4969CD599
B52AE0951A8048AE4C3907CECC47A452952BBAB8FBADD233537DE51D4D6DD5A1B1C7426FE6402735
5CA328B7078DE78D3390E7239FFB509C796C46D5B415B3966E7E9B0C963AB8522D3FD65BE1FB08C2
84FE24A8A389DAAC6AE1182AB1A843615BD31FDC3B8D76F22DE88D75DF17336C3D53FB7BCB415FFF
DCA2D06138E196B8AC5D8B37D775D533C09911AE9D41C1727584BE0241425F67244894D19B27BE07
3FB9B84F817451E17AB7ED9D23E2BEE0D52804133C31039EDD7A6C8FC60718C67FDE478E3F289E04
06CFA5543477BDEC899BE91743DF5BDB5FFE8E1E57A2CD409D7E6222DADE1827
Subject: 'C: US, CN: ISRG Root X1, O: Internet Security Research Group'
Subject Public Key Info:
Parameters:
Key Size: '4096'
Modulus N: |-
70947787041544537301535901656242666061055377068594452089329839660022676089997787
91910048985433508318421191741886136781365102624725505327222341317544391810900098
24131001234702144200501816519311599904090606194984753842587622398776018408050245
57411602855060870889647897710470310136457737755482389335033937689298408667684282
15066373765614712211786775130358118845898882309478554825547809248442806614129828
27405878164907670403886160896655313460186264922042760067692235383478494519985672
05969875291596599841244594625422741323225727652524000665148313079224811241742584
64519514387812606321376453589275681583619617101851155025771270109223443949930789
48994750404287047493247048147066090211292167313905862438457453781042040498702821
43201376550202410506577825775917835692549415644757032237331025699960908320177827
85885998547062417881194489430344773709593495168731620634615217078096898397109727
53590949570167489887658749686740890549110678989462474318310617765270337415238713
77080071123656361017110132805242414547822099301651526247854381379689967721519278
96126828451450089931445135474441311260295571475700053699431432135256711052888170
16183804256755470528641042403865830064493168693765438364296560479053823886598989
258655438933191724193029337334607
Public Exponent E: '65537'
Public Key Algorithm:
key_size: '4096'
modulus_n: |-
70947787041544537301535901656242666061055377068594452089329839660022676089997787
91910048985433508318421191741886136781365102624725505327222341317544391810900098
24131001234702144200501816519311599904090606194984753842587622398776018408050245
57411602855060870889647897710470310136457737755482389335033937689298408667684282
15066373765614712211786775130358118845898882309478554825547809248442806614129828
27405878164907670403886160896655313460186264922042760067692235383478494519985672
05969875291596599841244594625422741323225727652524000665148313079224811241742584
64519514387812606321376453589275681583619617101851155025771270109223443949930789
48994750404287047493247048147066090211292167313905862438457453781042040498702821
43201376550202410506577825775917835692549415644757032237331025699960908320177827
85885998547062417881194489430344773709593495168731620634615217078096898397109727
53590949570167489887658749686740890549110678989462474318310617765270337415238713
77080071123656361017110132805242414547822099301651526247854381379689967721519278
96126828451450089931445135474441311260295571475700053699431432135256711052888170
16183804256755470528641042403865830064493168693765438364296560479053823886598989
258655438933191724193029337334607
public_exponent_e: '65537'
Validity:
Not After: '2035-06-04 11:04:38+00:00'
Not Before: '2015-06-04 11:04:38+00:00'
Version: 2
----------------------------------
----------Certificate #2----------
Extensions:
Authority Information Access:
Access Description:
- Access Location:
name: UniformResourceIdentifier
value: http://x1.i.lencr.org/
Access Method: CA_ISSUERS
Authority Key Identifier:
Key Identifier: 79B459E67BB6E5E40173800888C81A58F6E99B6E
Basic Constraints (critical):
CA: true
Certificate Policies:
- Policy 2.23.140.1.2.1: []
- Policy 1.3.6.1.4.1.44947.1.1.1: []
Crl Distribution Points:
- Full Name:
- name: UniformResourceIdentifier
value: http://x1.c.lencr.org/
Extended Key Usage:
- Client Authentication
- Server Authentication
Key Usage (critical): Digital Signature, Key Cert Sign, Crl Sign
Path Lenght: 0
Subject Key Identifier:
Subject Key Identifier: 142EB317B75856CBAE500940E61FAF9D8B14C2C6
Issuer: 'C: US, CN: ISRG Root X1, O: Internet Security Research Group'
Serial Number: 912B084ACF0C18A753F6D62E25A75F5A
Signature Algorithm: SHA256
Signature Value: |-
85CA4E473EA3F7854485BCD56778B29863AD754D1E963D336572542D81A0EAC3EDF820BF5FCCB770
00B76E3BF65E94DEE4209FA6EF8BB203E7A2B5163C91CEB4ED3902E77C258A47E6656E3F46F4D9F0
CE942BEE54CE12BC8C274BB8C1982FA2AFCD71914A08B7C8B8237B042D08F908573E83D904330A47
2178098227C32AC89BB9CE5CF264C8C0BE79C04F8E6D440C5E92BB2EF78B10E1E81D4429DB5920ED
63B921F81226949357A01D6504C10A22AE100D4397A1181F7EE0E08637B55AB1BD30BF876E2B2AFF
214E1B05C3F51897F05EACC3A5B86AF02EBC3B33B9EE4BDECCFCE4AF840B863FC0554336F668E136
176A8E99D1FFA540A734B7C0D063393539756EF2BA76C89302E9A94B6C17CE0C02D9BD81FB9FB768
D40665B3823D7753F88E7903AD0A3107752A43D8559772C4290EF7C45D4EC8AE468430D7F2855F18
A179BBE75E708B07E18693C3B98FDC6171252AAFDFED255052688B92DCE5D6B5E3DA7DD0876C8421
31AE82F5FBB9ABC889173DE14CE5380EF6BD2BBD968114EBD5DB3D20A77E59D3E2F858F95BB848CD
FE5C4F1629FE1E5523AFC811B08DEA7C9390172FFDACA20947463FF0E9B0B7FF284D6832D6675E1E
69A393B8F59D8B2F0BD25243A66F3257654D3281DF3853855D7E5D6629EAB8DDE495B5CDB5561242
CDC44EC6253844506DECCE005518FEE94964D44ECA979CB45BC073A8ABB847C2
Subject: 'C: US, CN: R3, O: Let''s Encrypt'
Subject Public Key Info:
Parameters:
Key Size: '2048'
Modulus N: |-
23607590023527405233483514815960094733025362836439268915823566209453533788829410
72961269318866403396560128488938220067229162371221935157944246629213402577917087
19030296756413322277205133704994143921747776293784333332814927820066440035084066
69842374574620445942041275265465205367002253387972103578862358103547035353751037
98689289193893953701371227696203175830312817811815601999781845906479379770505161
19310429773226949916112639110772354331197195042061738975342154862253911562311683
13218127765624386188467360149426877213161912342004781300247624712380387337803861
727744706241919394251136381590874774264144198228326996757
Public Exponent E: '65537'
Public Key Algorithm:
key_size: '2048'
modulus_n: |-
23607590023527405233483514815960094733025362836439268915823566209453533788829410
72961269318866403396560128488938220067229162371221935157944246629213402577917087
19030296756413322277205133704994143921747776293784333332814927820066440035084066
69842374574620445942041275265465205367002253387972103578862358103547035353751037
98689289193893953701371227696203175830312817811815601999781845906479379770505161
19310429773226949916112639110772354331197195042061738975342154862253911562311683
13218127765624386188467360149426877213161912342004781300247624712380387337803861
727744706241919394251136381590874774264144198228326996757
public_exponent_e: '65537'
Validity:
Not After: '2025-09-15 16:00:00+00:00'
Not Before: '2020-09-04 00:00:00+00:00'
Version: 2
----------------------------------
Chain certificate count: 2
Certificates.from_uri¶
from pki_tools import Chain
chain = Chain.from_uri(
[
"https://letsencrypt.org/certs/isrgrootx1.pem",
"https://letsencrypt.org/certs/lets-encrypt-r3.pem",
]
)
print(chain)
Print output
check_chain ¶
check_chain()
Validate the chain (if it contains more than one certificate) checking expiration and signatures of all certificates in the chain
Raises: |
|
---|
get_issuer ¶
get_issuer(signed: [Certificate, CertificateRevocationList]) -> Certificate
Returns the issuer of a signed entity
Parameters: |
|
---|
Returns:
The issuer of the signed
entity
Raises: |
|
---|