PHP Class Jose\Util\RSA

显示文件 Open project: spomky-labs/jose Class Usage Examples

Public Methods

Method Description
decrypt ( RSAKey $key, string $ciphertext, string $hash_algorithm ) : string Decryption.
encrypt ( RSAKey $key, string $plaintext, string $hash_algorithm ) : string Encryption.
sign ( RSAKey $key, string $message, string $hash ) : string Create a signature.
verify ( RSAKey $key, string $message, string $signature, string $hash ) : boolean Verifies a signature.

Private Methods

Method Description
convertIntegerToOctetString ( BigInteger $x, integer $xLen ) : string Integer-to-Octet-String primitive.
convertOctetStringToInteger ( string $x ) : BigInteger Octet-String-to-Integer primitive.
encodeEMSAPSS ( string $m, integer $emBits, Hash $hash ) : string | boolean EMSA-PSS-ENCODE.
encryptRSAESOAEP ( RSAKey $key, string $m, Hash $hash ) : string RSAES-OAEP-ENCRYPT.
exponentiate ( RSAKey $key, BigInteger $c ) : BigInteger Exponentiate with or without Chinese Remainder Theorem.
getMGF1 ( string $mgfSeed, integer $maskLen, Hash $mgfHash ) : string MGF1.
getRSADP ( RSAKey $key, BigInteger $c ) : BigInteger | false RSA DP.
getRSAEP ( RSAKey $key, BigInteger $m ) : BigInteger | false RSA EP.
getRSAESOAEP ( RSAKey $key, string $c, Hash $hash ) : string RSAES-OAEP-DECRYPT.
getRSASP1 ( RSAKey $key, BigInteger $m ) : BigInteger | false RSA SP1.
getRSAVP1 ( RSAKey $key, BigInteger $s ) : BigInteger | false RSAVP1.
verifyEMSAPSS ( string $m, string $em, integer $emBits, Hash $hash ) : boolean EMSA-PSS-VERIFY.

Method Details

decrypt() public static method

Decryption.
public static decrypt ( RSAKey $key, string $ciphertext, string $hash_algorithm ) : string
$key Jose\KeyConverter\RSAKey
$ciphertext string
$hash_algorithm string
return string

encrypt() public static method

Encryption.
public static encrypt ( RSAKey $key, string $plaintext, string $hash_algorithm ) : string
$key Jose\KeyConverter\RSAKey
$plaintext string
$hash_algorithm string
return string

sign() public static method

Create a signature.
public static sign ( RSAKey $key, string $message, string $hash ) : string
$key Jose\KeyConverter\RSAKey
$message string
$hash string
return string

verify() public static method

Verifies a signature.
public static verify ( RSAKey $key, string $message, string $signature, string $hash ) : boolean
$key Jose\KeyConverter\RSAKey
$message string
$signature string
$hash string
return boolean