Created
July 30, 2021 02:45
-
-
Save aaei924/e94313e9d9642696b4a8238d1a785da4 to your computer and use it in GitHub Desktop.
자가진단 암호화 API (이름, 생년월일)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require '/var/www/html/covid/vendor/autoload.php'; | |
use phpseclib3\Crypt\RSA; | |
use phpseclib3\Crypt\PublicKeyLoader; | |
$key = PublicKeyLoader::load('-----BEGIN RSA PUBLIC KEY----- | |
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA81dCnCKt0NVH7j5Oh2+SGgEU0aqi5u6sYXemouJWXOlZO3jqDsHYM1qfEjVvCOmeoMNFXYSXdNhflU7mjWP8jWUmkYIQ8o3FGqMzsMTNxr+bAp0cULWu9eYmycjJwWIxxB7vUwvpEUNicgW7v5nCwmF5HS33Hmn7yDzcfjfBs99K5xJEppHG0qc+q3YXxxPpwZNIRFn0Wtxt0Muh1U8avvWyw03uQ/wMBnzhwUC8T4G5NclLEWzOQExbQ4oDlZBv8BM/WxxuOyu0I8bDUDdutJOfREYRZBlazFHvRKNNQQD2qDfjRz484uFs7b5nykjaMB9k/EJAuHjJzGs9MMMWtQIDAQAB | |
-----END RSA PUBLIC KEY-----'); | |
$key = $key->withPadding(RSA::ENCRYPTION_PKCS1); | |
echo json_encode([ | |
'name' => base64_encode($key->encrypt($_GET['name'])), | |
'birthday' => base64_encode($key->encrypt($_GET['birthday'])), | |
'password' => base64_encode($key->encrypt($_GET['password'])) | |
], JSON_UNESCAPED_UNICODE); | |
Header('Content-Type: Application/json'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment