[OpenWrt-Devel] [PATCH 1/4] Change certificates extension to .pem

Cristian Morales Vega cristian at samknows.com
Wed Sep 24 10:15:51 EDT 2014


.crt is a generic extension that doesn't specify the encoding.
OpenSSL's c_rehash expects the .pem extension.

Signed-off-by: Cristian Morales Vega <cristian at samknows.com>
---
 package/system/ca-certificates/Makefile            |  2 +-
 .../patches/010-pem_extension.patch                | 41 ++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 package/system/ca-certificates/patches/010-pem_extension.patch

diff --git a/package/system/ca-certificates/Makefile b/package/system/ca-certificates/Makefile
index 7f38c86..cd29c0a 100644
--- a/package/system/ca-certificates/Makefile
+++ b/package/system/ca-certificates/Makefile
@@ -33,7 +33,7 @@ endef
 
 define Package/ca-certificates/install
 	$(INSTALL_DIR) $(1)/etc/ssl/certs
-	$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/ca-certificates/*/*.crt $(1)/etc/ssl/certs/
+	$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/ca-certificates/*/*.pem $(1)/etc/ssl/certs/
 endef
 
 $(eval $(call BuildPackage,ca-certificates))
diff --git a/package/system/ca-certificates/patches/010-pem_extension.patch b/package/system/ca-certificates/patches/010-pem_extension.patch
new file mode 100644
index 0000000..6eb88f5
--- /dev/null
+++ b/package/system/ca-certificates/patches/010-pem_extension.patch
@@ -0,0 +1,41 @@
+--- a/mozilla/certdata2pem.py
++++ b/mozilla/certdata2pem.py
+@@ -122,10 +122,10 @@ for obj in objects:
+                                       .replace(')', '=')\
+                                       .replace(',', '_')
+         bname = bname.decode('string_escape')
+-        fname = bname + '.crt'
++        fname = bname + '.pem'
+         if os.path.exists(fname):
+             print "Found duplicate certificate name %s, renaming." % bname
+-            fname = bname + '_2.crt'
++            fname = bname + '_2.pem'
+         f = open(fname, 'w')
+         f.write("-----BEGIN CERTIFICATE-----\n")
+         f.write("\n".join(textwrap.wrap(base64.b64encode(obj['CKA_VALUE']), 64)))
+--- a/mozilla/Makefile
++++ b/mozilla/Makefile
+@@ -6,9 +6,9 @@ all:
+ 	python certdata2pem.py
+ 
+ clean:
+-	-rm -f *.crt
++	-rm -f *.pem
+ 
+ install:
+-	for p in *.crt; do \
++	for p in *.pem; do \
+ 	 install -m 644 $$p $(CERTSDIR)/$$p ; \
+ 	done
+--- a/spi-inc.org/Makefile
++++ b/spi-inc.org/Makefile
+@@ -7,7 +7,8 @@ all:
+ clean:
+ 
+ install:
+-	for p in *.crt; do \
++	mv spi-cacert-2008.crt spi-cacert-2008.pem
++	for p in *.pem; do \
+ 	 install -m 644 $$p $(CERTSDIR)/$$p ; \
+ 	done
+ 
-- 
1.9.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list