[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Poco Forums • View topic - new pgp verify script

new pgp verify script

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

new pgp verify script

Postby chgerwig » Wed Sep 15, 2004 6:40 pm

Hi!

Thanks to the help of Michael and Hogyt I am now able to present here a much easier to install script for GnuPG verify and decrypt with out the need of a batch file.
I use this script on a Win2k Sp4 PC with PocoMail 3.03 de and 3.2beta.
Code: Select all
{### GnuPG (Version 1.2.4) decrypt verify Email body
{ by Christian Gerwig 16.09.04
{ Script will check the message - also HTML - if PGP encryption
{ or signature is in it.
{ For encryption it will decrypt the message
{ For signature it will verify the signature against the pub keyring
{
{ !!! Check the path to your GPG.exe here !!!
set $GPGexe "c:\programme\gnupg\gpg.exe"

ReadRawBody $a %message
if "-----BEGIN PGP SIGNED" ^ $a  then verify
if "-----BEGIN PGP" ^ $a  then decrypt
Exit

:decrypt
ReadBody $a %message
AddStrings $GPGFile $ScriptPath message.gpg
SaveBody $a $GPGFile
Set $command "-o "
AddStrings $command $ScriptPath "message.asc --decrypt " $ScriptPath "message.gpg"
ExecuteAndWait $GPGexe $command
AddStrings $ASCFile $ScriptPath message.asc
OpenBody $a $ASCFile
AssignBody %message $a
DeleteFile $GPGFile
DeleteFile $ASCFile
Exit

:verify
ReadRawBody $a %message
AddStrings $SIGFile $ScriptPath message.sig
SaveBody $a $SIGFile
AddStrings $command "/c " $GPGexe " --verify " $ScriptPath "message.sig 2> " $ScriptPath "result.txt"
ExecuteAndWait "cmd" $command
AppendBody $a "+++++ Result from GnuPG: +++++"
AddStrings $TXTFile $ScriptPath result.txt
OpenBody $r $TXTFile
AppendBody $a $r
AppendBody $a "+++++ End Result GnuPG +++++"
AssignBody %message $a
DeleteFile $SIGFile
DeleteFile $TXTFile
Exit


Do not forget to set a filter that this script runs over any incoming message. Also it is important to change the path to your gpg.exe in the script.

I hope you like it and it saves you a lot of time like it does for me for verifying PGP Signatures.
Bye,
Christian
------------
Reseller of PocoMail in Austria
chgerwig
Poco Tourist
 
Posts: 17
Joined: Tue Aug 24, 2004 12:27 am
Location: Vienna, Austria

Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 2 guests

cron