1
2
3
4
5
6
7
MIME-Version: 1.0
Content-Disposition: attachment; filename="smime.p7m"
Content-Type: application/pkcs7-mime; smime-type=enveloped-data; name="smime.p7m"
Content-Transfer-Encoding: base64
E2E Test-Nachricht
MFIGCSqGSIb3DQEHA6BFMEMCAQAxADA8BgkqhkiG9w0BBwEwHQYJYIZIAWUDBAEC
BBCCZtHO+nhKZXb8wZxm6jeRgBCgqKSUsILqhDbBbpjxc0j5
1 2 3
$msg->attr('Content-Disposition'=>'attachment; filename=smime.p7m'); $msg->attr('Content-Type'=>'application/x-pkcs7-mime; smime-type=enveloped-data; "name=smime.p7m"'); $msg->attr('Content-Transfer-Encoding'=>'base64');
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/usr/bin/perl use strict; my $body="body.msg"; my $smime="smime.msg"; my $publickey="key.pem"; my $subject="Test-Nachricht E2E-verschluesselt"; my $message='Das hier ist eine ganz geheime Nachricht :-P'; my $orig='absender@example.com'; my $rec='empfaenger@example.com'; open(BODY,">$body") or die ("Kann File $body nicht oeffnen !\n"); print BODY $message; close (BODY); my $message=`/usr/bin/openssl smime -encrypt -text -in $body -out $smime -from $orig -to $rec -subject "$subject" $publickey`; if (my $mail=`/usr/lib/sendmail $rec <$smime`) { print "Fehler beim Mailversand: $mail\n"; } unlink $body; unlink $smime;