Procedural File: RSA.php
Source Location: /lib/3rdParty/phpseclib/Crypt/RSA.php
Classes:
Crypt_RSA
Pure-PHP PKCS#1 compliant implementation of RSA.
Page Details:
Pure-PHP PKCS#1 (v2.1) compliant implementation of RSA.
PHP versions 4 and 5 Here's an example of how to encrypt and decrypt text with this library: <?php
include('Crypt/RSA.php');
$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('Crypt/RSA.php');
$plaintext = 'terrafrost';
$rsa->loadKey($privatekey);
$signature = $rsa->sign($plaintext);
$rsa->loadKey($publickey);
echo $rsa->verify($plaintext, $signature) ? 'verified' : 'unverified';
?>
LICENSE: This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Tags:
Includes:
require_once('Crypt/Random.php') [line 77]
Include Crypt_Random
require_once('Crypt/Hash.php') [line 82]
Include Crypt_Hash
require_once('Math/BigInteger.php') [line 72]
Include Math_BigInteger
CRYPT_RSA_ENCRYPTION_OAEP [line 98]
CRYPT_RSA_ENCRYPTION_PKCS1 [line 105]
CRYPT_RSA_PRIVATE_FORMAT_PKCS1 [line 172]
CRYPT_RSA_PUBLIC_FORMAT_OPENSSH [line 203]
CRYPT_RSA_PUBLIC_FORMAT_PKCS1 [line 197]
CRYPT_RSA_PUBLIC_FORMAT_RAW [line 193]
CRYPT_RSA_SIGNATURE_PKCS1 [line 129]
CRYPT_RSA_SIGNATURE_PSS [line 122]
|