fkooman/cert-parser

Simple OpenSSL based X.509 certificate parser

This package's canonical repository appears to be gone and the package has been frozen as a result.

1.0.0 2015-07-08 10:37 UTC

This package is not auto-updated.

Last update: 2023-03-13 01:52:36 UTC


README

Build Status Scrutinizer Code Quality

Introduction

This library enables you to parse X.509 certificates in order to be able to extract some attributes from it and calculate the fingerprint.

API

For example, to obtain the certificate expiry date from a certificate loaded from a file:

<?php

use fkooman\X509\CertParser;

$certParser = CertParser::fromPemFile('certificate.crt');
echo date('r', $cp->getNotValidAfter()) . PHP_EOL;

All API calls:

public static function fromEncodedDer($encodedDerCert)
public static function fromEncodedDerFile($filePath)
public static function fromPem($pemCert)
public static function fromPemFile($filePath)
public static function fromDer($derCert)
public static function fromDerFile($filePath)
public function getFingerprint($alg = 'sha256')
public function getName()
public function getNotValidBefore()
public function getNotValidAfter()
public function getIssuer()
public function getSubject()

License

Licensed under the Apache License, Version 2.0;

http://www.apache.org/licenses/LICENSE-2.0