setEncryptionMode(CRYPT_RSA_ENCRYPTION_PKCS1); $rsa->setPrivateKeyFormat(CRYPT_RSA_PRIVATE_FORMAT_PKCS1); $rsa->setPublicKeyFormat(CRYPT_RSA_PUBLIC_FORMAT_PKCS1); $encryptedToken = ""; $privateKeyFile = "path/to/my/private.key"; /* * Decrypt * Load the private encryption key from a file and decrypt the plaintext. */ $rsa->loadKey(file_get_contents($privateKeyFile)) or die ("Can't load key."); // private key $plain = $rsa->decrypt(base64_decode($ciphertext)); echo $plain; echo "\n"; ?>