\phpseclib\FileX509

Pure-PHP X.509 Parser

Summary

Methods
Properties
Constants
__construct()
loadX509()
saveX509()
_mapInExtensions()
_mapOutExtensions()
_mapInAttributes()
_mapOutAttributes()
_mapInDNs()
_mapOutDNs()
_getMapping()
loadCA()
validateURL()
validateDate()
_fetchURL()
_testForIntermediate()
validateSignature()
_validateSignatureCountable()
_validateSignature()
setRecurLimit()
disableURLFetch()
enableURLFetch()
_reformatKey()
_decodeIP()
_encodeIP()
_translateDNProp()
setDNProp()
removeDNProp()
getDNProp()
setDN()
getDN()
getIssuerDN()
getSubjectDN()
getIssuerDNProp()
getSubjectDNProp()
getChain()
setPublicKey()
setPrivateKey()
setChallenge()
getPublicKey()
loadCSR()
saveCSR()
loadSPKAC()
saveSPKAC()
loadCRL()
saveCRL()
_timeField()
sign()
signCSR()
signSPKAC()
signCRL()
_sign()
setStartDate()
setEndDate()
setSerialNumber()
makeCA()
_isSubArrayValid()
_subArrayUnchecked()
_subArray()
_extensions()
_removeExtension()
_getExtension()
_getExtensions()
_setExtension()
removeExtension()
getExtension()
getExtensions()
setExtension()
removeAttribute()
getAttribute()
getAttributes()
setAttribute()
setKeyIdentifier()
computeKeyIdentifier()
_formatSubjectPublicKey()
setDomain()
setIPAddress()
_dnsName()
_iPAddress()
_revokedCertificate()
revoke()
unrevoke()
getRevoked()
listRevoked()
removeRevokedCertificateExtension()
getRevokedCertificateExtension()
getRevokedCertificateExtensions()
setRevokedCertificateExtension()
_extractBER()
getOID()
$Certificate
$DirectoryString
$PKCS9String
$AttributeValue
$Extensions
$KeyUsage
$ExtKeyUsageSyntax
$BasicConstraints
$KeyIdentifier
$CRLDistributionPoints
$AuthorityKeyIdentifier
$CertificatePolicies
$AuthorityInfoAccessSyntax
$SubjectAltName
$SubjectDirectoryAttributes
$PrivateKeyUsagePeriod
$IssuerAltName
$PolicyMappings
$NameConstraints
$CPSuri
$UserNotice
$netscape_cert_type
$netscape_comment
$netscape_ca_policy_url
$Name
$RelativeDistinguishedName
$CRLNumber
$CRLReason
$IssuingDistributionPoint
$InvalidityDate
$CertificateIssuer
$HoldInstructionCode
$SignedPublicKeyAndChallenge
$PostalAddress
$CertificationRequest
$CertificateList
$dn
$publicKey
$privateKey
$oids
$CAs
$currentCert
$signatureSubject
$startDate
$endDate
$serialNumber
$currentKeyIdentifier
$caFlag
$challenge
$recur_limit
$disable_url_fetch
VALIDATE_SIGNATURE_BY_CA
DN_ARRAY
DN_STRING
DN_ASN1
DN_OPENSSL
DN_CANON
DN_HASH
FORMAT_PEM
FORMAT_DER
FORMAT_SPKAC
FORMAT_AUTO_DETECT
ATTR_ALL
ATTR_APPEND
ATTR_REPLACE
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

VALIDATE_SIGNATURE_BY_CA

VALIDATE_SIGNATURE_BY_CA

Flag to only accept signatures signed by certificate authorities

Not really used anymore but retained all the same to suppress E_NOTICEs from old installs

DN_ARRAY

DN_ARRAY

Return internal array representation

DN_STRING

DN_STRING

Return string

DN_ASN1

DN_ASN1

Return ASN.1 name string

DN_OPENSSL

DN_OPENSSL

Return OpenSSL compatible array

DN_CANON

DN_CANON

Return canonical ASN.1 RDNs string

DN_HASH

DN_HASH

Return name hash for file indexing

FORMAT_PEM

FORMAT_PEM

Save as PEM

ie. a base64-encoded PEM with a header and a footer

FORMAT_DER

FORMAT_DER

Save as DER

FORMAT_SPKAC

FORMAT_SPKAC

Save as a SPKAC

Only works on CSRs. Not currently supported.

FORMAT_AUTO_DETECT

FORMAT_AUTO_DETECT

Auto-detect the format

Used only by the load*() functions

ATTR_ALL

ATTR_ALL

Attribute value disposition.

If disposition is >= 0, this is the index of the target value.

ATTR_APPEND

ATTR_APPEND

ATTR_REPLACE

ATTR_REPLACE

Properties

$Certificate

$Certificate : array

ASN.1 syntax for X.509 certificates

Type

array

$DirectoryString

$DirectoryString : 

Type

$PKCS9String

$PKCS9String : 

Type

$AttributeValue

$AttributeValue : 

Type

$Extensions

$Extensions : 

Type

$KeyUsage

$KeyUsage : 

Type

$ExtKeyUsageSyntax

$ExtKeyUsageSyntax : 

Type

$BasicConstraints

$BasicConstraints : 

Type

$KeyIdentifier

$KeyIdentifier : 

Type

$CRLDistributionPoints

$CRLDistributionPoints : 

Type

$AuthorityKeyIdentifier

$AuthorityKeyIdentifier : 

Type

$CertificatePolicies

$CertificatePolicies : 

Type

$AuthorityInfoAccessSyntax

$AuthorityInfoAccessSyntax : 

Type

$SubjectAltName

$SubjectAltName : 

Type

$SubjectDirectoryAttributes

$SubjectDirectoryAttributes : 

Type

$PrivateKeyUsagePeriod

$PrivateKeyUsagePeriod : 

Type

$IssuerAltName

$IssuerAltName : 

Type

$PolicyMappings

$PolicyMappings : 

Type

$NameConstraints

$NameConstraints : 

Type

$CPSuri

$CPSuri : 

Type

$UserNotice

$UserNotice : 

Type

$netscape_cert_type

$netscape_cert_type : 

Type

$netscape_comment

$netscape_comment : 

Type

$netscape_ca_policy_url

$netscape_ca_policy_url : 

Type

$Name

$Name : 

Type

$RelativeDistinguishedName

$RelativeDistinguishedName : 

Type

$CRLNumber

$CRLNumber : 

Type

$CRLReason

$CRLReason : 

Type

$IssuingDistributionPoint

$IssuingDistributionPoint : 

Type

$InvalidityDate

$InvalidityDate : 

Type

$CertificateIssuer

$CertificateIssuer : 

Type

$HoldInstructionCode

$HoldInstructionCode : 

Type

$SignedPublicKeyAndChallenge

$SignedPublicKeyAndChallenge : 

Type

$PostalAddress

$PostalAddress : 

Type

$CertificationRequest

$CertificationRequest : array

ASN.1 syntax for Certificate Signing Requests (RFC2986)

Type

array

$CertificateList

$CertificateList : array

ASN.1 syntax for Certificate Revocation Lists (RFC5280)

Type

array

$dn

$dn : array

Distinguished Name

Type

array

$publicKey

$publicKey : string

Public key

Type

string

$privateKey

$privateKey : string

Private key

Type

string

$oids

$oids : array

Object identifiers for X.509 certificates

Type

array

$CAs

$CAs : array

The certificate authorities

Type

array

$currentCert

$currentCert : array

The currently loaded certificate

Type

array

$signatureSubject

$signatureSubject : string

The signature subject

There's no guarantee \phpseclib\File\X509 is going to re-encode an X.509 cert in the same way it was originally encoded so we take save the portion of the original cert that the signature would have made for.

Type

string

$startDate

$startDate : string

Certificate Start Date

Type

string

$endDate

$endDate : string

Certificate End Date

Type

string

$serialNumber

$serialNumber : string

Serial Number

Type

string

$caFlag

$caFlag : boolean

CA Flag

Type

boolean

$challenge

$challenge : string

SPKAC Challenge

Type

string

$recur_limit

$recur_limit : integer

Recursion Limit

Type

integer

$disable_url_fetch

$disable_url_fetch : boolean

URL fetch flag

Type

boolean

Methods

__construct()

__construct() : \phpseclib\File\X509

Default Constructor.

Returns

\phpseclib\File\X509

loadX509()

loadX509(string  $cert, integer  $mode = self::FORMAT_AUTO_DETECT) : mixed

Load X.509 certificate

Returns an associative array describing the X.509 cert or a false if the cert failed to load

Parameters

string $cert
integer $mode

Returns

mixed

saveX509()

saveX509(array  $cert, integer  $format = self::FORMAT_PEM) : string

Save X.509 certificate

Parameters

array $cert
integer $format

optional

Returns

string

_mapInExtensions()

_mapInExtensions(  $root, string  $path, object  $asn1) 

Map extension values from octet string to extension-specific internal format.

Parameters

$root
string $path
object $asn1

_mapOutExtensions()

_mapOutExtensions(  $root, string  $path, object  $asn1) 

Map extension values from extension-specific internal format to octet string.

Parameters

$root
string $path
object $asn1

_mapInAttributes()

_mapInAttributes(  $root, string  $path, object  $asn1) 

Map attribute values from ANY type to attribute-specific internal format.

Parameters

$root
string $path
object $asn1

_mapOutAttributes()

_mapOutAttributes(  $root, string  $path, object  $asn1) 

Map attribute values from attribute-specific internal format to ANY type.

Parameters

$root
string $path
object $asn1

_mapInDNs()

_mapInDNs(  $root, string  $path, object  $asn1) 

Map DN values from ANY type to DN-specific internal format.

Parameters

$root
string $path
object $asn1

_mapOutDNs()

_mapOutDNs(  $root, string  $path, object  $asn1) 

Map DN values from DN-specific internal format to ANY type.

Parameters

$root
string $path
object $asn1

_getMapping()

_getMapping(string  $extnId) : mixed

Associate an extension ID to an extension mapping

Parameters

string $extnId

Returns

mixed

loadCA()

loadCA(string  $cert) : boolean

Load an X.509 certificate as a certificate authority

Parameters

string $cert

Returns

boolean

validateURL()

validateURL(string  $url) : boolean

Validate an X.509 certificate against a URL

From RFC2818 "HTTP over TLS":

Matching is performed using the matching rules specified by [RFC2459]. If more than one identity of a given type is present in the certificate (e.g., more than one dNSName name, a match in any one of the set is considered acceptable.) Names may contain the wildcard character which is considered to match any single domain name component or component fragment. E.g., .a.com matches foo.a.com but not bar.foo.a.com. f*.com matches foo.com but not bar.com.

Parameters

string $url

Returns

boolean

validateDate()

validateDate(\DateTime|string  $date = null) 

Validate a date

If $date isn't defined it is assumed to be the current date.

Parameters

\DateTime|string $date

optional

_fetchURL()

_fetchURL(string  $url) : boolean|string

Fetches a URL

Parameters

string $url

Returns

boolean|string

_testForIntermediate()

_testForIntermediate(boolean  $caonly, integer  $count) : boolean

Validates an intermediate cert as identified via authority info access extension

See https://tools.ietf.org/html/rfc4325 for more info

Parameters

boolean $caonly
integer $count

Returns

boolean

validateSignature()

validateSignature(boolean  $caonly = true) : mixed

Validate a signature

Works on X.509 certs, CSR's and CRL's. Returns true if the signature is verified, false if it is not correct or null on error

By default returns false for self-signed certs. Call validateSignature(false) to make this support self-signed.

The behavior of this function is inspired by openssl_verify.

Parameters

boolean $caonly

optional

Returns

mixed

_validateSignatureCountable()

_validateSignatureCountable(boolean  $caonly, integer  $count) : mixed

Validate a signature

Performs said validation whilst keeping track of how many times validation method is called

Parameters

boolean $caonly
integer $count

Returns

mixed

_validateSignature()

_validateSignature(string  $publicKeyAlgorithm, string  $publicKey, string  $signatureAlgorithm, string  $signature, string  $signatureSubject) : integer

Validates a signature

Returns true if the signature is verified, false if it is not correct or null on error

Parameters

string $publicKeyAlgorithm
string $publicKey
string $signatureAlgorithm
string $signature
string $signatureSubject

Returns

integer

setRecurLimit()

setRecurLimit(integer  $count) 

Sets the recursion limit

When validating a signature it may be necessary to download intermediate certs from URI's. An intermediate cert that linked to itself would result in an infinite loop so to prevent that we set a recursion limit. A negative number means that there is no recursion limit.

Parameters

integer $count

disableURLFetch()

disableURLFetch() 

Prevents URIs from being automatically retrieved

enableURLFetch()

enableURLFetch() 

Allows URIs to be automatically retrieved

_reformatKey()

_reformatKey(string  $algorithm, string  $key) : string

Reformat public keys

Reformats a public key to a format supported by phpseclib (if applicable)

Parameters

string $algorithm
string $key

Returns

string

_decodeIP()

_decodeIP(string  $ip) : string

Decodes an IP address

Takes in a base64 encoded "blob" and returns a human readable IP address

Parameters

string $ip

Returns

string

_encodeIP()

_encodeIP(string  $ip) : string

Encodes an IP address

Takes a human readable IP address into a base64-encoded "blob"

Parameters

string $ip

Returns

string

_translateDNProp()

_translateDNProp(string  $propName) : mixed

"Normalizes" a Distinguished Name property

Parameters

string $propName

Returns

mixed

setDNProp()

setDNProp(string  $propName, mixed  $propValue, string  $type = 'utf8String') : boolean

Set a Distinguished Name property

Parameters

string $propName
mixed $propValue
string $type

optional

Returns

boolean

removeDNProp()

removeDNProp(string  $propName) 

Remove Distinguished Name properties

Parameters

string $propName

getDNProp()

getDNProp(string  $propName, array  $dn = null, boolean  $withType = false) : mixed

Get Distinguished Name properties

Parameters

string $propName
array $dn

optional

boolean $withType

optional

Returns

mixed

setDN()

setDN(mixed  $dn, boolean  $merge = false, string  $type = 'utf8String') : boolean

Set a Distinguished Name

Parameters

mixed $dn
boolean $merge

optional

string $type

optional

Returns

boolean

getDN()

getDN(mixed  $format = self::DN_ARRAY, array  $dn = null) : boolean

Get the Distinguished Name for a certificates subject

Parameters

mixed $format

optional

array $dn

optional

Returns

boolean

getIssuerDN()

getIssuerDN(integer  $format = self::DN_ARRAY) : mixed

Get the Distinguished Name for a certificate/crl issuer

Parameters

integer $format

optional

Returns

mixed

getSubjectDN()

getSubjectDN(integer  $format = self::DN_ARRAY) : mixed

Get the Distinguished Name for a certificate/csr subject Alias of getDN()

Parameters

integer $format

optional

Returns

mixed

getIssuerDNProp()

getIssuerDNProp(string  $propName, boolean  $withType = false) : mixed

Get an individual Distinguished Name property for a certificate/crl issuer

Parameters

string $propName
boolean $withType

optional

Returns

mixed

getSubjectDNProp()

getSubjectDNProp(string  $propName, boolean  $withType = false) : mixed

Get an individual Distinguished Name property for a certificate/csr subject

Parameters

string $propName
boolean $withType

optional

Returns

mixed

getChain()

getChain() : mixed

Get the certificate chain for the current cert

Returns

mixed

setPublicKey()

setPublicKey(object  $key) : boolean

Set public key

Key needs to be a \phpseclib\Crypt\RSA object

Parameters

object $key

Returns

boolean

setPrivateKey()

setPrivateKey(object  $key) 

Set private key

Key needs to be a \phpseclib\Crypt\RSA object

Parameters

object $key

setChallenge()

setChallenge(string  $challenge) 

Set challenge

Used for SPKAC CSR's

Parameters

string $challenge

getPublicKey()

getPublicKey() : mixed

Gets the public key

Returns a \phpseclib\Crypt\RSA object or a false.

Returns

mixed

loadCSR()

loadCSR(string  $csr,   $mode = self::FORMAT_AUTO_DETECT) : mixed

Load a Certificate Signing Request

Parameters

string $csr
$mode

Returns

mixed

saveCSR()

saveCSR(array  $csr, integer  $format = self::FORMAT_PEM) : string

Save CSR request

Parameters

array $csr
integer $format

optional

Returns

string

saveSPKAC()

saveSPKAC(  $spkac, integer  $format = self::FORMAT_PEM) : string

Save a SPKAC CSR request

Parameters

$spkac
integer $format

optional

Returns

string

loadCRL()

loadCRL(string  $crl,   $mode = self::FORMAT_AUTO_DETECT) : mixed

Load a Certificate Revocation List

Parameters

string $crl
$mode

Returns

mixed

saveCRL()

saveCRL(array  $crl, integer  $format = self::FORMAT_PEM) : string

Save Certificate Revocation List.

Parameters

array $crl
integer $format

optional

Returns

string

_timeField()

_timeField(string  $date) : array

Helper function to build a time field according to RFC 3280 section - 4.1.2.5 Validity - 5.1.2.4 This Update - 5.1.2.5 Next Update - 5.1.2.6 Revoked Certificates by choosing utcTime iff year of date given is before 2050 and generalTime else.

Parameters

string $date

in format date('D, d M Y H:i:s O')

Returns

array

sign()

sign(\phpseclib\File\X509  $issuer, \phpseclib\File\X509  $subject, string  $signatureAlgorithm = 'sha1WithRSAEncryption') : mixed

Sign an X.509 certificate

$issuer's private key needs to be loaded. $subject can be either an existing X.509 cert (if you want to resign it), a CSR or something with the DN and public key explicitly set.

Parameters

\phpseclib\File\X509 $issuer
\phpseclib\File\X509 $subject
string $signatureAlgorithm

optional

Returns

mixed

signCSR()

signCSR(  $signatureAlgorithm = 'sha1WithRSAEncryption') : mixed

Sign a CSR

Parameters

$signatureAlgorithm

Returns

mixed

signSPKAC()

signSPKAC(  $signatureAlgorithm = 'sha1WithRSAEncryption') : mixed

Sign a SPKAC

Parameters

$signatureAlgorithm

Returns

mixed

signCRL()

signCRL(\phpseclib\File\X509  $issuer, \phpseclib\File\X509  $crl, string  $signatureAlgorithm = 'sha1WithRSAEncryption') : mixed

Sign a CRL

$issuer's private key needs to be loaded.

Parameters

\phpseclib\File\X509 $issuer
\phpseclib\File\X509 $crl
string $signatureAlgorithm

optional

Returns

mixed

_sign()

_sign(object  $key, string  $signatureAlgorithm) : mixed

X.509 certificate signing helper function.

Parameters

object $key
string $signatureAlgorithm

Returns

mixed

setStartDate()

setStartDate(string  $date) 

Set certificate start date

Parameters

string $date

setEndDate()

setEndDate(string  $date) 

Set certificate end date

Parameters

string $date

setSerialNumber()

setSerialNumber(string  $serial,   $base = -256) 

Set Serial Number

Parameters

string $serial
$base

optional

makeCA()

makeCA() 

Turns the certificate into a certificate authority

_isSubArrayValid()

_isSubArrayValid(array  $root, string  $path) : boolean

Check for validity of subarray

This is intended for use in conjunction with _subArrayUnchecked(), implementing the checks included in _subArray() but without copying a potentially large array by passing its reference by-value to is_array().

Parameters

array $root
string $path

Returns

boolean

_subArrayUnchecked()

_subArrayUnchecked(array  $root, string  $path, boolean  $create = false) : array|false

Get a reference to a subarray

This variant of _subArray() does no is_array() checking, so $root should be checked with _isSubArrayValid() first.

This is here for performance reasons: Passing a reference (i.e. $root) by-value (i.e. to is_array()) creates a copy. If $root is an especially large array, this is expensive.

Parameters

array $root
string $path

absolute path with / as component separator

boolean $create

optional

Returns

array|false

_subArray()

_subArray(array  $root, string  $path, boolean  $create = false) : array|false

Get a reference to a subarray

Parameters

array $root
string $path

absolute path with / as component separator

boolean $create

optional

Returns

array|false

_extensions()

_extensions(array  $root, string  $path = null, boolean  $create = false) : array|false

Get a reference to an extension subarray

Parameters

array $root
string $path

optional absolute path with / as component separator

boolean $create

optional

Returns

array|false

_removeExtension()

_removeExtension(string  $id, string  $path = null) : boolean

Remove an Extension

Parameters

string $id
string $path

optional

Returns

boolean

_getExtension()

_getExtension(string  $id, array  $cert = null, string  $path = null) : mixed

Get an Extension

Returns the extension if it exists and false if not

Parameters

string $id
array $cert

optional

string $path

optional

Returns

mixed

_getExtensions()

_getExtensions(array  $cert = null, string  $path = null) : array

Returns a list of all extensions in use

Parameters

array $cert

optional

string $path

optional

Returns

array

_setExtension()

_setExtension(string  $id, mixed  $value, boolean  $critical = false, boolean  $replace = true, string  $path = null) : boolean

Set an Extension

Parameters

string $id
mixed $value
boolean $critical

optional

boolean $replace

optional

string $path

optional

Returns

boolean

removeExtension()

removeExtension(string  $id) : boolean

Remove a certificate, CSR or CRL Extension

Parameters

string $id

Returns

boolean

getExtension()

getExtension(string  $id, array  $cert = null) : mixed

Get a certificate, CSR or CRL Extension

Returns the extension if it exists and false if not

Parameters

string $id
array $cert

optional

Returns

mixed

getExtensions()

getExtensions(array  $cert = null) : array

Returns a list of all extensions in use in certificate, CSR or CRL

Parameters

array $cert

optional

Returns

array

setExtension()

setExtension(string  $id, mixed  $value, boolean  $critical = false, boolean  $replace = true) : boolean

Set a certificate, CSR or CRL Extension

Parameters

string $id
mixed $value
boolean $critical

optional

boolean $replace

optional

Returns

boolean

removeAttribute()

removeAttribute(string  $id, integer  $disposition = self::ATTR_ALL) : boolean

Remove a CSR attribute.

Parameters

string $id
integer $disposition

optional

Returns

boolean

getAttribute()

getAttribute(string  $id, integer  $disposition = self::ATTR_ALL, array  $csr = null) : mixed

Get a CSR attribute

Returns the attribute if it exists and false if not

Parameters

string $id
integer $disposition

optional

array $csr

optional

Returns

mixed

getAttributes()

getAttributes(array  $csr = null) : array

Returns a list of all CSR attributes in use

Parameters

array $csr

optional

Returns

array

setAttribute()

setAttribute(string  $id, mixed  $value, boolean  $disposition = self::ATTR_ALL) : boolean

Set a CSR attribute

Parameters

string $id
mixed $value
boolean $disposition

optional

Returns

boolean

setKeyIdentifier()

setKeyIdentifier(string  $value) 

Sets the subject key identifier

This is used by the id-ce-authorityKeyIdentifier and the id-ce-subjectKeyIdentifier extensions.

Parameters

string $value

computeKeyIdentifier()

computeKeyIdentifier(mixed  $key = null, integer  $method = 1) : string

Compute a public key identifier.

Although key identifiers may be set to any unique value, this function computes key identifiers from public key according to the two recommended methods (4.2.1.2 RFC 3280). Highly polymorphic: try to accept all possible forms of key:

  • Key object
  • \phpseclib\File\X509 object with public or private key defined
  • Certificate or CSR array
  • \phpseclib\File\ASN1\Element object
  • PEM or DER string

Parameters

mixed $key

optional

integer $method

optional

Returns

string —

binary key identifier

_formatSubjectPublicKey()

_formatSubjectPublicKey() : array

Format a public key as appropriate

Returns

array

setDomain()

setDomain() : array

Set the domain name's which the cert is to be valid for

Returns

array

setIPAddress()

setIPAddress() 

Set the IP Addresses's which the cert is to be valid for

_dnsName()

_dnsName(string  $domain) : array

Helper function to build domain array

Parameters

string $domain

Returns

array

_iPAddress()

_iPAddress(string  $address) : array

Helper function to build IP Address array

(IPv6 is not currently supported)

Parameters

string $address

Returns

array

_revokedCertificate()

_revokedCertificate(array  $rclist, string  $serial, boolean  $create = false) : integer|false

Get the index of a revoked certificate.

Parameters

array $rclist
string $serial
boolean $create

optional

Returns

integer|false

revoke()

revoke(string  $serial, string  $date = null) : boolean

Revoke a certificate.

Parameters

string $serial
string $date

optional

Returns

boolean

unrevoke()

unrevoke(string  $serial) : boolean

Unrevoke a certificate.

Parameters

string $serial

Returns

boolean

getRevoked()

getRevoked(string  $serial) : mixed

Get a revoked certificate.

Parameters

string $serial

Returns

mixed

listRevoked()

listRevoked(array  $crl = null) : array

List revoked certificates

Parameters

array $crl

optional

Returns

array

removeRevokedCertificateExtension()

removeRevokedCertificateExtension(string  $serial, string  $id) : boolean

Remove a Revoked Certificate Extension

Parameters

string $serial
string $id

Returns

boolean

getRevokedCertificateExtension()

getRevokedCertificateExtension(string  $serial, string  $id, array  $crl = null) : mixed

Get a Revoked Certificate Extension

Returns the extension if it exists and false if not

Parameters

string $serial
string $id
array $crl

optional

Returns

mixed

getRevokedCertificateExtensions()

getRevokedCertificateExtensions(string  $serial, array  $crl = null) : array

Returns a list of all extensions in use for a given revoked certificate

Parameters

string $serial
array $crl

optional

Returns

array

setRevokedCertificateExtension()

setRevokedCertificateExtension(string  $serial, string  $id, mixed  $value, boolean  $critical = false, boolean  $replace = true) : boolean

Set a Revoked Certificate Extension

Parameters

string $serial
string $id
mixed $value
boolean $critical

optional

boolean $replace

optional

Returns

boolean

_extractBER()

_extractBER(string  $str) : string

Extract raw BER from Base64 encoding

Parameters

string $str

Returns

string

getOID()

getOID(  $name) : string

Returns the OID corresponding to a name

What's returned in the associative array returned by loadX509() (or load*()) is either a name or an OID if no OID to name mapping is available. The problem with this is that what may be an unmapped OID in one version of phpseclib may not be unmapped in the next version, so apps that are looking at this OID may not be able to work from version to version.

This method will return the OID if a name is passed to it and if no mapping is avialable it'll assume that what's being passed to it already is an OID and return that instead. A few examples.

getOID('2.16.840.1.101.3.4.2.1') == '2.16.840.1.101.3.4.2.1' getOID('id-sha256') == '2.16.840.1.101.3.4.2.1' getOID('zzz') == 'zzz'

Parameters

$name

Returns

string