I have had a browse around CPAN, and can't quite find what I'm looking
for, so I was wondering if anyone might be able to point me in the
I have a C program which does the following:
Given a pseudo-random salt (8 bytes) and user-supplied passphrase, it
uses RFC3686 (PKCS #5) to produce a 256-bit AES key, and a 16-byte IV.
The salt value is broadcast as a header to the ciphertext.
It encrypts the plaintext in CTR mode, XORing an 8-byte counter into
the IV to give a counter block prior to each encryption.
It appends a 16-byte MAC produced using OMAC1/CMAC to the ciphertext.
My quest is to find a module or set of modules which allow me to
duplicate this processing in Perl. The Rijndael modules I found don't
seem to support CTR mode, so I'd have to roll that myself in the body
of the code, I guess; the only other CTR-related module I found seems
not to support an 8-byte counter and confesses itself to be very slow.
I found a Digest::CMAC module, but nothing for the PKCS #5 key