Sorry, I was sleeping: There is a Crypto.cbc which seems to do the trick.
Met vriendelijke groet / With kind regards / mit besten Grüßen,
Coen Schalkwijk Software Engineer
coen.schalkwijk@rtl.nl mailto:coen.schalkwijk@rtl.nl
coen@rtlinteractief.nl mailto:coen@rtlinteractief.nl
+31 (0)35 671 8915
Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum wrote:
I don't know about 7.4, but this works in 7.6 at least:
Crypto.CBC cbc = Crypto.CBC(Crypto.AES); cbc->set_encrypt_key(Stdio.read_file(argv[1])); string iv = Crypto.Random.random_string(cbc->block_size()); cbc->set_iv(iv); string cleardata = Stdio.read_file(argv[2]); int pad = strlen(cleardata)%cbc->block_size(); if(pad) { pad = cbc->block_size()-pad; cleardata += "\0"*pad; } string cryptdata = ""; foreach(cleardata / (cbc->block_size()*4096.0), string blk) cryptdata += cbc->crypt(blk);
The reason for the loop is that the crypto module will crash if you try to encrypt too much data at once...
__________________________________________________________ Deze e-mail en de inhoud is vertrouwelijk en uitsluitend bestemd voor de geadresseerde(n). Indien u niet de geadresseerde bent van deze e-mail verzoeken wij u dit direct door te geven aan de verzender door middel van een reply e-mail en de ontvangen e-mail uit uw systemen te verwijderen. Als u geen geadresseerde bent, is het niet toegestaan om kennis te nemen van de inhoud, deze te kopieren, te verspreiden, bekend te maken aan derden noch anderszins te gebruiken.
The information contained in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Please notify us immediately if you have received it in error by reply e-mail and then delete this message from your system. __________________________________________________________