changeset 1412:d85695be0441

Backout 33f132c3f4b7 until 0.10
author Kim Alvefur <zash@zash.se>
date Thu, 15 May 2014 11:12:31 +0200 (2014-05-15)
parents 8626abe100e2
children cfe360d9d82c
files mod_s2s_auth_dane/mod_s2s_auth_dane.lua
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_s2s_auth_dane/mod_s2s_auth_dane.lua	Thu May 08 15:43:58 2014 +0200
+++ b/mod_s2s_auth_dane/mod_s2s_auth_dane.lua	Thu May 15 11:12:31 2014 +0200
@@ -22,11 +22,11 @@
 local set = require"util.set";
 local dns_lookup = require"net.adns".lookup;
 local hashes = require"util.hashes";
+local base64 = require"util.encodings".base64;
 local idna_to_ascii = require "util.encodings".idna.to_ascii;
 local idna_to_unicode = require"util.encodings".idna.to_unicode;
 local nameprep = require"util.encodings".stringprep.nameprep;
 local cert_verify_identity = require "util.x509".verify_identity;
-local pem2der = require"util.x509".pem2der;
 
 do
 	local net_dns = require"net.dns";
@@ -36,6 +36,14 @@
 	end
 end
 
+local pat = "%-%-%-%-%-BEGIN ([A-Z ]+)%-%-%-%-%-\r?\n"..
+"([0-9A-Za-z=+/\r\n]*)\r?\n%-%-%-%-%-END %1%-%-%-%-%-";
+local function pem2der(pem)
+	local typ, data = pem:match(pat);
+	if typ and data then
+		return base64.decode(data), typ;
+	end
+end
 local use_map = { ["DANE-EE"] = 3; ["DANE-TA"] = 2; ["PKIX-EE"] = 1; ["PKIX-CA"] = 0 }
 
 local implemented_uses = set.new { "DANE-EE", "PKIX-EE" };