Zend Framework  3.0
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
PublicKey Class Reference

RSA public key. More...

Public Member Functions

 __construct ($pemStringOrCertificate)
 Construct public key with PEM formatted string or X.509 certificate.
 
 encrypt ($data, $padding=OPENSSL_PKCS1_OAEP_PADDING)
 Encrypt using this key.
 
 decrypt ($data, $padding=OPENSSL_PKCS1_PADDING)
 Decrypt using this key.
 
 getCertificate ()
 Get certificate string.
 
 toString ()
 To string.
 
- Public Member Functions inherited from AbstractKey
 getSize ()
 Get key size in bits.
 
 getOpensslKeyResource ()
 Retrieve openssl key resource.
 
 encrypt ($data)
 Encrypt using this key.
 
 decrypt ($data)
 Decrypt using this key.
 
 toString ()
 Get string representation of this key.
 
 __toString ()
 

Static Public Member Functions

static fromFile ($pemOrCertificateFile)
 Create public key instance public key from PEM formatted key file or X.509 certificate file.
 

Public Attributes

const CERT_START = '-----BEGIN CERTIFICATE-----'
 
- Public Attributes inherited from AbstractKey
const DEFAULT_KEY_SIZE = 2048
 

Protected Attributes

 $certificateString = null
 
- Protected Attributes inherited from AbstractKey
 $pemString = null
 
 $opensslKeyResource = null
 
 $details = []
 

Detailed Description

RSA public key.

Constructor & Destructor Documentation

__construct (   $pemStringOrCertificate)

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

Parameters
string$pemStringOrCertificate
Exceptions
Exception\RuntimeException

Member Function Documentation

decrypt (   $data,
  $padding = OPENSSL_PKCS1_PADDING 
)

Decrypt using this key.

Parameters
string$data
string$padding
Exceptions
Exception\InvalidArgumentException
Exception\RuntimeException
Returns
string
encrypt (   $data,
  $padding = OPENSSL_PKCS1_OAEP_PADDING 
)

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.

See Also
http://archiv.infsec.ethz.ch/education/fs08/secsem/bleichenbacher98.pdf
Parameters
string$data
string$padding
Exceptions
Exception\InvalidArgumentException
Exception\RuntimeException
Returns
string
static fromFile (   $pemOrCertificateFile)
static

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

Parameters
string$pemOrCertificateFile
Returns
PublicKey
Exceptions
Exception\InvalidArgumentException
getCertificate ( )

Get certificate string.

Returns
string
toString ( )

To string.

Returns
string
Exceptions
Exception\RuntimeException

Member Data Documentation

$certificateString = null
protected
const CERT_START = '-----BEGIN CERTIFICATE-----'