1. Go to this page and download the library: Download infocyph/epicrypt library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
infocyph / epicrypt example snippets
use Infocyph\Epicrypt\DataProtection\StringProtector;
use Infocyph\Epicrypt\Generate\KeyMaterial\KeyMaterialGenerator;
$key = (new KeyMaterialGenerator())->forSecretBox();
$protector = new StringProtector();
$ciphertext = $protector->encrypt('secret-value', $key);
$plaintext = $protector->decrypt($ciphertext, $key);
use Infocyph\Epicrypt\DataProtection\FileProtector;
use Infocyph\Epicrypt\Generate\KeyMaterial\KeyMaterialGenerator;
$key = (new KeyMaterialGenerator())->forSecretStream();
$files = new FileProtector();
$files->encrypt('/data/plain.txt', '/data/plain.txt.epc', $key);
$files->decrypt('/data/plain.txt.epc', '/data/plain.out.txt', $key);
use Infocyph\Epicrypt\DataProtection\StringProtector;
use Infocyph\Epicrypt\Security\KeyRing;
$ring = new KeyRing([
'2026-01' => $oldKey,
'2026-05' => $newKey,
], '2026-05');
$protector = new StringProtector();
$ciphertext = $protector->encryptWithKeyRing('rotating-data', $ring);
$result = $protector->decryptWithKeyRingResult($ciphertext, $ring);
use Infocyph\Epicrypt\Password\PasswordHasher;
$hasher = new PasswordHasher();
$hash = $hasher->hashPassword('MyStrongPassword!2026');
$isValid = $hasher->verifyPassword('MyStrongPassword!2026', $hash);
$rehash = $hasher->verifyAndRehash('MyStrongPassword!2026', $hash);
use Infocyph\Epicrypt\Security\CsrfTokenManager;
$csrf = new CsrfTokenManager('csrf-secret');
$token = $csrf->issueToken('session-1');
$ok = $csrf->verifyToken('session-1', $token);
use Infocyph\Epicrypt\Security\SignedUrl;
$signed = new SignedUrl('url-secret');
$url = $signed->generate('https://example.com/download', ['file' => 'report.pdf'], time() + 300);
$ok = $signed->verify($url);
use Infocyph\Epicrypt\Token\Jwt\Enum\SymmetricJwtAlgorithm;
use Infocyph\Epicrypt\Token\Jwt\SymmetricJwt;
use Infocyph\Epicrypt\Token\Jwt\Validation\RegisteredClaims;
$issuer = new SymmetricJwt(SymmetricJwtAlgorithm::HS512);
$token = $issuer->encode([
'iss' => 'issuer-service',
'aud' => 'api',
'sub' => 'user-1',
'jti' => 'jwt-1',
'nbf' => time(),
'exp' => time() + 600,
], 'signing-secret');
$verifier = new SymmetricJwt(
SymmetricJwtAlgorithm::HS512,
new RegisteredClaims('issuer-service', 'api', 'user-1', 'jwt-1'),
);
$ok = $verifier->verify($token, 'signing-secret');
use Infocyph\Epicrypt\Certificate\CertificateBuilder;
use Infocyph\Epicrypt\Certificate\CertificateOptions;
use Infocyph\Epicrypt\Certificate\Enum\OpenSslRsaBits;
use Infocyph\Epicrypt\Certificate\KeyPairGenerator;
$pair = KeyPairGenerator::openSsl(bits: OpenSslRsaBits::BITS_3072)->generate();
$dn = ['commonName' => 'service.example.test'];
$options = new CertificateOptions(
sanDns: ['service.example.test', 'api.example.test'],
);
$certPem = CertificateBuilder::openSsl()->selfSign($dn, $pair['private'], options: $options);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.