Subject: | Decryption not working |
Hi,
I'm trying to debug my form, but I can't decrypt it. I've created a
dummy paypal cert and key to test.
(taken from:
https://www.paypaldeveloper.com/pdn/board/message?board.id=ewp&thread.id=541)
Here's an openssl session:
openssl smime -sign -signer public-test.pem -inkey private-test.key
-outform der -nodetach -binary -in test.plain | openssl smime -encrypt
-des3 -binary -outform pem -out test.enc paypal-dummy-cert.pem
Decrypting:
openssl smime -decrypt -inform pem -in test.enc -recip
paypal-dummy-cert.pem -inkey paypal-dummy.key | openssl smime -verify
-inform der -CAfile public-test.pem
Which all works fine.
Encrypting via your module:
use strict;
use warnings;
use Business::PayPal::EWP qw(SignAndEncrypt);
my $form =
'cert_id=3TFC4UDJER95J,cmd=_xclick,business=ghenry_1188297224_biz@suretecsystems.com,item_name=Flexi
Time Manager 3 Month
Subscription,item_number=FTM3MON,amount=30.00,page_style=FTM,no_shipping=1,return=http://ftm.suretecsystems.com/subscribe/payment/successful/,no_note=1,currency_code=GBP,lc=GB,bn=PP-BuyNowBF,custom=115';
my $cert = 'public-test.pem';
my $key = 'private-test.key';
my $ppcert = 'paypal-dummy-cert.pem';
my $encrypted = SignAndEncrypt( $form, $key, $cert, $ppcert );
print $encrypted, "\n";
which I > test.enc
running the same decrypt openssl command as above:
openssl smime -decrypt -inform pem -in test.enc -recip
paypal-dummy-cert.pem -inkey paypal-dummy.key | openssl smime -verify
-inform der -CAfile public-test.pem
Error decrypting PKCS#7 structure
12550:error:21072071:PKCS7 routines:PKCS7_decrypt:wrong content
type:pk7_smime.c:440:
Error reading S/MIME message
12551:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too
long:asn1_lib.c:150:
Please help,
Thanks.