a
This commit is contained in:
parent
506a90c5de
commit
70c89fe4c1
|
|
@ -241,6 +241,30 @@
|
|||
// echo $message;
|
||||
}
|
||||
|
||||
// Chiffrer l’image au moment de l’upload (PHP)
|
||||
function encryptImage($sourcePath, $destPath)
|
||||
{
|
||||
$key = base64_decode(trim(file_get_contents('/var/www/keys/inter-sante-photo.key')));
|
||||
$plaintext = file_get_contents($sourcePath);
|
||||
|
||||
$iv = openssl_random_pseudo_bytes(16);
|
||||
$cipher = openssl_encrypt($plaintext, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv);
|
||||
|
||||
file_put_contents($destPath, $iv . $cipher); // concat IV + données
|
||||
}
|
||||
|
||||
// Déchiffrer pour afficher la photo dans INTER-SANTE
|
||||
function decryptImage($path)
|
||||
{
|
||||
$key = base64_decode(trim(file_get_contents('/var/www/keys/inter-sante-photo.key')));
|
||||
$data = file_get_contents($path);
|
||||
|
||||
$iv = substr($data, 0, 16);
|
||||
$ciphertext = substr($data, 16);
|
||||
|
||||
// return openssl_decrypt($ciphertext, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv);
|
||||
return base64_encode(openssl_decrypt($ciphertext, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv));
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
|
|
|||
|
|
@ -62,15 +62,16 @@ class FacialVerificationAPI {
|
|||
array(
|
||||
"referenceImagePath" => $referenceImagePath,
|
||||
"capturedImageBase64" => $capturedImageBase64,
|
||||
"photoAssureCrypte" => $_SESSION['photoAssureCrypte'],
|
||||
)
|
||||
);
|
||||
exit;
|
||||
|
||||
// Option 1: Azure Face API (Recommandé)
|
||||
return $this->compareWithAzureFaceAPI($referenceImagePath, $capturedImageBase64);
|
||||
// return $this->compareWithAzureFaceAPI($referenceImagePath, $capturedImageBase64);
|
||||
|
||||
// Option 2: AWS Rekognition
|
||||
// return $this->compareWithAWSRekognition($referenceImagePath, $capturedImageBase64);
|
||||
return $this->compareWithAWSRekognition($referenceImagePath, $capturedImageBase64);
|
||||
|
||||
// Option 3: Solution locale avec OpenCV/dlib (avancé)
|
||||
// return $this->compareWithLocalFaceRecognition($referenceImagePath, $capturedImageBase64);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user