I have a program listed below that encrypts some data, that will be decrypted on a .net machine. It appears that I'm performing PKCS#5 padding and .net will only except PKCS#7 padding. I'm looking for a sub routine that will perform PKCS#7 padding or any help in getting this to encrypt with PKCS#7 padding. Thanks in advance for any help with this.
#!/usr/local/bin/perl -w
use Crypt::Rijndael;
use Crypt::CBC;
use MIME::Base64;
use Encode;
my $venture_aes_key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
my $venture_iv_key = "KKKKKKKKKKKKKKKK";
my $PORTAL_ACCTNUM = "0123456789";
my $string = decode("UTF-8", $PORTAL_ACCTNUM);
my $us = encode("UTF-16le", $string);
my $AES_cipher = Crypt::CBC->new({
key => $venture_aes_key, # 256 bits
cipher => "Crypt::Rijndael",
iv => $venture_iv_key, # 128 bits
literal_key => 1,
padding => "standard",
blocksize => 16,
header => "none",
keysize => 32 # 256/8
});
## Encrypt Data
my $encrypted_acctnum = $AES_cipher->encrypt($us);
$encoded = encode_base64($encrypted_acctnum, '');
print $encoded;
exit;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.