This commit is contained in:
KANE LAZENI 2026-02-23 23:41:24 +00:00
parent 506a90c5de
commit 70c89fe4c1
2 changed files with 27 additions and 2 deletions

View File

@ -241,6 +241,30 @@
// echo $message;
}
// Chiffrer limage au moment de lupload (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>

View File

@ -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);