mcrypt

mcrypt and IIS - module does not load in PHP

I have Windows 2003 Standard, IIS 6, PHP, MySQL and amy trying to get mcrypt working so I can use phpMyAdmin. I have uncommended php_mcrypt.dll in php.ini and this file is in my extensions folder (c:\php). I have downloaded libmcrypt.dll to c:\php, c:\php\ext, c:\windows, c:\windows\system32. I have also found a second version of this ...

Encrypting data in Cocoa, decoding in PHP (and vice versa)

The situation I'm trying to solve: in my Cocoa app, I need to encrypt a string with a symmetric cipher, POST it to PHP, and have that script decode the data. The process needs to work in reverse for returning an answer (PHP encodes, Cocoa decodes). I'm missing something because even though I can get both the key and initialization vect...

Best practices for storing bank information in a database

Summary of answers: Don't do it. The legal and financial implications will be disastrous. Look for established third party solutions or hire an expert. Never store any sensitive information on a shared server. Research for the most appropriate encryption mechanism. I am buiding a website for a customer that needs to store his client...

What's needed for PHP's mcrypt_decrypt()?

I have a script that uses mcrypt_decrypt() function, but I get the following error Fatal error: Call to undefined function mcrypt_decrypt() What modules/libraries do I need to include to use this function? Or is there another reason I'm getting the error? Thanks ...

PHP mycrypt problem, weird characters/warnings.

I have no idea what I'm doing wrong. I just need to be able to encrypt and decrypt without getting weird characters or warnings. It says I'm supposed to be using an IV of length 16 and that I'm using a length of 9 but "0123456789abcdef" is 16 characters. Warning: mcrypt_generic_init() [function.mcrypt-generic-init]: Iv size incorre...

How to use CBC encryption mode in PHP

Hi, I'm trying to encrypt a string, 50-150 characters long, with AES in a mode other than ECB (due to security issues). I wrote an encryption class and am able to encrypt/decrypt perfectly in ECB mode, however when I switch to CBC, CTR or OFB mode, I fail to get the original plaintext back. Source: define('DEFAULT_ENCRYPTION_KEY', 'as...

Transfering encrypted data server to server, between 2 PHP scripts

I need to transfer data from a PHP script on my local server to a remote API (also written in PHP) on my hosting server. It is basically a primitive version control system, and I use both HTTP GET and HTTP POST to transfer files and strings. I would like the connection encrypted, but my (shared) web host tells me I can't use SSL because...

Why are these strange characters appearing in mcrypt?

I Encrypt and Decrypt successfully, but when I decrypt the value, appears strange characters at the final of string "���": The initial $_POST['value'] do not have any blank space or any strange character Any idea to solve this? Encrypt with this: $key='my key'; $td = mcrypt_module_open('tripledes', '', 'ecb', ''); $iv = mcrypt_create_...

Using MCrypt to Decrypt a Ciphertext (3DES CBC Mode)

I have a ciphertext, encrypted in 3DES CBC mode, and I'm having some trouble decrypting it. I have the following information (not actual values): <?php // Three 16 character long keys $key1 = '1234567890123456'; $key2 = '6543210987654321'; $key3 = '6549873210456123'; // The initialisation vector $ivec = '0102030405060708'; // A token ...

public key crytography implementation

Hi Guys, I have been using the PHP mcrypt module for encrypting sensitive data at my company. This has been working well. However, I have been requested to create a new master password which should be able to decrypt any data. The problem is that this master password would have to be hardcoded in a script file. Please correct me if I am...

How to deal with special characters in a string

I have a php script creating an encoded value, for example: m>^æ–S[J¯vÖ_ÕÚuÍÔ'´äœÈ‘ ®@M©t²#÷[Éå¹UçfU5T°äÙ“©”ˆÇVÝ] [’e™a«Ã°7#dÉJ> I then need to decode this in a vb.net application The problem is that value above can have any characters. And VB.net can't handle it: dim strCryptedString As String = 'm>^æ–S[J¯vÖ_ÕÚuÍÔ'´äœÈ‘ ®@M©t²#÷[É...

Best way to use PHP to encrypt and decrypt?

I plan to store foreign account information for my users on my website, aka rapidshare username and passwords, etc... I want to keep information secure, but i know that if i md5 their information, i can't retrieve it later to use. Base64 is decrypt-able so theres no point using that just plain off. My idea is to scramble the user and ...

PHP: mcrypt mangles beginning of string to garbage

I need medium to strong encryption on serverside, so I thought I would use mcrypt with PHP. If I use the functions below the beginning of my original string turns into binary garbage after decryption. (This is not the usual problem of getting appended additional garbage, instead my string is altered.) According to the documentation, mcry...

Howto make MCrypt and PHP work together on CentOS

Hi all, I've installed mcrypt on CentOS ( via yum ), but when I try to do a dl() call in A), I get the message in B). A) dl( mcrypt.so ) or die('The Mcrypt module could not be loaded ['. $prefix . 'mcrypt.' . PHP_SHLIB_SUFFIX .']'); B) The Mcrypt module could not be loaded [ mcrypt.so ] Now, I know that yum has installed mcryp...

Adding MCRYPT to PHP

How do I install mcrypt? I'm using Leopard 10.5.8 with PHP5. ...

Mcrypt installed but doesn't show up on PHPINFO

I think I managed to install mcrypt lib. The files are in place, but it looks like the library doesn't run at all. Tried to add: extension=mcrypt.so to PHP.INI; no good. Any help? ...

Where and how to set DYLD environment in Mac OS X

I'm in the middle a long quest, by now, trying to install mcrypt library to Mac OS X PHP (Previous questions here, here and here). I narrowed it down to a possible solution the includes setting a parameter in the DYLD environment (or something; I'm guessing here). Anyone has any idea where this environment is declared? Any help would b...

Installing mcrypt on Mac OSX (10.5) from PHP 5.2.8 source fails tests, what do I do?

So I'm trying to install mcrypt on my local for development. I've never compiled from source before, so please bear with me, but the short of what I've done is: Download and install libmcrypt-2.5.8 (from source) Download compiled mcrypt.so from http://www.viames.it/mac-os-x.html (note: the compiled gd.so seems to work fine) Update php....

How to do AES256 decryption in PHP?

I have an encrypted bit of text that I need to decrypt. It's encrypted with AES-256-CBC. I have the encrypted text, key, and iv. However, no matter what I try I just can't seem to get it to work. The internet has suggested that mcrypt's Rijndael cypher should be able to do this, so here's what I have now: function decrypt_data($data, $...

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

I'm generating data to send from a Ruby stack to a PHP stack. I'm using the OpenSSL::Cipher library on the Ruby side and the 'mcrypt' library in PHP. When I encrypt using 'aes-256-cbc' (256-bit block size) in Ruby I need to use MCRYPT_RIJNDAEL_128 (128-bit block size) in PHP to decrypt it. I suspect the Ruby code that is broken, becau...