RSA public key

package Default
inherited_from \Zend\Crypt\PublicKey\Rsa\AbstractKey

 Methods

Construct public key with PEM formatted string or X.509 certificate

__construct(string $pemStringOrCertificate) 

Parameters

$pemStringOrCertificate

string

Exceptions

\Zend\Crypt\PublicKey\Rsa\Exception\RuntimeException

__toString()

__toString() : string
Inherited

Returns

string

Decrypt using this key

decrypt(string $data, string $padding = OPENSSL_PKCS1_PADDING) : string
inherited_from \Zend\Crypt\PublicKey\Rsa\AbstractKey::decrypt()

Parameters

$data

string

$padding

string

Exceptions

\Zend\Crypt\PublicKey\Rsa\Exception\InvalidArgumentException
\Zend\Crypt\PublicKey\Rsa\Exception\RuntimeException

Returns

string

Decrypt using this key

decrypt(string $data) : string
Inherited
abstract

Parameters

$data

string

Returns

string

Encrypt using this key

encrypt(string $data, string $padding = OPENSSL_PKCS1_OAEP_PADDING) : string

Starting in 2.4.9/2.5.2, we changed the default padding to OPENSSL_PKCS1_OAEP_PADDING to prevent Bleichenbacher's chosen-ciphertext attack.

see
inherited_from \Zend\Crypt\PublicKey\Rsa\AbstractKey::encrypt()

Parameters

$data

string

$padding

string

Exceptions

\Zend\Crypt\PublicKey\Rsa\Exception\InvalidArgumentException
\Zend\Crypt\PublicKey\Rsa\Exception\RuntimeException

Returns

string

Encrypt using this key

encrypt(string $data) : string
Inherited
abstract

Parameters

$data

string

Returns

string

Create public key instance public key from PEM formatted key file or X.509 certificate file

fromFile(string $pemOrCertificateFile) : \Zend\Crypt\PublicKey\Rsa\PublicKey
Static

Parameters

$pemOrCertificateFile

string

Exceptions

\Zend\Crypt\PublicKey\Rsa\Exception\InvalidArgumentException

Returns

\Zend\Crypt\PublicKey\Rsa\PublicKey

Get certificate string

getCertificate() : string

Returns

string

Retrieve openssl key resource

getOpensslKeyResource() : resource
Inherited

Returns

resource

Get key size in bits

getSize() : integer
Inherited

Returns

integer

To string

toString() : string
inherited_from \Zend\Crypt\PublicKey\Rsa\AbstractKey::toString()

Exceptions

\Zend\Crypt\PublicKey\Rsa\Exception\RuntimeException

Returns

string

Get string representation of this key

toString() : string
Inherited
abstract

Returns

string

 Properties

 

$certificateString

$certificateString : string

Default

null
 

Openssl details array

$details : array

Default

array()
 

Key Resource

$opensslKeyResource : resource

Default

null
 

PEM formatted key

$pemString : string

Default

null

 Constants

 

CERT_START

CERT_START = '-----BEGIN CERTIFICATE-----' 
 

DEFAULT_KEY_SIZE

DEFAULT_KEY_SIZE = 2048