File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 5
5
from requests import Session
6
6
import sys
7
7
8
- ca_url_pattern = re .compile (r'CA Issuers \ - URI:(\S+)\n ' )
8
+ ca_url_pattern = re .compile (r'CA Issuers - URI:(\S+)' )
9
9
10
10
class CertChainBuilder :
11
11
def get_next_cert_url (self , cert_data : bytes ):
@@ -46,7 +46,7 @@ def feed(self, inital_cert: bytes):
46
46
next_url = self .get_next_cert_url (inital_cert )
47
47
while next_url :
48
48
if self .verbose :
49
- print (f"Fetching next certificate from { next_url } " , file = sys . stderr )
49
+ print (f"Fetching next certificate from { next_url } " )
50
50
next_cert = self .get_cert_from_url (next_url )
51
51
next_url = self .get_next_cert_url (next_cert )
52
52
@@ -59,6 +59,7 @@ def build_chain(self) -> str:
59
59
# Intermediate Certs: Highest -> Lowest (in the context of self.certs, this means from higher indices to lower)
60
60
# Initial: self.certs[0]
61
61
# Root: self.certs[-1]
62
+ assert len (self .certs ) >= 2
62
63
chain = [self .get_cert_pem (self .certs [0 ])]
63
64
for cert in self .certs [- 2 :0 :- 1 ]: # Starts from the second highest index and goes to the second lowest index
64
65
chain .append (self .get_cert_pem (cert ))
You can’t perform that action at this time.
0 commit comments