1496. Class

1496.1. Zend\Crypt\PublicKey\Rsa

Implementation of the RSA public key encryption algorithm.

1496.1.1. Methods

1496.1.1.1. factory

factory()

RSA instance factory

Parameters:array|Traversable
Return type:Rsa
Throws :RsaExceptionRuntimeException
Throws :RsaExceptionInvalidArgumentException

1496.1.1.2. __construct

__construct()

Class constructor

Parameters:RsaOptions
Throws RsaExceptionRuntimeException:
 

1496.1.1.3. setOptions

setOptions()

Set options

Parameters:RsaOptions
Return type:Rsa

1496.1.1.4. getOptions

getOptions()

Get options

Return type:RsaOptions

1496.1.1.5. sign

sign()

Sign with private key

Parameters:
  • string
  • RsaPrivateKey
Return type:

string

Throws :

RsaExceptionRuntimeException

1496.1.1.6. verify

verify()

Verify signature with public key

$signature can be encoded in base64 or not. $mode sets how the input must be processed:
  • MODE_AUTO: Check if the $signature is encoded in base64. Not recommended for performance.
  • MODE_BASE64: Decode $signature using base64 algorithm.
  • MODE_RAW: $signature is not encoded.
Parameters:
  • string
  • string
  • null|RsaPublicKey
  • int – Input encoding
Return type:

bool

Throws :

RsaExceptionRuntimeException

See :
See :
See :

1496.1.1.7. encrypt

encrypt()

Encrypt with private/public key

Parameters:
  • string
  • RsaAbstractKey
Return type:

string

Throws :

RsaExceptionInvalidArgumentException

1496.1.1.8. decrypt

decrypt()

Decrypt with private/public key

$data can be encoded in base64 or not. $mode sets how the input must be processed:
  • MODE_AUTO: Check if the $signature is encoded in base64. Not recommended for performance.
  • MODE_BASE64: Decode $data using base64 algorithm.
  • MODE_RAW: $data is not encoded.
Parameters:
  • string
  • RsaAbstractKey
  • int – Input encoding
Return type:

string

Throws :

RsaExceptionInvalidArgumentException

See :
See :
See :

1496.1.1.9. generateKeys

generateKeys()

Generate new private/public key pair

Parameters:array
Return type:Rsa
Throws :RsaExceptionRuntimeException

1496.1.2. Constants

1496.1.2.1. MODE_AUTO

1496.1.2.2. MODE_BASE64

1496.1.2.3. MODE_RAW