Questions tagged [mcrypt]

3

votes
1

answer
28

Views

What is the most secure mcrpyt_encrypt algorithm?

I am trying to come up with a secure algorithm to encrypt and decrypt specific strings in my project I am working on. I am using the mcrypt_encrypt with the MCRYPT_RIJNDAEL_256 block cipher variation. I have tested many and found this one to seem quite secure. I am making the encrypt and decrypt in...
ApexLegend
1

votes
4

answer
3k

Views

PHP MCRYPT encrypt/decrypt returns invisible strange characters?

mcrypt_decrypt is giving me additional invisible characters which are NOT VISIBLE by just echoing out on the page. Can ONLY BE SEEN by writing it to the text file. Means, just displaying on the page is OK and hard to be noticed. Here is the code sample by Googling. Please guide me what is the correc...
夏期劇場
1

votes
2

answer
872

Views

PHP MYCRYPT - RIJNDAEL_128 with Mcrypt CBC gives the different encryption string everytime

I am back again with a PHP+RIJNDAEl_128+CBC. I am successful in encryption and decryption to the raw string. But the only problem I am facing is I get the DIFFERENT ENCRYPTION string every time. Which I believe should be same every time ideally. Below is the code: class Encypt{ const ENCRYPTION_KEY...
Padyster
1

votes
2

answer
9.6k

Views

PHP Error: mcrypt_encrypt(): The IV parameter must be as long as the blocksize

I get the error mcrypt_encrypt(): The IV parameter must be as long as the blocksize on second line. $data = "Currency=GBP&SuccessURL=test&FailureURL=test&VendorEMail=test&SendEMail=1&eMailMessage=&Amount=&Description=&CustomerName=test test&CustomerEMail=test&BillingSurname=test&BillingFirstnames=t...
Mladen
1

votes
1

answer
419

Views

rijndael_128 ruby without mcrypt

Hello I have next implementation of rijdael_128 encyption/decription in ruby require 'mcrypt' class Crypt attr_accessor :key, :iv def initialize(key, iv = nil) self.key = key self.iv = iv @enc = Mcrypt.new(:rijndael_128, :cbc, normalize_key, self.iv, :pkcs) end def encrypt(data) @enc.encrypt(data) e...
Fivell
1

votes
1

answer
129

Views

What is the Java equivalent of mcrypt “ncfb” mode?

I'm trying to port some code from PHP to java and this line is giving me trouble: $decrypted = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $encrypted, "ncfb", $iv); Looking through the javadocs on ciphers there is no 'ncfb' listed, is one of the other modes listed ncfb in disguise?
harmingcola
1

votes
3

answer
401

Views

PHP IF not working after Encrypt and Decrypt a String

I want to encypt all my session php data and when I want to use these information , decrypt them for this I am using these functions : define("ENCRYPTION_KEY", "[email protected]#$%^Soheil&*"); /** * Returns an encrypted & utf8-encoded */ function encrypt($pure_string, $encryption_key) { $iv_size = mcrypt_get_iv_...
soheil yo
17

votes
1

answer
11.6k

Views

PHP: Mcrypt - which mode?

I've been testing out the various modes available in PHP's mcrypt function. ECB is the mode used in most tutorials, but isn't recommended by both the just linked page and some users, so I reckon that either CBC or CFB should do the trick. The PHP documentation isn't too fat in it's comparision of t...
Industrial
1

votes
2

answer
79

Views

Added whitespaces to encrpyted password?

I have implemented functions in my login model for decrypting/encrypting a users password (which in a encrypted version gets stored in a cookie). All works fine except when I restart the browser and try to login with the password through the cookies. The parser tells me it's the wrong password even...
holyredbeard
1

votes
1

answer
1.1k

Views

Use mcrypt_dev_random to generate 256 bit token

i want to use mcrypt to create a 256 bit token to set as the cookie for the user. I have read a number of articles suggesting to use mcrypt DEV_RANDOM I am using the code $size = mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB); $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM); But the result i...
Arken
15

votes
5

answer
38.5k

Views

Mcrypt PHP extension required on Mac OS X

I keep getting this error Mcrypt PHP extension required at the bottom after I run a composer update : Since I am using Mac, I have tried running : brew search mcrypt brew install php56-mcrypt I still get the same error message.
kyo
17

votes
3

answer
32.1k

Views

How to add/remove PKCS7 padding from an AES encrypted string?

I'm trying to encrypt/decrypt a string using 128 bit AES encryption (ECB). What I want to know is how I can add/remove the PKCS7 padding to it. It seems that the Mcrypt extension can take care of the encryption/decryption, but the padding has to be added/removed manually. Any ideas?
Click Upvote
17

votes
6

answer
34.2k

Views

Installing mcrypt on OSX 10.8.2 - PHP 5.3.15 with homebrew

