@@ -962,7 +962,11 @@ sub smime_encrypt {
962
962
# encrypt the incoming message parse it.
963
963
my $smime = Crypt::SMIME-> new();
964
964
# FIXME: Add intermediate CA certificates if any.
965
- $smime -> setPublicKey($cert );
965
+ unless (eval { $smime -> setPublicKey($cert ) }) {
966
+ $log -> syslog(' err' , ' Unable to S/MIME encrypt message: %s' ,
967
+ $EVAL_ERROR );
968
+ return undef ;
969
+ }
966
970
967
971
# don't; cf RFC2633 3.1. netscape 4.7 at least can't parse encrypted
968
972
# stuff that contains a whole header again... since MIME::Tools has
@@ -1055,9 +1059,17 @@ sub smime_sign {
1055
1059
my $smime = Crypt::SMIME-> new();
1056
1060
# FIXME: Add intermediate CA certificates if any.
1057
1061
if (length $key_passwd ) {
1058
- $smime -> setPrivateKey($key , $cert , $key_passwd );
1062
+ unless (eval { $smime -> setPrivateKey($key , $cert , $key_passwd ) }) {
1063
+ $log -> syslog(' err' , ' Unable to S/MIME sign message: %s' ,
1064
+ $EVAL_ERROR );
1065
+ return undef ;
1066
+ }
1059
1067
} else {
1060
- $smime -> setPrivateKey($key , $cert );
1068
+ unless (eval { $smime -> setPrivateKey($key , $cert ) }) {
1069
+ $log -> syslog(' err' , ' Unable to S/MIME sign message: %s' ,
1070
+ $EVAL_ERROR );
1071
+ return undef ;
1072
+ }
1061
1073
}
1062
1074
my $msg_string = eval {
1063
1075
$smime -> sign($dup_head -> as_string . " \n " . $self -> body_as_string);
0 commit comments