php-decrypt | PHP Decrypt是一个跨平台用来解密PHP源码的扩展 | Web Framework library
kandi X-RAY | php-decrypt Summary
kandi X-RAY | php-decrypt Summary
php-decrypt
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of php-decrypt
php-decrypt Key Features
php-decrypt Examples and Code Snippets
Community Discussions
Trending Discussions on php-decrypt
QUESTION
Decryption works using php/openssl and I can get my plain data. Here is the defined call:
...ANSWER
Answered 2021-Mar-06 at 15:18AES is only defined for 16/24/32 bytes keys. You are using a 40 bytes key. PHP implicitly cuts the key to 32 bytes, CryptoJS does not, but processes the key without error message due to a bug (#293), with a wrong result, of course.
Also, the ciphertext must be passed as CipherParams
object or Base64 encoded, the IV must be Utf8 encoded, PKCS7 padding should be used, and the decrypted data is a base64 string (and still needs to be Base64 decoded).
The following CryptoJS code decrypts the sample ciphertext:
QUESTION
I want to encrypt and decrypt some string in Php and in Javascript and looking on the web, the best and safest way seems to be CryptoJs.
This post is not a duplicate of Encrypt with PHP, Decrypt with Javascript (cryptojs) because the output string it's not simple.
This is my code but the Js decrypting code doesn't work. What is it wrong?
...ANSWER
Answered 2020-Sep-22 at 21:12In the PHP code the following should be considered:
$passphrase
does not denote a passphrase, but the key. This key must be 32 bytes in size for the choiceaes-256-cbc
. If it is too short, it is filled with 0 values, if it is too long, it is truncated. This is a common source of error, so a key of exactly 32 bytes should be used. If you want to work with a passphrase, you have to use a KDF (like PBKDF2).- In the fourth parameter flags are set, and no boolean expression (like
true
). If the data should be returned in binary form, theOPENSSL_RAW_DATA
flag must be set. - Static IVs are insecure, usually a new IV is generated for each encryption, which is sent to the recipient together with the ciphertext. Since the IV is not secret, it is usually placed in front of the ciphertext on byte level without encryption.
The following sample PHP code (based on the posted code):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install php-decrypt
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page