lib/plugin/webauth/vendor/phpseclib/phpseclib/phpseclib/CryptRSA.php

Pure-PHP PKCS#1 (v2.1) compliant implementation of RSA.

PHP version 5

Here's an example of how to encrypt and decrypt text with this library: <?php include 'vendor/autoload.php';

$rsa = new \phpseclib\Crypt\RSA(); extract($rsa->createKey());

$plaintext = 'terrafrost';

$rsa->loadKey($privatekey); $ciphertext = $rsa->encrypt($plaintext);

$rsa->loadKey($publickey); echo $rsa->decrypt($ciphertext); ?>

Here's an example of how to create signatures and verify signatures with this library: <?php include 'vendor/autoload.php';

$rsa = new \phpseclib\Crypt\RSA(); extract($rsa->createKey());

$plaintext = 'terrafrost';

$rsa->loadKey($privatekey); $signature = $rsa->sign($plaintext);

$rsa->loadKey($publickey); echo $rsa->verify($plaintext, $signature) ? 'verified' : 'unverified'; ?>

Classes

RSA Pure-PHP PKCS#1 compliant implementation of RSA.

Constants

CRYPT_RSA_MODE

CRYPT_RSA_MODE

MATH_BIGINTEGER_OPENSSL_DISABLE

MATH_BIGINTEGER_OPENSSL_DISABLE

CRYPT_RSA_EXPONENT

CRYPT_RSA_EXPONENT

CRYPT_RSA_SMALLEST_PRIME

CRYPT_RSA_SMALLEST_PRIME