From e6e73f790cf6d28c43e823eea348aa3865add388 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Sun, 18 May 2008 16:04:19 +0200 Subject: [PATCH] Add support for OpenSSL RSA private key files --- dowkd.in | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dowkd.in b/dowkd.in index 9d2135b..bb149af 100644 --- a/dowkd.in +++ b/dowkd.in @@ -348,6 +348,24 @@ sub from_pem ($) { warn "$name:$lineno: failed to parse certificate\n"; return 1; } + } elsif ($line =~ /^-----BEGIN RSA PRIVATE KEY-----/) { + my $lineno = $.; + $tmp or $tmp = new File::Temp; + clear_tmp $tmp; + do { + print $tmp $line or die "print: $!"; + goto LAST_RSA if $line =~ /^-----END RSA PRIVATE KEY-----/; + } while ($line = <$src>); + LAST_RSA: + $tmp->flush or die "flush: $!"; + my $mod = safe_backtick qw/openssl rsa -noout -modulus -in/, $tmp; + if ($mod) { + openssl_modulus_check "$name:$lineno", $mod; + $found = 1; + } else { + warn "$name:$lineno: failed to parse RSA private key\n"; + return 1; + } } } -- 2.11.4.GIT