Changeset

1395:33f132c3f4b7

mod_s2s_auth_dane: Use PEM to DER function from util.x509 (0.10+)
author Kim Alvefur <zash@zash.se>
date Sun, 27 Apr 2014 01:40:20 +0200
parents 1394:50f986deb3f7
children 1396:cf4e39334ef7
files mod_s2s_auth_dane/mod_s2s_auth_dane.lua
diffstat 1 files changed, 1 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mod_s2s_auth_dane/mod_s2s_auth_dane.lua	Sun Apr 27 01:24:03 2014 +0200
+++ b/mod_s2s_auth_dane/mod_s2s_auth_dane.lua	Sun Apr 27 01:40:20 2014 +0200
@@ -22,25 +22,17 @@
 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;
 
 if not dns_lookup.types or not dns_lookup.types.TLSA then
 	module:log("error", "No TLSA support available, DANE will not be supported");
 	return
 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" };