Skip to content

How to generate INI latter for a bank? #8

@andrew-svirin

Description

@andrew-svirin

On PHP for generate Hash (SHA-256).
I do next. But I do not know exactly is it correct. Please check me and correct if I am wrong.

Here is correct certificat (INI response is OK).
$cert = file_get_contents('files/cert.pem');
$cert_array = openssl_x509_parse($cert);
$cert_details = openssl_pkey_get_details(openssl_pkey_get_public($cert));

Exponent hash without leading zeros.
$exponent = ltrim(hash('sha256', base64_encode($cert_details['rsa']['e'])), '0');

Modulus hash without leading zeros.
$modulus = ltrim(hash('sha256', base64_encode($cert_details['rsa']['n'])), '0');

HEX representation.
$A006_unpack = unpack("H*", $exponent . ' ' . $modulus);
$A006_H = array_shift($A006_unpack);

Here is my Hash (SHA-256).
echo implode(' ', str_split(strtoupper($A006_H), 2));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions