#!/usr/bin/perl print "content-type: text/html \n\n"; use strict; use warnings; use Crypt::CBC; use Crypt::Cipher::AES; my $prepend = '@'; my $user_string = 'VendorTxCode=TxCode-1310917599-223087284&Amount=36.95&Currency=GBP&Description=description&CustomerName=FnameSurname&CustomerEMail=customer@example.com&BillingSurname=Surname&BillingFirstnames=Fname&BillingAddress1=BillAddress Line1&BillingCity=BillCity&BillingPostCode=W1A1BL&BillingCountry=GB&BillingPhone=447933000000&DeliveryFirstnames=Fname&DeliverySurname=Surname&DeliveryAddress1=BillAddressLine 1&DeliveryCity=BillCity&DeliveryPostCode=W1A1BL&DeliveryCountry=GB&DeliveryPhone=447933000000&SuccessURL=https://example.com/success&FailureURL=https://example.com/failure'; my $key = '55a51621a6648525'; my $iv = '55a51621a6648525'; my $cipher = Crypt::CBC->new( -cipher => 'Crypt::Cipher::AES', -key => $key, -iv => $iv, -padding => 'standard', -header => 'none', -blocksize => '16' ); my $encrypted = uc $cipher->encrypt_hex($user_string); my $decrypted = $cipher->decrypt_hex($encrypted); print $prepend,$encrypted, "\n"; print $decrypted, "\n";