[英]How can I decrypt ClickBank notification data using PHP without mcrypt?
Mcrypt已被棄用多年,終於從php中消失了。 不幸的是,我需要對ClickBank中的加密數據進行解碼,並且它們的文檔僅提供mcrypt解決方案。
這是從他們的文檔中刪除的。 沒有mcrypt_decode()怎么辦?
$secretKey = "YOUR SECRET KEY"; // secret key from your ClickBank account
// get JSON from raw body...
$message = json_decode(file_get_contents('php://input'));
// Pull out the encrypted notification and the initialization vector for
// AES/CBC/PKCS5Padding decryption
$encrypted = $message->{'notification'};
$iv = $message->{'iv'};
error_log("IV: $iv");
// decrypt the body...
$decrypted = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128,
substr(sha1($secretKey), 0, 32),
base64_decode($encrypted),
MCRYPT_MODE_CBC,
base64_decode($iv)), "\0..\32");
error_log("Decrypted: $decrypted");
////UTF8 Encoding, remove escape back slashes, and convert the decrypted string to a JSON object...
$sanitizedData = utf8_encode(stripslashes($decrypted));
$order = json_decode($decrypted);
$notification_array = json_decode(utf8_encode(stripslashes(trim(openssl_decrypt($encrypted,
'AES-256-CBC',
substr(sha1($secretKey), 0, 32),
OPENSSL_ZERO_PADDING, base64_decode($iv)), "\0..\32"))), true);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.