mcrypt

Part II: How to make Ruby AES-256-CBC and PHP MCRYPT_RIJNDAEL_128 play well together

This question is a continuation of my last one, regarding How to make Ruby AES-256-CBC and PHP MCRYPT_RIJNDAEL_128 play well together. I've got that working now, but I'm still struggling to go the other direction. The PHP generated cryptogram appears to have all the information that was provided, but I cannot get the Ruby code to decry...

PHP - mcrypt 2 way encryption issue with base64 encoding and serialization

I am working on a form spam protection class which essentially replaces form field names with an encrypted value using mcrypt. The problem with this is that mcrypt encryption is not limited to only alphanumeric characters which would invalidate form fields. Given the code below, can you think of any reason why I'd be having problems de...

PHPMyAdmin is complaining that 'mcrypt' isn't available -- am I bothered?

I've set up PHPMyAdmin on a Mac, and it's complaining that it can't load the 'mcrypt' function(s). Apparently the stock install of PHP on Macs doesn't have it. Can anyone tell me what the implications are? Neither the PHPMyAdmin documentation or the PHP documentation seems to tell me what kind of problem, if any, this will cause me. Th...

PHP - What encoding does mcrypt use on an encrypted string?

Using PHP I'm trying to convert the cipher text generated by mcrypt into binary but when I try and convert it back to the cipher text it doesnt get converted back properly so it cant be decrypted. I'm assuming my encodings are getting messed up somewhere but I dont know where to start to figure it out. Here is a link to the site http://d...

PHP crypt and salt - more clarification please

I was here yesterday and got some really great answers. I took what I got and put together, what I think will be a fairly secure algorithm. I'm having a problem using blowfish with a for loop that generates the salt. I'm using base64 characters and a for loop to get a random string. I want to take this generated string and insert it int...

Where should one store the cipher key when using AES encryption with PHP?

I am implementing AES-256 bit encrpytion in my web app: http://www.utoxin.name/2009/07/automatic-db-field-encryption-in-cakephp/ One of the steps says to store the cipher used and key in a boostrap file. But what is stopping someone from scanning the file system with PS or something and decrypting the data? What is the best way to se...

PHP Mcrypt - Encrypting / Decrypting file

Trying to write a couple of functions that will encrypt or decrypt a file and am using the class found here to try and accomplish this: http://www.itnewb.com/v/PHP-Encryption-Decryption-Using-the-MCrypt-Library-libmcrypt The encryption function below seems to work, in that it appears to encrypt the file and place it in the intended d...

PHP mcrypt usage class?

I'm pretty new at this. Tried to make sense of the manual page for mcrypt at PHP.net when I thought a good tutorial would do a better job. So I searched yet without anything substantial. I also tried one of the examples of using mcrypt to perform the encryption and decryption with 2 functions, but it gives a warning of "Size of key is t...

AES encryption with PyCrypto and decryption with mcrypt

For some sensitive data I decided to store it AES-encrypted on disc. I've implemented the encryption using PyCrypto. Furthermore, the data is important, and the stored encrypted data will be my only copy of it (backups aside), so I looked for some means of retrieving the data without using PyCrypto to have a fallback given the possibili...

Mcrypt for rijndael-128 : how do I set the Initialization Vector?

I would like to encrypt a file using AES (rijndael 128) with the mcrypt command line tool. I would like to set the initialization vector to a specific value. How can I do this? I am pretty new to encryption, btw. Thanks! ...

Encrypting with Perl CBC and decrypting with PHP mcrypt

I have an encrypted string that was encrypted with Perl Crypt::CBC (Rijndael,cbc). The original plaintext was encrypted with encrypt_hex() method of Crypt::CBC. $encrypted_string = '52616e646f6d49567b2c89810ceddbe8d182c23ba5f6562a418e318b803a370ea25a6a8cbfe82bc6362f790821dce8441a790a7d25d3d9ea29f86e6685d0796d'; I have the 32 character...

mcrypt decoding errors

Hi, I have a few issues with the following php functions (part of a bigger class). //encode public function acc_pw_enc($text, $key) { $text_num = str_split($text, 8); $text_num = 8 - strlen($text_num[count($text_num)-1]); for ($i=0; $i < $text_num; $i++) { $text = $text . chr($text_num); } $cipher ...

Basic MCrypt string encryption with password implementation in C++

What is the basic setup on the subject? Let say I have a QByteArray, and I need to encrypt it with simple password. And the application has to be portable to Linux, Windows and Mac. Do I have to include mcrypt.h and mcrypt.c in the QT project? And then decrypt it in another piece of code Just a very simple setup ...

Using mcrypt to pass data across a webservice is failing

Hi I'm writing an error handler script which encrypts the error data (file, line, error, message etc) and passes the serialized array as a POST variable (using curl) to a script which then logs the error in a central db. I've tested my encrypt/decrypt functions in a single file and the data is encrypted and decrypted fine: define('KEY...

mcrypt_generic vs mcrypt_encrypt

Does anyone know the difference between mcrypt_generic and mcrypt_encrypt when it comes to encryption in PHP? ...

Which PHP mcrypt cipher is safest?

So guys, there's plenty of different ciphers available - but which one is the safest to use nowadays? List: http://www.php.net/manual/en/mcrypt.ciphers.php ...

libmcrypt and MS Visual C++

Has anyone tried using libmcrypt and visual c++? I was trying to use Crypto++ but it seems not fully compatible - and I need to decrypt data encrypted in PHP using linux libmcrypt. I found only cygwin version of libmcrypt but no .lib files or header. I'm using RIJNDAEL_128 - maybe there is easier way to decrypt it in Visual C++? Thank...

PHP mcrypt // Chilkat AES encryption -- integration

I'm trying to decrypt a string using PHP which was encrypted using a Chilkat library. VB Encryption: Dim password As String password = "foobar" crypt.CryptAlgorithm = "aes" crypt.CipherMode = "cbc" crypt.KeyLength = 128 ' Generate a binary secret key from a password string ' of any length. For 128-bit encryption, GenEncodedSecretK...

Is it possible to decrypt files encrypted with php mcrypt_encode with third party utilities?

I am inexperienced with symmetric encryption. I am encrypting a pdf file in php using the following code: $source_filepath = RB::get('docroot') . RB::get('baseUrl') . '/submissions/' . $this->_filename; $encrypted_filepath = $source_filepath . '.nc'; $pdf_data = file_get_contents($source_filepath); $encrypted_data = mcrypt_encrypt(MCRY...

I have a generic implementation of PHP mcrypt module and its not decrypting

class Crypt_Data { protected $_mcrypt=null; protected $_iv=null; protected $_key=null; public function __construct() { $this->_mcrypt = mcrypt_module_open('rijndael_256', '', 'cbc', ''); $key_size = mcrypt_enc_get_key_size($this->_mcrypt); for($i=0;$i<$key_size;$i++) $test_key .= "0";...