Skip to content

Commit f809bd9

Browse files
authored
Update certs-from-mozilla.py
Check if ar exists, if not tell the user what to get to prevent issue esp8266#7300 also dynamically get certs instead of hardcoded row item esp8266#7573 (comment)
1 parent e636a65 commit f809bd9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

libraries/ESP8266WiFi/examples/BearSSL_CertStore/certs-from-mozilla.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import csv
1212
import os
1313
import sys
14+
from shutil import which
15+
1416
from subprocess import Popen, PIPE, call
1517
try:
1618
from urllib.request import urlopen
@@ -20,7 +22,9 @@
2022
from StringIO import StringIO
2123
except Exception:
2224
from io import StringIO
23-
25+
#check if ar is available
26+
if which('ar') is None and not os.path.isfile('./ar') and not os.path.isfile('./ar.exe'):
27+
raise Exception("You need the program 'ar' from xtensa-lx106-elf: https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/index.html#setup-toolchain")
2428
# Mozilla's URL for the CSV file with included PEM certs
2529
mozurl = "https://ccadb-public.secure.force.com/mozilla/IncludedCACertificateReportPEMCSV"
2630

@@ -35,7 +39,9 @@
3539
csvReader = csv.reader(csvFile)
3640
for row in csvReader:
3741
names.append(row[0]+":"+row[1]+":"+row[2])
38-
pems.append(row[32])
42+
for item in row:
43+
if item.startswith("'-----BEGIN CERTIFICATE-----"):
44+
pems.append(item)
3945
del names[0] # Remove headers
4046
del pems[0] # Remove headers
4147

0 commit comments

Comments
 (0)