I've successfully installed mcrypt via homebrew but I'm struggling to find the path to mcrypt.so to include it as an extension in php.ini. mcrypt was installed at /usr/local/Cellar/mcrypt/2.5.8. Tree: -- AUTHORS |-- ChangeLog |-- INSTALL_RECEIPT.json |-- NEWS |-- README |-- TODO |-- bin | `-- lib...
Matanya
18

votes
4

answer
9.1k

Views

Encryption: Use of initialization vector vs key?

I am using PHP's mcrypt library and the AES-256 (rijndael) algorithm, which requires both a key + initialization vector to run. My logical brainside isn't really going along with this. Isn't just one key enough? Theoretical scenario: If I had encrypted sensitive data stored in a database, which onl...
Industrial
18

votes
1

answer
19.5k

Views

Cross platform (php to C# .NET) encryption/decryption with Rijndael

I'm currently having a bit of problem with decrypting a message encrypted by php mcrypt. The php code is as following: The the encrypted message is then sent to a ASP.NET platform (C#). However, I'm having problem retaining the order of decryption (base64 decode to urldecode). The code I had in ASP....
user527113
1

votes
3

answer
4k

Views

PHP Mcrypt error: Cannot open source device

I downgraded to PHP 5.2.8 from PHP 5.4.2 for a reason, I enabled the mcrypt extension, but when I run the function mcrypt_create_iv ($size, MCRYPT_DEV_RANDOM), it doesn't execute properly, and I get the following warning Warning: mcrypt_create_iv() [function.mcrypt-create-iv]:Cannot open source devi...
Chibuzo
18

votes
8

answer
27.9k

Views

mcrypt_decrypt() error change key size

mcrypt_decrypt(): Key of size 15 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported How Can I fix this issue? my key is set - can not change it. It has to be a local change, I think my local PHP version is too advanced for the project I loaded. How can I fix this?
Asaf Maoz
1

votes
2

answer
2.7k

Views

Cannot compile program on Ubuntu that uses libmcrypt

I created a C program that uses libmcrypt. I compiled it for many times in a CentOS machine, but now, trying to do the same thing in Ubuntu, I get this: /tmp/ccM2ugbq.o: In function `encrypt': util.c:(.text+0xa1): undefined reference to `mcrypt_module_open' util.c:(.text+0xc6): undefined reference...
artaxerxe
4

votes
1

answer
6.8k

Views

Mcrypt PHP - Module Initialization Failed

How to install the mcrypt modules on PHP? I need to install the mcrypt extension on WAMPServer so that I can use IDEA encryption on passwords. I can't use any other type of encryption, because the large database I am interacting with already uses IDEA encryption on passwords. I have done quite a bit...
Scott Hallauer
6

votes
1

answer
4.5k

Views

Any Equivalent for mcrypt (in PHP) to use in Java?

Can any one tell about any library that can be used in java, which gives the same result if operation was done in PHP using the mcrypt library. i want to actually encrypt a string in Java using AES, and decrypt it in PHP. Will the Java Cipher yield a encryption decryptable by mcrypt in PHP? edit: Fo...
Kris
5

votes
3

answer
1.3k

Views

Storing credit card details with mcrypt or GnuPG

I have a requirement to store credit card details (not storing is NOT an option). Using mcrypt with mcrypt_dev_random to generate init_vector takes varying ages to encrypt/decrypt but seems is the most 'secure' option. mcrypt_dev_urandom MUCH quicker but not suitable for long term storage - as I hav...
Ian Wood
5

votes
1

answer
4.3k

Views

mcrypt warning on update to php 5.6.2; Key of size x not supported

We are getting the following warning after updating from PHP 5.5.18 to PHP 5.6.2: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported The encryption algorithm appeared to work fine before this: $decrypttext = mcrypt_decrypt( MCRYPT_RIJNDAEL_256...
Arth
5

votes
2

answer
3.8k

Views

Error: No available formula for php54-mcrypt on Mac OS X Mavericks

I am trying to install mcrypt PHP extension via Homebrew on Mac OS X Mavericks and get the following error. Error: No available formula for php54-mcrypt Help!
Gaurav Gupta
2

votes
3

answer
793

Views

Using mcrypt to pass data across a webservice is failing

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 encrypte...
Adam Hopkinson
5

votes
3

answer
14k

Views

Issue with PHP mcrypt function

I use the following function to decrypt data on my server: function decrypt($key, $text) { return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))); } I have read a lot about...
JM4
2

votes
1

answer
168

Views

PHP CAST-256 mcrypt output differs

