"3013", "VK_VERSION" => "008", "VK_DATETIME" => "2021-02-18T09:07:23+0000", "VK_SND_ID" => "EYP", "VK_REC_ID" => "uid100036", "VK_RID" => "", "VK_NONCE" => "2", "VK_USER_NAME" => "Tõõgera Leõpäöldi", "VK_USER_ID" => "51001091072", "VK_COUNTRY" => "EE", "VK_OTHER" => "", "VK_TOKEN" => "5", "VK_ENCODING" => "UTF-8", "VK_MAC" => "j2GNiVqM9e0d8MDmlhxv7lB9kOUsqVVcr6r2PS02AJmNmlP9iiHmfcPf7VA3CwyW5K9zj0dTFYM3J60jNN5PW3i+Ash5oxpWwu6EitUtsTdcH18nnsVPcAe5JiKLi+2f2ZoGpCK0rsogTH2H4gT16NbykD/DABLn1+YmCvjIx8aUMKoTEy8ZUdYEJEFSMycoCy+KSKOuWYpoVlXvO8ErDS0AHe8xcASZFfppkk7j/LgzOwxvlFQXYWJpqY/DyRNJKrQG3WbsSMU9ER0DZiLFlMW6/DcU9JnbfjwDv2MpIjOcpfpG7vDkSqOmNokXL5qWbB5yFE889QbXH7Kod0zMiA==" ); // STEP 3. Generate data to be verified // ==================================== // Data to be verified is in the form of XXXYYYYY where XXX is 3 char // zero padded length of the value and YYY the value itself // NB! SEB expects symbol count, not byte count with UTF-8, // so use `mb_strlen` instead of `strlen` to detect the length of a string $data = str_pad (mb_strlen($fields["VK_SERVICE"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_SERVICE"] . /* 3013 */ str_pad (mb_strlen($fields["VK_VERSION"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_VERSION"] . /* 008 */ str_pad (mb_strlen($fields["VK_DATETIME"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_DATETIME"] . /* 2021-02-18T09:07:23+0000 */ str_pad (mb_strlen($fields["VK_SND_ID"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_SND_ID"] . /* EYP */ str_pad (mb_strlen($fields["VK_REC_ID"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_REC_ID"] . /* uid100036 */ str_pad (mb_strlen($fields["VK_NONCE"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_NONCE"] . /* 2 */ str_pad (mb_strlen($fields["VK_USER_NAME"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_USER_NAME"] . /* Tõõgera Leõpäöldi */ str_pad (mb_strlen($fields["VK_USER_ID"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_USER_ID"] . /* 51001091072 */ str_pad (mb_strlen($fields["VK_COUNTRY"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_COUNTRY"] . /* EE */ str_pad (mb_strlen($fields["VK_OTHER"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_OTHER"] . /* */ str_pad (mb_strlen($fields["VK_TOKEN"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_TOKEN"] . /* 5 */ str_pad (mb_strlen($fields["VK_RID"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_RID"]; /* */ /* $data = "00430130030080242021-02-18T09:07:23+0000003EYP009uid1000360012017Tõõgera Leõpäöldi01151001091072002EE0000015000"; */ // STEP 4. Verify the data with RSA-SHA1 // ===================================== if (openssl_verify ($data, base64_decode($fields["VK_MAC"]), $public_key) !== 1) { $signatureVerified = false; }else{ $signatureVerified = true; } // STEP 5. Display output of the received payment // ============================================== // Define device names $tokens = array( "1" => "ID card", "2" => "mobile ID", "5" => "one-off codes", "6" => "PIN calculator", "7" => "reusable card" ); ?>
Authentication results
User name
Country
User's personal identification code
Other user information
Authentication device
Signature: