RSA private key

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

 Methods

Constructor

__construct(string $pemString, string $passPhrase = null

Parameters

$pemString

string

$passPhrase

string

Exceptions

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

__toString()

__toString() : string
Inherited

Returns

string

Decrypt using this key 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.

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

Parameters

$data

string

$padding

integer

Exceptions

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

Returns

string

Decrypt using this key

decrypt(string $data) : string
Inherited
abstract

Parameters

$data

string

Returns

string

Encrypt using this key

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

Parameters

$data

string

$padding

integer

Exceptions

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

Returns

string

Encrypt using this key

encrypt(string $data) : string
Inherited
abstract

Parameters

$data

string

Returns

string

Create private key instance from PEM formatted key file

fromFile(string $pemFile, string|null $passPhrase = null) : \Zend\Crypt\PublicKey\Rsa\PrivateKey
Static

Parameters

$pemFile

string

$passPhrase

stringnull

Exceptions

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

Returns

\Zend\Crypt\PublicKey\Rsa\PrivateKey

Retrieve openssl key resource

getOpensslKeyResource() : resource
Inherited

Returns

resource

Get the public key

getPublicKey() : \Zend\Crypt\PublicKey\Rsa\PublicKey

Returns

\Zend\Crypt\PublicKey\Rsa\PublicKey

Get key size in bits

getSize() : integer
Inherited

Returns

integer

Get string representation of this key

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

Returns

string

Get string representation of this key

toString() : string
Inherited
abstract

Returns

string

 Properties

 

Openssl details array

$details : array

Default

array()
 

Key Resource

$opensslKeyResource : resource

Default

null
 

PEM formatted key

$pemString : string

Default

null
 

Public key

$publicKey : \Zend\Crypt\PublicKey\Rsa\PublicKey

Default

null

 Constants

 

DEFAULT_KEY_SIZE

DEFAULT_KEY_SIZE = 2048