certwatch: fix handling of files containing private keys

This commit is contained in:
Joe Orton 2014-02-13 22:45:00 +00:00
parent abc69c0f6c
commit c0b5ca0b27
2 changed files with 7 additions and 2 deletions

View File

@ -4,7 +4,7 @@
Summary: SSL certificate and key management utilities
Name: crypto-utils
Version: 2.4.1
Release: 50%{?dist}
Release: 51%{?dist}
Group: Applications/System
# certwatch.c is GPLv2
# pemutil.c etc are (MPLv1.1+ or GPLv2+ or LPGLv2+)
@ -135,6 +135,9 @@ chmod -R u+w $RPM_BUILD_ROOT
%{perl_vendorarch}/auto/Crypt
%changelog
* Thu Feb 13 2014 Joe Orton <jorton@redhat.com> - 2.4.1-51
- certwatch: fix handling of files containing private keys
* Thu Feb 13 2014 Joe Orton <jorton@redhat.com> - 2.4.1-50
- genkey: skip temporary cert generation for CSR case

View File

@ -136,8 +136,10 @@ static SECStatus ReadDERFromFile(SECItem *der, PRFileDesc *inFile, PRBool ascii)
return SECFailure;
}
body = strstr(asc, "-----BEGIN CERTIFICATE");
if (!body) body = strstr(asc, "-----BEGIN X509 CERTIFICATE");
/* check for headers and trailers and remove them */
if ((body = strstr(asc, "-----BEGIN")) != NULL) {
if (body) {
char *trailer = NULL;
asc = body;
body = PORT_Strchr(body, '\n');