I am attempting to encrypt a string using CAST256 and CBC, via the PHP function mcrypt_encrypt. I am using the key test with the input test, which produces the following code: mcrypt_encrypt(MCRYPT_CAST_256, 'test', 'test', MCRYPT_MODE_CBC); The base64 encoded version of this produces (on PHP versio...
daviga404
2

votes
2

answer
1.1k

Views

How to calculate proper KCV value for a 3des encryption Key?

I'm trying to calculate KCV for a DES encryption. $data = 'F337CE3C64E02D96C61A9EC69E051D5A'; $transport = '4B4D3733504D3735'; $encData = bin2hex(mcrypt_encrypt(MCRYPT_DES, pack('H*', $transport), $data, MCRYPT_MODE_ECB)); This is all fine, data gets properly encrypted. Now I want to calcul...
Cezary
2

votes
3

answer
3.3k

Views

Java decrypt error: data not block size aligned

I'm trying to encrypt data between my android application and a PHP webservice. I found the next piece of code in this website: http://schneimi.wordpress.com/2008/11/25/aes-128bit-encryption-between-java-and-php/ But when I try to decrypt I get the Exception of the title "data not block size aligned...
SERPRO
2

votes
1

answer
223

Views

mcrypt_decrypt with tripledes and cbc not working proper

As per above screenshot my decode data will see like this when i can view source in browser. otherwise decrypt proper but not store in session proper due to this problem.Thanks in Advance. function decrypt($data, $key) { $iv = chr(0) . chr(0) . chr(0) . chr(0) . chr(0) . chr(0) . chr(0) . ch...
5

votes
2

answer
3.7k

Views

proper PHP mcrypt encryption methods?

Ok, I have tried to create my own encryption/decryption methods using PHP mcrypt, and when I posted them a while back some called them "trash". They were mentioning things about "Initialization Vectors" and such. Basically, how can I make these cryptography methods better: function encrypt($key, $da...
nkcmr
5

votes
1

answer
2.5k

Views

Mysql and Mcrypt Problem with PHP

I've seen this asked a few times, but not exactly how I'm going to ask it here... Hopefully this is ok with you guys. Basically I have this script that works fine and will print my result without a hitch: $algorithm = MCRYPT_BLOWFISH; $mode = MCRYPT_MODE_CFB; $iv = mcrypt_create_iv(mcrypt_get_iv_siz...
Howard Zoopaloopa
2

votes
1

answer
4.9k

Views

Issue with encrypt and decrypt a word docx file in php

I tried to use php mcrypt TripleDES for encryption for docx format files. When i tried to decrypt the file, i am getting the error as follows. The Office Open XML file file_name cannot be opened because there are problems with the contents. Here is the below code function Encrypt($source,$key,$iv)...
user416
6

votes
3

answer
12.2k

Views

Encrypt with CryptoJS and decrypt with PHP

On the client side (mobile device) I encrypt a users password with CryptoJS: var lib_crypt = require('aes'); $.loginButton.addEventListener('click', function(e){ var key = lib_crypt.CryptoJS.enc.Hex.parse('bcb04b7e103a0cd8b54763051cef08bc55abe029fdebae5e1d417e2ffb2a00a3'); var iv = lib_crypt.Crypto...
Papauha
5

votes
1

answer
6k

Views

PHP - Replacing mcrypt_create_iv() with openssl_random_pseudo_bytes()

I need to up the security of our website, and is currently using the guide here: http://crackstation.net/hashing-security.htm, and also the generation of random passwords here: https://defuse.ca/generating-random-passwords.htm. I gather that both uses the function mcrypt_create_iv() for generating r...
shippou
2

votes
2

answer
5.7k

Views

Decrypting data with openssl commandline tool

I have to following code and as far as I know it is correct, but it does not work. I am trying to encode data with PHP's Mcrpyt and then decode it with the openssl commandline tool. This is my PHP code: /* * Convert a normal ascii string to a hexadecimal string. * Complement of hexToString(). */ fun...
Jori
3

votes
2

answer
61

Views

Migrating mcrypt with Blowfish and ECB to OpenSSL

I can't for the life of me figure out how to migrate my legacy mcrypt code to OpenSSL. I got it working for Blowfish with CBC and for Rijndael with CBC, but Blowfish with ECB is eluding me. And yes, I read Moving from mcrypt with Blowfish & ECB to OpenSSL and I tried zero-padding the data, not zero-...
Björn Tantau
2

votes
5

answer
30.7k

Views

php error: The Encrypt library requires the Mcrypt extension in codeigniter

I have a login and sign up form and use the encrypt library to encrypt the password.. I am using Xampp for my server and my system works correctly.. code to encrypt the password: $this->encrypt->encode('my password'); add encrypt library $autoload['libraries'] = array('encrypt'); and setting the s...
MGB C
21

votes
4

answer
66.1k

Views

Encrypting / Decrypting file with Mcrypt

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 th...
whitman6732
3

votes
1

answer
2.2k

Views

Hash::make('password') returning different results at every call

So,the title basically describes my problem. My Hash:make() is gone crazy. I've created a users table with a hashed password, but I can't get Laravel to accept my credentials and I think the problem is in the Hash::make. So, test this code: Route::get('/', function() { return Hash::make('1234'); })...
Magus
4

votes
3

answer
5.5k

Views

How to install mcrypt on Docker

I have a Docker Container with Phalcon3 and php 7. I am trying to install the php extension Mcrypt without luck. If I do ssh to the container, and execute: apt-get update apt-get install php7.0-mcrypt I get the following: E: Unable to locate package php7.0-mcrypt E: Couldn't find any package by re...
subharb

View additional questions