summaryrefslogtreecommitdiffstats
path: root/extensions/SecureMail
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2012-03-06 17:24:42 +0100
committerByron Jones <bjones@mozilla.com>2012-03-06 17:24:42 +0100
commit22114cb2da0ec6e9939d0d03b4714d74b7cad71f (patch)
treef6a51dab82f5f3741eafa46289dfea899cdc726b /extensions/SecureMail
parent36f5200f52ea5df81e66906f56ead47edde832c9 (diff)
downloadbugzilla-22114cb2da0ec6e9939d0d03b4714d74b7cad71f.tar.gz
bugzilla-22114cb2da0ec6e9939d0d03b4714d74b7cad71f.tar.xz
Bug 729558: fix issue in securemail with pgp and unicode characters
Diffstat (limited to 'extensions/SecureMail')
-rw-r--r--extensions/SecureMail/Extension.pm13
-rw-r--r--extensions/SecureMail/template/en/default/hook/global/user-error-errors.html.tmpl4
2 files changed, 9 insertions, 8 deletions
diff --git a/extensions/SecureMail/Extension.pm b/extensions/SecureMail/Extension.pm
index ca5516c0a..97722d9ac 100644
--- a/extensions/SecureMail/Extension.pm
+++ b/extensions/SecureMail/Extension.pm
@@ -28,6 +28,7 @@ use Bugzilla::Object;
use Bugzilla::User;
use Bugzilla::Util qw(correct_urlbase trim trick_taint);
use Bugzilla::Error;
+use Crypt::OpenPGP::Armour;
use Crypt::OpenPGP::KeyRing;
use Crypt::OpenPGP;
use Crypt::SMIME;
@@ -86,10 +87,9 @@ sub object_validators {
if ($value =~ /PUBLIC KEY/) {
# PGP keys must be ASCII-armoured.
- my $ring = new Crypt::OpenPGP::KeyRing(Data => $value);
- $ring->read if $ring;
- if (!defined $ring || !scalar $ring->blocks) {
- ThrowUserError('securemail_invalid_key');
+ if (!Crypt::OpenPGP::Armour->unarmour($value)) {
+ ThrowUserError('securemail_invalid_key',
+ { errstr => Crypt::OpenPGP::Armour->errstr });
}
}
elsif ($value =~ /BEGIN CERTIFICATE/) {
@@ -100,12 +100,12 @@ sub object_validators {
trick_taint($value);
my $smime = Crypt::SMIME->new();
-
eval {
$smime->setPublicKey([$value]);
};
if ($@) {
- ThrowUserError('securemail_invalid_key');
+ ThrowUserError('securemail_invalid_key',
+ { errstr => $@ });
}
}
else {
@@ -276,6 +276,7 @@ sub _make_secure {
Cipher => 'CAST5',
Armour => 1);
if (defined $encrypted) {
+ $email->encoding_set('');
$email->body_set($encrypted);
}
else {
diff --git a/extensions/SecureMail/template/en/default/hook/global/user-error-errors.html.tmpl b/extensions/SecureMail/template/en/default/hook/global/user-error-errors.html.tmpl
index f48a5389f..46b093674 100644
--- a/extensions/SecureMail/template/en/default/hook/global/user-error-errors.html.tmpl
+++ b/extensions/SecureMail/template/en/default/hook/global/user-error-errors.html.tmpl
@@ -23,5 +23,5 @@
that you are entering either an ASCII-armored PGP/GPG public key,
including the "BEGIN PGP PUBLIC KEY BLOCK" and "END PGP PUBLIC KEY BLOCK"
lines, or a PEM format (Base64-encoded X.509) S/MIME key, including the
- BEGIN CERTIFICATE and END CERTIFICATE lines.
-[% END %] \ No newline at end of file
+ BEGIN CERTIFICATE and END CERTIFICATE lines.<br><br>[% errstr FILTER html %]
+[% END %]