2
基本上我試圖做的是在我的cURL API中,我希望客戶端使用API在服務器上加密特定的敏感數據,然後離開服務器,然後在我的服務器上解密。如何使用openssl進行加密?
我看到你可以使用openssl_encrypt()
函數,儘管我找不到任何解釋清楚的東西。
過程的一個例子是下面:
客戶端的服務器端:
$dataToSend = 'mysupersecretstring';
// encrypt data
// connect and send to my server
ON MY服務器側:
$receivedString = '39bfy4f28d30g74fb34g79';
// string above is received
// string is decrypted decrypted
// $receivedString is now plaintext and can now be used on this server
我希望我足夠清楚地解釋這個。如果您有任何問題,請不要猶豫,因爲這非常重要,我有一個有效的解決方案。
您可以使用SSL證書嗎? – user2182349
因爲我相信user2182349正在引領你,正確的密碼學很難得到正確的;使用已經存在的東西,已經很好理解和成熟,像SSL/TLS是一個好主意,如果你不想有微妙但嚴重的安全性故障。 – icktoofay
[PHP,最簡單的雙向加密]的可能重複(http://stackoverflow.com/questions/9262109/php-simplest-twoway-encryption) –