Skip to content

Commit 88be34e

Browse files
authored
Update certs-from-mozilla.py (#7578)
* Update certs-from-mozilla.py Check if ar exists, if not tell the user what to get to prevent issue #7300 also dynamically get certs instead of hardcoded row item #7573 (comment) changed comment for missing ar exception updated path and check for openssl
1 parent bfecdb0 commit 88be34e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

+11-1
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
@@ -21,6 +23,12 @@
2123
except Exception:
2224
from io import StringIO
2325

26+
# check if ar and openssl are available
27+
if which('ar') is None and not os.path.isfile('./ar') and not os.path.isfile('./ar.exe'):
28+
raise Exception("You need the program 'ar' from xtensa-lx106-elf found here: (esp8266-arduino-core)/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/bin/ar")
29+
if which('openssl') is None and not os.path.isfile('./openssl') and not os.path.isfile('./openssl.exe'):
30+
raise Exception("You need to have openssl in PATH, installable from https://www.openssl.org/")
31+
2432
# Mozilla's URL for the CSV file with included PEM certs
2533
mozurl = "https://ccadb-public.secure.force.com/mozilla/IncludedCACertificateReportPEMCSV"
2634

@@ -35,7 +43,9 @@
3543
csvReader = csv.reader(csvFile)
3644
for row in csvReader:
3745
names.append(row[0]+":"+row[1]+":"+row[2])
38-
pems.append(row[32])
46+
for item in row:
47+
if item.startswith("'-----BEGIN CERTIFICATE-----"):
48+
pems.append(item)
3949
del names[0] # Remove headers
4050
del pems[0] # Remove headers
4151

0 commit comments

Comments
 (0)