phpseclib: X.509 Examples

Action:

Method:

<?php
include('File/X509.php');

$x509 = new File_X509();
$cert = $x509->loadX509('...'); // see google.crt

print_r($cert);
?>

Output:

(see phpseclib: X.509: Decoder to try phpseclib's X.509 decoder with your own certificates)

$cert:
  • tbsCertificate
    • version
      • v3
    • serialNumber
      • 105827261859531100510423749949966875981
    • signature
      • algorithm
        • sha1WithRSAEncryption
      • parameters
        • null
    • issuer
      • rdnSequence
        • 0
          • 0
            • type
              • id-at-countryName
            • value
              • printableString
                • ZA
        • 1
          • 0
            • type
              • id-at-organizationName
            • value
              • printableString
                • Thawte Consulting (Pty) Ltd.
        • 2
          • 0
            • type
              • id-at-commonName
            • value
              • printableString
                • Thawte SGC CA
    • validity
      • notBefore
        • utcTime
          • Wed, 26 Oct 11 00:00:00 +0000
      • notAfter
        • utcTime
          • Mon, 30 Sep 13 23:59:59 +0000
    • subject
      • rdnSequence
        • 0
          • 0
            • type
              • id-at-countryName
            • value
              • printableString
                • US
        • 1
          • 0
            • type
              • id-at-stateOrProvinceName
            • value
              • printableString
                • California
        • 2
          • 0
            • type
              • id-at-localityName
            • value
              • teletexString
                • Mountain View
        • 3
          • 0
            • type
              • id-at-organizationName
            • value
              • teletexString
                • Google Inc
        • 4
          • 0
            • type
              • id-at-commonName
            • value
              • teletexString
                • www.google.com
    • subjectPublicKeyInfo
      • algorithm
        • algorithm
          • rsaEncryption
        • parameters
          • null
      • subjectPublicKey
        • -----BEGIN PUBLIC KEY-----
          MIGJAoGBAN63JkOmmYXNOKcVCbnPD8nDVYyI7oyNKCckSypeoNgW+mEYS89tYIDTNUAycsCPEtjl
          To+5svbZFV5ahjGjuoaqa8jZcYzMzScTHp1CXTj2p6zv+mLzGIHUJEZ/AXd8xiqJFJm7mDkdqBn7
          OQBEfRuUangtaa3Aeiz60NogEpjTAgMBAAE=
          -----END PUBLIC KEY-----
    • extensions
      • 0
        • extnId
          • id-ce-basicConstraints
        • critical
          • 1
        • extnValue
        • 1
          • extnId
            • id-ce-cRLDistributionPoints
          • critical
          • extnValue
            • 0
              • distributionPoint
                • fullName
                  • 0
                    • uniformResourceIdentifier
                      • http://crl.thawte.com/ThawteSGCCA.crl
        • 2
          • extnId
            • id-ce-extKeyUsage
          • critical
          • extnValue
            • 0
              • id-kp-serverAuth
            • 1
              • id-kp-clientAuth
            • 2
              • 2.16.840.1.113730.4.1
        • 3
          • extnId
            • id-pe-authorityInfoAccess
          • critical
          • extnValue
            • 0
              • accessMethod
                • id-ad-ocsp
              • accessLocation
                • uniformResourceIdentifier
                  • http://ocsp.thawte.com
            • 1
              • accessMethod
                • id-ad-caIssuers
              • accessLocation
                • uniformResourceIdentifier
                  • http://www.thawte.com/repository/Thawte_SGC_CA.crt
    • signatureAlgorithm
      • algorithm
        • sha1WithRSAEncryption
      • parameters
        • null
    • signature
      • ACGs1a7KNIlawqtS0rI0Zp16q+7mfNV+wlwou3QAyRAfQhP8aYoeJKACAOm6W8oZBLLTrwGyfl8U26bbUrma8xJ/fKKcO2+ZfepQDXYjEv/3ZnMpt5UKrdiLst4g6QpwZBEIyFrxfZ7saaWl1YLXJx6eVs3SdtV5K/clQxxp8Lj5
    Which version of phpseclib are you using?