VerifyBlind'i bir PHP web sitesine nasıl entegre edeceğinizi gösteren örnek (PHP + Apache).
example-web-nextjs ile aynı (tarayıcı-decrypt / PoP) akışın PHP sürümüdür; example-web-dotnet
ise sunucu-decrypt (callback/webhook) varyantını gösterir.
- Sunucu-taraflı proxy — Tarayıcı
POST /api/generate.phpçağırır; sunucuX-API-Key'i ekleyip VerifyBlindPOST /api/pop/generate'e iletir ve birnoncedöner. API anahtarı tarayıcıya hiç gösterilmez. (api/generate.php) - Doğrulama — Kullanıcı QR'ı VerifyBlind mobil ile okutur; QR'ı
index.htmliçinde CDN'den yüklenen Web SDK (verifyblind.js) çizer. Doğrulama bitince partner'a imzalı bir token döner. - İmza kontrolü —
api/verify.phptoken'ı alır, enclave public key'i ile RSA-PSS imzasını doğrular ve nonce'u tek-kullanımlık tüketir (api/nonce-store.php).
Neden phpseclib3? PHP'nin yerleşik
openssl_verify()fonksiyonu yalnızca PKCS#1 v1.5 destekler (padding parametresi yoktur), enclave ise RSA-PSS ile imzalar. Doğrulama bu yüzden saf PHP olan phpseclib3 ile yapılır —shell_exec/opensslCLI'a ihtiyaç yoktur, dolayısıyla shell'indisable_functionsile kapatıldığı paylaşımlı hosting'lerde de çalışır. Tek gereksinimcomposer install; PHP eklentisi gerekmez.
# Docker (önerilen):
docker build -t verifyblind-php .
docker run -p 8080:80 \
-e TEST_VERIFYBLIND_API_KEY=<partner API anahtarınız> \
-e VERIFYBLIND_API_URL=https://api.verifyblind.com \
verifyblind-php
# → http://localhost:8080Ortam değişkenleri docroot dışından .env'den de okunur (sentry-bootstrap.php).
Bu örnek sıradan bir PHP hosting'de çalışır. Gerekenler: PHP 8.1+, ext-curl, composer.
Shell erişimi (shell_exec, exec) gerekmez — disable_functions ile kapatılmış olabilir.
composer install --no-dev --optimize-autoloader # vendor/ üretir
php tests/self-check.php # kurulum + imza doğrulama denetimiself-check her satırda [ OK ] veriyorsa kurulum bu örneği çalıştırabilir. Composer'ı sunucuda
çalıştıramıyorsanız vendor/ dizinini yerelde üretip dosyalarla birlikte yükleyin.
.env dosyanızı docroot'un DIŞINA koyun — içinde partner API anahtarınız var.
sentry-bootstrap.php önce public_html'in bir üstüne, sonra proje dizinine bakar. Docroot dışına
koyamıyorsanız, birlikte gelen .htaccess dotfile'ları servis edilmekten korur (Apache). nginx
.htaccess okumaz; orada karşılığını sunucu bloğuna ekleyin:
location ~ /\. { deny all; } # .env, .git ...
location ~ ^/(vendor|tests)/ { deny all; }🌐 verifyblind.com · 🧩 Next.js örneği · 🧩 .NET örneği
An example of integrating VerifyBlind into a PHP website (PHP + Apache). It is the PHP version of the
same (browser-decrypt / PoP) flow as example-web-nextjs; example-web-dotnet shows the
server-decrypt (callback/webhook) variant.
- Server-side proxy — The browser calls
POST /api/generate.php; the server adds theX-API-Keyand forwards it to VerifyBlindPOST /api/pop/generate, returning anonce. The API key is never exposed to the browser. (api/generate.php) - Verification — The user scans the QR with VerifyBlind mobile; the QR itself is rendered by the
Web SDK (
verifyblind.js) thatindex.htmlloads from the CDN. On success a signed token is returned to the partner. - Signature check —
api/verify.phptakes the token, verifies the RSA-PSS signature with the enclave public key, and consumes the nonce once (api/nonce-store.php).
Why phpseclib3? PHP's built-in
openssl_verify()only supports PKCS#1 v1.5 (it has no padding parameter), while the enclave signs with RSA-PSS. Verification therefore uses the pure-PHP phpseclib3 — noshell_exec/opensslCLI required, so it also works on shared hosts where the shell is disabled viadisable_functions. The only requirement iscomposer install; no PHP extension is needed.
# Docker (recommended):
docker build -t verifyblind-php .
docker run -p 8080:80 \
-e TEST_VERIFYBLIND_API_KEY=<your partner API key> \
-e VERIFYBLIND_API_URL=https://api.verifyblind.com \
verifyblind-php
# → http://localhost:8080Environment variables can also be read from a .env file outside the docroot (sentry-bootstrap.php).
This example runs on ordinary PHP hosting. Requirements: PHP 8.1+, ext-curl, composer.
Shell access (shell_exec, exec) is not required — it may well be disabled via
disable_functions.
composer install --no-dev --optimize-autoloader # creates vendor/
php tests/self-check.php # checks the install + signature verificationIf self-check prints [ OK ] on every line, the host can run this example. If you cannot run
composer on the server, generate vendor/ locally and upload it along with the files.
.env OUTSIDE the docroot — it holds your partner API key. sentry-bootstrap.php
looks one level above public_html first, then in the project directory. If you cannot place it
outside, the bundled .htaccess stops dotfiles from being served (Apache). nginx does not read
.htaccess; add the equivalent to your server block instead:
location ~ /\. { deny all; } # .env, .git ...
location ~ ^/(vendor|tests)/ { deny all; }🌐 verifyblind.com · 🧩 Next.js example · 🧩 .NET example