mcrypt

How Can We Use GCM Mode Encryption in PHP?

↘锁芯ラ 提交于 2019-12-07 05:04:29
问题 I have been reading a lot about GCM and how awesome it is and I would like to know how could I use AES-GCM authenticated encryption using PHP . Is it supported in mcrypt() ? I found some references to GCM in the Codeigniter framework documentation which leads me to believe it is possible to use in Codeigniter. And I also came across something in a doc about Zend . I'm not looking to use a Codeigniter driver though as I don't use any framework and don't intend to for my current projects. It

How can I mcrypt 128 CFB to Ruby?

时间秒杀一切 提交于 2019-12-07 04:38:25
问题 I need to exchange with a PHP API which crypts the requests and answers. On my side I am in rails 4.0.0 (ruby 2.0) and I cannot make it work. I have read a lot of answers on this subject and have tried to understand how mcrypt works, e.g. http://www.chilkatsoft.com/p/php_aes.asp, but without success. I still cannot decrypt the encrypted from PHP or encrypt something that the PHP can decrypt Could you help me please and see what I am doing wrong? PHP code: $secretKey = "1234567891234567";

Sending an mcrypt-encrypted string via a URL parameter - decoded text is mangled

痴心易碎 提交于 2019-12-06 20:58:09
问题 I'm messing with a simple authorization scheme. I think the easiest way to do it without SSL or other HTTP auth would be a shared key encryption. Adapting a simple example from the PHP manual, I came up with the following: $text = "boggles the invisible monkey will rule the world"; $key = "This is a very secret key"; $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $enc = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $text, MCRYPT_MODE

Encrypt/Decrypt using mcrypt

爷,独闯天下 提交于 2019-12-06 13:50:50
Trying to achieve encrypting and decryption using following strategy, but ending up with random characters mostly. class Crypt { public static function encrypt($string, $account) { // create a random initialization vector to use with CBC encoding $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = pack('H*', $account . $account); $output = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $string, MCRYPT_MODE_CBC, $iv); $output = $iv . $output; $output = base64_encode($output); $output = urlencode($output); return $output; } public

Crypto++ to PHP mcrypt not working

时间秒杀一切 提交于 2019-12-06 12:20:42
问题 I have a C++ application that's using Crypto++ to send encrypted data to a PHP site. However, when the data's getting to the PHP side, it's not decrypting the data properly. The C++ / Crypto++ code: char stupidKey[AES::MAX_KEYLENGTH] = "thisisastupidkeythisisastupidke"; ECB_Mode<AES>::Encryption aes((byte *)stupidKey, AES::MAX_KEYLENGTH); std::string cypher; StringSource(aData, true, new StreamTransformationFilter(aes, new StringSink( cypher ))); StringSource(cypher, true, new Base64Encoder(

PHP mcrypt installing and setting up laravel environment issues

依然范特西╮ 提交于 2019-12-06 11:14:09
I am using Mac OS X Lion 10.7.5 and I want to clear one thing I do not want to use XAMPP, MAMP anymore. So I enabled apache, php and installed mysql following this link . This work well. Then I downloaded laravel and installed it following this link . I copied laravel folder inside Sites folder which I created according to first link tutorial. Now when I click on public folder inside laravel folder it gives me following error Unhandled Exception Message: Call to undefined function Laravel\mcrypt_create_iv() Location: /Users/zafarsaleem/Sites/learning-laravel/laravel/crypter.php on line 36 Then

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

旧城冷巷雨未停 提交于 2019-12-06 09:39:13
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 secure the data? If someone has access to all files on the hard drive of your server, all bets are off. There is no way you can protect your data then, because your webapp still has to be able to access it. This encryption will only protect you from attackers who can

Decrypting data with openssl commandline tool

那年仲夏 提交于 2019-12-06 08:36:20
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(). */ function stringToHex($str) { $hex_str = ""; for ($i = 0; $i < strlen($str); ++$i) { $hex_str .= sprintf("%02X", ord($str[$i])); } return $hex_str; } $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_DEV_RANDOM); $block_size = mcrypt_get_block_size("rijndael-128",

Migrating mcrypt with Blowfish and ECB to OpenSSL

廉价感情. 提交于 2019-12-05 22:39:46
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-padding the data, zero-padding the key, cycling over the key and any combination of them and nothing seems to work. This is my code: <?php function encrypt_with_mcrypt($data, $key) { return mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $data, MCRYPT_MODE_ECB); } function encrypt_with_openssl($data, $key) {

phpmyadmin mcrypt extension is missing

喜欢而已 提交于 2019-12-05 22:15:23
I'm using CentOS 6 and the latest phpMyAdmin (4.0.1.4) and I noticed the error "The mcrypt extension is missing. Please check your PHP configuration." I went ahead and ran: rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm then ran: yum install php-mycrypt Then restarted httpd services and still no luck. Any idea how I can get it to go away? According to this post , you should edit /etc/php.d/mcrypt.ini and change ; Enable mcrypt extension module extension=module.so to ; Enable mcrypt extension module extension=mcrypt.so and then restart. On Ubuntu Try this for