-
Anonymous
Как реализовать аутентификацию aadhaar Demoghrapy в php [закрыто]
Сообщение
Anonymous »
- Сгенерировать шифрование PID => $pid=encryptPID($pid_1,$randkey);
- Сгенерировать шифрование Hmac =>
$hash=hash("SHA256",$pid_1,true);
$hmac=encryptPID($hash,$randkey);
Код: Выделить всё
function encryptPID4($inputData, $sessionKey) {
$xmlGregorianCalendar = new DateTime();
$ts = $xmlGregorianCalendar->format(DATE_ATOM);
// Generate Initialization Vector (IV)
$iv = openssl_random_pseudo_bytes(16); // Assuming IV length is 16 bytes (AES block size)
// Encrypt Data using Session Key
$cipherText = openssl_encrypt($inputData, 'aes-256-cbc', $sessionKey, OPENSSL_RAW_DATA, $iv);
// Convert timestamp to bytes (assuming UTF-8 encoding)
$tsInBytes = mb_convert_encoding($ts, 'UTF-8');
// Combine Timestamp and Cipher Text
$packedCipherData = $tsInBytes . $cipherText;
return base64_encode($packedCipherData);
}
Реализация Aadhaar
Подробнее здесь:
https://stackoverflow.com/questions/783 ... ion-in-php
1713267964
Anonymous
[list]
[*]Сгенерировать шифрование PID => $pid=encryptPID($pid_1,$randkey);
[*] Сгенерировать шифрование Hmac =>
$hash=hash("SHA256",$pid_1,true);
$hmac=encryptPID($hash,$randkey);
[/list]
[code] function encryptPID4($inputData, $sessionKey) {
$xmlGregorianCalendar = new DateTime();
$ts = $xmlGregorianCalendar->format(DATE_ATOM);
// Generate Initialization Vector (IV)
$iv = openssl_random_pseudo_bytes(16); // Assuming IV length is 16 bytes (AES block size)
// Encrypt Data using Session Key
$cipherText = openssl_encrypt($inputData, 'aes-256-cbc', $sessionKey, OPENSSL_RAW_DATA, $iv);
// Convert timestamp to bytes (assuming UTF-8 encoding)
$tsInBytes = mb_convert_encoding($ts, 'UTF-8');
// Combine Timestamp and Cipher Text
$packedCipherData = $tsInBytes . $cipherText;
return base64_encode($packedCipherData);
}
[/code]
Реализация Aadhaar
Подробнее здесь: [url]https://stackoverflow.com/questions/78334265/how-to-implement-aadhaar-demoghraphy-authentication-in-php[/url]