Class PublicKey

Summary

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

Description

RSA public key

Methods

Name Description Defined By
__construct() Construct public key with PEM formatted string or X.509 certificate PublicKey
__toString() AbstractKey
decrypt() Decrypt using this key PublicKey
encrypt() Encrypt using this key PublicKey
fromFile() Create public key instance public key from PEM formatted key file or X.509 certificate file PublicKey
getCertificate() Get certificate string PublicKey
getOpensslKeyResource() Retrieve openssl key resource AbstractKey
getSize() Get key size in bits AbstractKey
toString() To string PublicKey

Method Details

__construct()

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

Parameter Name Type Description
$pemStringOrCertificate string

Returns:

__toString()

Returns: string

decrypt()

Decrypt using this key

Parameter Name Type Description
$data string
$padding string

Returns: string

encrypt()

Encrypt 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 string

Returns: string

fromFile()

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

Parameter Name Type Description
$pemOrCertificateFile string

Returns: \PublicKey

getCertificate()

Get certificate string

Returns: string

getOpensslKeyResource()

Retrieve openssl key resource

Returns: resource

getSize()

Get key size in bits

Returns: int

toString()

To string

Returns: string

Top