"3012", "VK_VERSION" => "008", "VK_DATETIME" => "2023-04-19T13:23:15+0000", "VK_SND_ID" => "EYP", "VK_REC_ID" => "uid100036", "VK_RID" => "1681910579017", "VK_USER" => "", "VK_USER_NAME" => "Tõõger Leõpäöld", "VK_USER_ID" => "37602294565", "VK_COUNTRY" => "EE", "VK_OTHER" => "", "VK_TOKEN" => "5", "VK_ENCODING" => "utf-8", "VK_MAC" => "YMUD8mwtW4xpI+iJbdnE1+bjibY+hAKmjIiGo9uDLJ6rOeqMA+VG1SRA0aHUM2e20HxxQImMbC196k3KSMYCssN8zkbDkE1/wq8txiYPNoaO9OtUxitm778wJ75dMKozkwmds6bFv+rQ3sCWoIplxiHEF4at3OKnqlJpIgdRHPahDlbtek4rq92hWfkcOEKuMYTYnCaNZv7LDdSL6gl+apvFenSFzKt0pHdvzvg5N/1o8SFMwonD33c6lq30iQGoTUBJ/buBpZh7s1Ww3kVdVZFSfT/3pIMAiUc8omY9CsPx6wcMN7Fq+yrqqooi0U54IT40ffC8he9NF3IY6sP9vg==" ); // 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"] . /* 3012 */ str_pad (mb_strlen($fields["VK_VERSION"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_VERSION"] . /* 008 */ str_pad (mb_strlen($fields["VK_USER"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_USER"] . /* */ str_pad (mb_strlen($fields["VK_DATETIME"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_DATETIME"] . /* 2023-04-19T13:23:15+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_USER_NAME"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_USER_NAME"] . /* Tõõger Leõpäöld */ str_pad (mb_strlen($fields["VK_USER_ID"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_USER_ID"] . /* 37602294565 */ 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"]; /* 1681910579017 */ /* $data = "00430120030080000242023-04-19T13:23:15+0000003EYP009uid100036015Tõõger Leõpäöld01137602294565002EE00000150131681910579017"; */ // 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

Agreed user identifier
User name
Country
User's personal identification code
Other user information
Authentication device

Signature: