Class PrivateKey

Summary

Fully Qualified Name: Laminas\Crypt\PublicKey\Rsa\PrivateKey
Extends: AbstractKey

Description

RSA private key

Methods

Name Description Defined By
__construct() Constructor PrivateKey
__toString() AbstractKey
decrypt() Decrypt using this key PrivateKey
encrypt() Encrypt using this key PrivateKey
fromFile() Create private key instance from PEM formatted key file PrivateKey
getOpensslKeyResource() Retrieve openssl key resource AbstractKey
getPublicKey() Get the public key PrivateKey
getSize() Get key size in bits AbstractKey
toString() PrivateKey

Method Details

__construct()

Constructor

Parameter Name Type Description
$pemString string
$passPhrase string

Returns:

__toString()

Returns: string

decrypt()

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.

Parameter Name Type Description
$data string
$padding int

Returns: string

encrypt()

Encrypt using this key

Parameter Name Type Description
$data string
$padding int

Returns: string

fromFile()

Create private key instance from PEM formatted key file

Parameter Name Type Description
$pemFile string
$passPhrase string|null

Returns: \PrivateKey

getOpensslKeyResource()

Retrieve openssl key resource

Returns: resource

getPublicKey()

Get the public key

Returns: \PublicKey

getSize()

Get key size in bits

Returns: int

toString()

Returns: string

Top