Fully Qualified Name: | Laminas\Crypt\PublicKey\Rsa\PrivateKey |
Extends: | AbstractKey |
RSA private key
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 |
Constructor
Parameter Name | Type | Description |
---|---|---|
$pemString | string | |
$passPhrase | string |
Returns:
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.
Parameter Name | Type | Description |
---|---|---|
$data | string | |
$padding | int |
Returns: string
Encrypt using this key
Parameter Name | Type | Description |
---|---|---|
$data | string | |
$padding | int |
Returns: string
Create private key instance from PEM formatted key file
Parameter Name | Type | Description |
---|---|---|
$pemFile | string | |
$passPhrase | string|null |
Returns: \PrivateKey
Retrieve openssl key resource
Returns: resource
Get the public key
Returns: \PublicKey
Get key size in bits
Returns: int
Returns: string