[Rt-commit] rt branch, 4.2/smime-certificate-newlines, created. rt-4.2.0rc1-6-ge4a8072

Alex Vandiver alexmv at bestpractical.com
Wed Sep 18 16:13:28 EDT 2013


The branch, 4.2/smime-certificate-newlines has been created
        at  e4a80727b5858099d70bfa8bffb9704b0d9a4034 (commit)

- Log -----------------------------------------------------------------
commit e4a80727b5858099d70bfa8bffb9704b0d9a4034
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Sep 18 16:11:09 2013 -0400

    Allow for extra whitespace (such as \r) before end-of-line in certificates
    
    Because we must decode the PEM format to DER before feeding to
    Crypt::X509, we apply a regular expression to extract PEM data.
    However, the regex must account for, and accept, \r\n-style newlines
    which may arise from pasting content into the "SMIME Certificate" admin
    interface.

diff --git a/lib/RT/Crypt/SMIME.pm b/lib/RT/Crypt/SMIME.pm
index 7c41701..1458d71 100644
--- a/lib/RT/Crypt/SMIME.pm
+++ b/lib/RT/Crypt/SMIME.pm
@@ -844,9 +844,9 @@ sub GetCertificateInfo {
         @_,
     );
 
-    if ($args{Certificate} =~ /^-----BEGIN \s+ CERTIFICATE-----$
+    if ($args{Certificate} =~ /^-----BEGIN \s+ CERTIFICATE----- \s* $
                                 (.*?)
-                               ^-----END \s+ CERTIFICATE-----$/smx) {
+                               ^-----END \s+ CERTIFICATE----- \s* $/smx) {
         $args{Certificate} = MIME::Base64::decode_base64($1);
     }
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list