Skip to content
Advertisement

Tag: openssl

PHP OpenSSL encrypt with DES-ECB algorithm unexpected output

I’ve tried to encrypt the value with DES-ECB via PHP 7.4 (Laravel) and OpenSSL, and I try the online tool https://emvlab.org/descalc/ to encrypt value, the result was the expected. key: 96187BBAB2BD19ACF899B74FB4E37972 Input Data: F01DCCE40F8C365ADE0A7DC03BC11DDE The encrypted data is 355A627E977D8ECF4953C98D801E472F on online tool. https://emvlab.org/descalc/?key=96187BBAB2BD19ACF899B74FB4E37972&iv=0000000000000000&input=f01dcce40f8c365ade0a7dc03bc11dde&mode=ecb&action=Encrypt&output=D5131A2B35766D371420F679F15969FF When the next code written in PHP I can’t replicate the result: Is there a way to

Decrypt aes-256-cbc encoded file with iv = 0

I have an input.DAT file that is encrypted with aes-256-cbd method. I want to decrypt the file using php. When I execute the following command from command line, the file is decrypted successfully. But when I try to use php for decrypting the file using the method openssl_decrypt($data, AES_256_CBC, $encryption_key, 0, 0); it gives me this error: openssl_decrypt(): IV passed

AES/CBC/PKCS5 Padding | Alternate to mcrypt_get_block_size() in Php OpenSSL

Problem Statement: I’m trying to integrate API which AES/CBC/PKCS5 Padding. After some research I found the implementation on following article. However, In this article there were using mcrypt which is deprecated and removed from PHP 7.2. Hence, I’m looking to modify above implementation in openssl. There is function pkcs5_pad for PKCS5 padding the data which require parameter as data and

openssl_encrypt aes 256 with hash in java

From the php encryption function below: the result of encryption is MyFTCJx8RPzOx7h8QNxEtQgeiNIRwnrJ+uc0V70= And I have try to write this function in Java like this: The result is amF2YXguY3J5cHRvLnNwZYUmrJNv8ycvLua0O9g= Why my java function return the different result from php? And how do I fix the java function to get the same result with php? Thank you. Answer The IV is determined

PHP JWT (JSON Web Token) with RSA signature without library

Anyboby know some solution in PHP to using JWT (JSON Web Token) with RSA signature without library? I tried so hard to find solutions without library or without using composer. All the options that I found use some kind of library. Answer I made my own solution using other examples on the way. Below we have 3 use cases and

Decrypt Crypto-js encrypted text with key with PHP

I’m using Crypto-js for encrypting password with a key and send it to server. I want to decrypt it in server using PHP. How this can be done? JS: Encrypted text: U2FsdGVkX1+EaW3J1GE1k/EU5h6C+nxBH364Xhez+b0= PHP: Result: string(32) “����>���s��ȡ�V?E��M���I” I’m getting weird results here. Answer The following solution is not from my side but from @Artjom B., so all credits go to him.

openssl_decrypt returns blank

I tried the following code and getting the following output The decrypt string ($output1) is blank. Answer Your code is running well but the input data to your decrypt functionality is wrong. You are feeding the openssl_decrypt function with the (original) plaintext and not with the data encrypted by openssl_encrypt (“output”). Just a friendly information regarding the security of your

PHP mysqli and SSL

I am trying to configure Galera Cluster over a WAN (VPN is not an option). For obvious reasons I am setting up the connections to require SSL keys, and am having difficulties getting the application …

Advertisement