"1911",
"VK_VERSION" => "008",
"VK_SND_ID" => "EYP",
"VK_REC_ID" => "uid100036",
"VK_STAMP" => "4",
"VK_REF" => "42",
"VK_MSG" => "Plastok tellimus 26.02.2021 10:58 Ref.:4",
"VK_ENCODING" => "UTF-8",
"VK_LANG" => "EST",
"VK_MAC" => "tSn2Dp4APIwVg0rP2UnhQCtXc2qQPipmQ8wb50+ijqQkdjfF27bkt600NhD+9wO63IznmRQISzXBNcyMHfquc6A5Ui36F8C2GBwHXvjq5wKVx0X0EARk5TWOKugr/8UPdfiQ75JhFvxpyxLp9xXRfq9k7fRO2i0oEQhxt2SD0xgaaWIrUNCARX83N3YUciWmVPF2D9CigYN/2cvfkLaLFX7cThoRa0MmTVhE7MeHOx8kBXrzjjhIFAEWKMGXt96bMx8Zzd+GpyYFu0bScaoZRcLzxCSNymhEOmMl3nPe5pS66s46e0ixBz/27+35X1aboh3mcF2ig3soaYTOVQQI0Q==",
"VK_AUTO" => "N"
);
// 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"] . /* 1911 */
str_pad (mb_strlen($fields["VK_VERSION"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_VERSION"] . /* 008 */
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_STAMP"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_STAMP"] . /* 4 */
str_pad (mb_strlen($fields["VK_REF"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_REF"] . /* 42 */
str_pad (mb_strlen($fields["VK_MSG"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_MSG"]; /* Plastok tellimus 26.02.2021 10:58 Ref.:4 */
/* $data = "0041911003008003EYP009uid100036001400242040Plastok tellimus 26.02.2021 10:58 Ref.:4"; */
// 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
// ==============================================
?>
Payment results
Payment:
Signature: