Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • components
        • events
          • default
      • controllers
      • models
    • components
      • auth
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • exchange
        • rates
          • foxrate
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
      • json
      • modules
      • net
        • http
        • net
          • amazon
            • s3
          • geo
            • ip
      • plugins
      • recaptcha
      • security
      • session
        • cart
      • settingscollection
      • upgrades
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
  • com
    • tecnick
      • tcpdf
        • blesta
          • components
            • invoice
              • templates
                • quickbooks
                  • invoice
                • templates
                  • default
  • Crypt
    • AES
    • DES
    • Hash
    • Random
    • RC4
    • Rijndael
    • RSA
    • TerraDES
  • File
    • ANSI
    • ASN1
    • X509
  • Math
    • BigInteger
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • html
      • xml
    • lib
  • Net
    • SFTP
    • SSH1
    • SSH2
  • None
  • PHP
  • PHPMailer
  • Services
    • JSON
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • File_X509

Class File_X509

Pure-PHP X.509 Parser

Package: File\X509
Copyright: MMXII Jim Wigginton
License: MIT License
Author: Jim Wigginton <terrafrost@php.net>
Version: 0.3.0
Located at vendors/phpseclib/File/X509.php

Methods summary

public File_X509
# File_X509( )

Default Constructor.

Default Constructor.

Returns

File_X509
public Mixed
# loadX509( String $cert )

Load X.509 certificate

Load X.509 certificate

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

Parameters

$cert
String
$cert

Returns

Mixed
public String
# saveX509( Array $cert )

Save X.509 certificate

Save X.509 certificate

Parameters

$cert
Array
$cert

Returns

String
public Mixed
# _getMapping( String $extnId )

Associate an extension ID to an extension mapping

Associate an extension ID to an extension mapping

Parameters

$extnId
String
$extnId

Returns

Mixed
public Boolean
# loadCA( String $cert )

Load an X.509 certificate as a certificate authority

Load an X.509 certificate as a certificate authority

Parameters

$cert
String
$cert

Returns

Boolean
public Boolean
# validateURL( String $url )

Validate an X.509 certificate against a URL

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

$url
String
$url

Returns

Boolean
public
# validateDate( Integer $date = NULL )

Validate a date

Validate a date

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

Parameters

$date
Integer
$date optional
public Mixed
# validateSignature( Integer $options = 0 )

Validate a signature

Validate a signature

Works on both X.509 certs and CSR's. Returns 1 if the signature is verified, 0 if it is not correct or -1 on error

To know if a signature is valid one should do validateSignature() === 1

The behavior of this function is inspired by openssl_verify.

Parameters

$options
Integer
$options optional

Returns

Mixed
public Integer
# _validateSignature( String $publicKeyAlgorithm, String $publicKey, String $signatureAlgorithm, String $signature, String $signatureSubject )

Validates a signature

Validates a signature

Returns 1 if the signature is verified, 0 if it is not correct or -1 on error

Parameters

$publicKeyAlgorithm
String
$publicKeyAlgorithm
$publicKey
String
$publicKey
$signatureAlgorithm
String
$signatureAlgorithm
$signature
String
$signature
$signatureSubject
String
$signatureSubject

Returns

Integer
public String
# _reformatKey( String $algorithm, String $key )

Reformat public keys

Reformat public keys

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

Parameters

$algorithm
String
$algorithm
$key
String
$key

Returns

String
public Boolean
# setDNProp( String $propName, String $propValue )

Set a Distinguished Name property

Set a Distinguished Name property

Parameters

$propName
String
$propName
$propValue
String
$propValue

Returns

Boolean
public
# removeDNProp( String $propName )

Remove Distinguished Name properties

Remove Distinguished Name properties

Parameters

$propName
String
$propName
public Mixed
# getDNProp( String $propName )

Get Distinguished Name properties

Get Distinguished Name properties

Parameters

$propName
String
$propName

Returns

Mixed
public Boolean
# setDN( Mixed $dn )

Set a Distinguished Name

Set a Distinguished Name

Parameters

$dn
Mixed
$dn

Returns

Boolean
public Boolean
# getDN( Boolean $string = false, mixed $dn = NULL )

Get the Distinguished Name for a certificates subject

Get the Distinguished Name for a certificates subject

Parameters

$string
Boolean
$string optional
$dn

Returns

Boolean
public Boolean
# getIssuerDN( Boolean $string = false )

Get the Distinguished Name for a certificates issuer

Get the Distinguished Name for a certificates issuer

Parameters

$string
Boolean
$string optional

Returns

Boolean
public Boolean
# setPublicKey( Object $key )

Set public key

Set public key

Key needs to be a Crypt_RSA object

Parameters

$key
Object
$key

Returns

Boolean
public
# setPrivateKey( Object $key )

Set private key

Set private key

Key needs to be a Crypt_RSA object

Parameters

$key
Object
$key
public Mixed
# getPublicKey( )

Gets the public key

Gets the public key

Returns a Crypt_RSA object or a false.

Returns

Mixed
public Mixed
# loadCSR( String $csr )

Load a Certificate Signing Request

Load a Certificate Signing Request

Parameters

$csr
String
$csr

Returns

Mixed
public String
# saveCSR( Array $csr )

Save CSR request

Save CSR request

Parameters

$csr
Array
$csr

Returns

String
public Mixed
# sign( File_X509 $issuer, File_X509 $subject, String $signatureAlgorithm = 'sha1WithRSAEncryption' )

Sign an X.509 certificate

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

$issuer
File_X509
$issuer
$subject
File_X509
$subject
$signatureAlgorithm
String
$signatureAlgorithm optional

Returns

Mixed
public Mixed
# signCSR( mixed $signatureAlgorithm = 'sha1WithRSAEncryption' )

Sign a CSR

Sign a CSR

Returns

Mixed
public Mixed
# _sign( Object $key, File_X509 $signatureAlgorithm )

X.509 certificate signing helper function.

X.509 certificate signing helper function.

Parameters

$key
Object
$key
$signatureAlgorithm
File_X509
$subject

Returns

Mixed
public
# setStartDate( String $date )

Set certificate start date

Set certificate start date

Parameters

$date
String
$date
public
# setEndDate( String $date )

Set certificate end date

Set certificate end date

Parameters

$date
String
$date
public
# setSerialNumber( String $serial )

Set Serial Number

Set Serial Number

Parameters

$serial
String
$serial
public
# makeCA( )

Turns the certificate into a certificate authority

Turns the certificate into a certificate authority

public Boolean
# removeExtension( String $id )

Remove an Extension

Remove an Extension

Parameters

$id
String
$id

Returns

Boolean
public Mixed
# getExtension( String $id, mixed $cert = NULL )

Get an Extension

Get an Extension

Returns the extension if it exists and false if not

Parameters

$id
String
$id
$cert

Returns

Mixed
public Array
# getExtensions( mixed $cert = NULL )

Returns a list of all extensions in use

Returns a list of all extensions in use

Returns

Array
public
# setKeyIdentifier( String $value )

Sets the authority key identifier

Sets the authority key identifier

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

Parameters

$value
String
$value
public Array
# _formatSubjectPublicKey( )

Format a public key as appropriate

Format a public key as appropriate

Returns

Array
public Array
# setDomain( )

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

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

Returns

Array

Magic methods summary

Properties summary

public Array $Certificate
#

ASN.1 syntax for X.509 certificates

ASN.1 syntax for X.509 certificates

public mixed $KeyUsage
#

ASN.1 syntax for various extensions

ASN.1 syntax for various extensions

public mixed $ExtKeyUsageSyntax
#
public mixed $BasicConstraints
#
public mixed $KeyIdentifier
#
public mixed $CRLDistributionPoints
#
public mixed $AuthorityKeyIdentifier
#
public mixed $CertificatePolicies
#
public mixed $AuthorityInfoAccessSyntax
#
public mixed $SubjectAltName
#
public mixed $PrivateKeyUsagePeriod
#
public mixed $IssuerAltName
#
public mixed $PolicyMappings
#
public mixed $NameConstraints
#
public mixed $CPSuri
#
public mixed $UserNotice
#
public mixed $netscape_cert_type
#
public mixed $netscape_comment
#
public Array $CertificationRequest
#

ASN.1 syntax for Certificate Signing Requests (RFC2986)

ASN.1 syntax for Certificate Signing Requests (RFC2986)

public Array $dn
#

Distinguished Name

Distinguished Name

public String $publicKey
#

Public key

Public key

public String $privateKey
#

Private key

Private key

public Array $oids
#

Object identifiers for X.509 certificates

Object identifiers for X.509 certificates

Link

http://en.wikipedia.org/wiki/Object_identifier
public Array $CAs
#

The certificate authorities

The certificate authorities

public Array $currentCert
#

The currently loaded certificate

The currently loaded certificate

public String $signatureSubject
#

The signature subject

The signature subject

There's no guarantee File_X509 is going to reencode 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.

public String $startDate
#

Certificate Start Date

Certificate Start Date

public String $endDate
#

Certificate End Date

Certificate End Date

public String $serialNumber
#

Serial Number

Serial Number

public String $keyIdentifier
#

Key Identifier

Key Identifier

See RFC5280#section-4.2.1.1 and RFC5280#section-4.2.1.2.

public Boolean $caFlag
#

CA Flag

CA Flag

Blesta API documentation generated by ApiGen 2.8.0