All Projects â†’ spatie â†’ Ssl Certificate

spatie / Ssl Certificate

Licence: mit
A class to validate SSL certificates

Projects that are alternatives of or similar to Ssl Certificate

Ssl Proxy
🔒 Simple zero-config SSL reverse proxy with real autogenerated certificates (LetsEncrypt, self-signed, provided)
Stars: ✭ 427 (-18.2%)
Mutual labels:  ssl, letsencrypt, certificate
Acmetool
🔒 acmetool, an automatic certificate acquisition tool for ACME (Let's Encrypt)
Stars: ✭ 1,882 (+260.54%)
Mutual labels:  ssl, letsencrypt, certificate
Acme client
Java ACME Client application
Stars: ✭ 77 (-85.25%)
Mutual labels:  ssl, letsencrypt, certificate
Acme Nginx
python acme client for nginx
Stars: ✭ 248 (-52.49%)
Mutual labels:  ssl, letsencrypt, certificate
Ansible Role Certbot
Ansible Role - Certbot (for Let's Encrypt)
Stars: ✭ 477 (-8.62%)
Mutual labels:  ssl, letsencrypt, certificate
letsencrypt-www
Probably the easiest way to create | renew | deploy certificate
Stars: ✭ 27 (-94.83%)
Mutual labels:  letsencrypt, ssl, certificate
Certificaat
General-purpose ACME client
Stars: ✭ 88 (-83.14%)
Mutual labels:  ssl, letsencrypt, certificate
qiniu-auto-cert
侃牛 CDN èŻäčŠè‡ȘćŠšćŒ–ć·„ć…·
Stars: ✭ 20 (-96.17%)
Mutual labels:  letsencrypt, ssl, certificate
acme2
Another PHP client for acme protocal (version 2) implementation, used for generating letsencrypt's free ssl certificates.
Stars: ✭ 45 (-91.38%)
Mutual labels:  letsencrypt, ssl, certificate
freshcerts
ACME certificate protocol (Let's Encrypt) proxy client with a dashboard and monitoring
Stars: ✭ 59 (-88.7%)
Mutual labels:  letsencrypt, ssl, certificate
ACMECert
PHP client library for Let's Encrypt (ACME v2 - RFC 8555)
Stars: ✭ 83 (-84.1%)
Mutual labels:  letsencrypt, ssl, certificate
Telegraph
Secure Web Server for iOS, tvOS and macOS
Stars: ✭ 474 (-9.2%)
Mutual labels:  ssl, certificate
Docker Nginx Auto Ssl
Docker image for automatic generation of SSL certs using Let's encrypt and Open Resty
Stars: ✭ 282 (-45.98%)
Mutual labels:  ssl, letsencrypt
Ssl Certificate Chain Resolver
SSL certificate chain resolver
Stars: ✭ 277 (-46.93%)
Mutual labels:  ssl, certificate
Dnsrobocert
Orchestrate Certbot and Lexicon together to provide Let's Encrypt TLS certificates validated by DNS challenges
Stars: ✭ 420 (-19.54%)
Mutual labels:  ssl, letsencrypt
Acme Client Quick
get let's encrypt cert in five minutes
Stars: ✭ 295 (-43.49%)
Mutual labels:  letsencrypt, certificate
Lego
Let's Encrypt client and ACME library written in Go
Stars: ✭ 4,978 (+853.64%)
Mutual labels:  letsencrypt, certificate
Rancher Letsencrypt
🐼 Rancher service that obtains and manages free SSL certificates from the Let's Encrypt CA
Stars: ✭ 318 (-39.08%)
Mutual labels:  letsencrypt, certificate
Acme Client
Let's Encrypt / ACME client written in PHP for the CLI.
Stars: ✭ 337 (-35.44%)
Mutual labels:  ssl, letsencrypt
Crypt Le
Crypt::LE - Let's Encrypt / Buypass / ACME client and library in Perl for obtaining free SSL certificates (inc. generating RSA/ECC keys and CSRs). HTTP/DNS verification is supported out of the box, easily extended with plugins, easily dockerized.
Stars: ✭ 277 (-46.93%)
Mutual labels:  ssl, certificate

A class to validate SSL certificates

Latest Version on Packagist MIT Licensed GitHub Workflow Status Quality Score Total Downloads

The class provided by this package makes it incredibly easy to query the properties on an ssl certificate. We have three options for fetching a certficate. Here's an example:

use Spatie\SslCertificate\SslCertificate;

// fetch the certificate using an url
$certificate = SslCertificate::createForHostName('spatie.be');

// or from a certificate file
$certificate = SslCertificate::createFromFile($pathToCertificateFile);

// or from a string
$certificate = SslCertificate::createFromString($certificateData);

$certificate->getIssuer(); // returns "Let's Encrypt Authority X3"
$certificate->isValid(); // returns true if the certificate is currently valid
$certificate->validFromDate(); // returns a Carbon instance Carbon
$certificate->expirationDate(); // returns a Carbon instance Carbon
$certificate->lifespanInDays(); // return the amount of days between  validFromDate and expirationDate
$certificate->expirationDate()->diffInDays(); // returns an int
$certificate->getSignatureAlgorithm(); // returns a string
$certificate->getOrganization(); // returns the organization name when available

Downloading invalid certificate

If you want to download certificates even if they are invalid (for example, if they are expired), you can pass a $verifyCertificate boolean to SslCertificate::createFromHostname() as the third argument, for example:

$certificate = SslCertificate::createForHostName('expired.badssl.com', $timeoutInSeconds, false);

About us

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

composer require spatie/ssl-certificate

Important notice

Currently this package does not check if the certificate is signed by a trusted authority. We'll add this check soon in a next point release.

Usage

You can create an instance of Spatie\SslCertificate\SslCertificate with this named constructor:

$certificate = SslCertificate::createForHostName('spatie.be');

You can use this fluent style to specify a specific port to connect to.

SslCertificate::download()
   ->usingPort($customPort)
   ->forHost($hostName);

You can check the certificate on a different IP address using the same style.

SslCertificate::download()
   ->fromIpAddress($ipAddress)
   ->forHost($hostName);

You can specify socket context options.

SslCertificate::download()
   ->withSocketContextOptions([
      'option' => 'value',
   ])
   ->forHost($hostName);

If the given ipAddress is invalid Spatie\SslCertificate\Exceptions\InvalidIpAddress will be thrown.

If the given hostName is invalid Spatie\SslCertificate\Exceptions\InvalidUrl will be thrown.

If the given hostName is valid but there was a problem downloading the certifcate Spatie\SslCertificate\Exceptions\CouldNotDownloadCertificate will be thrown.

Getting the issuer name

$certificate->getIssuer(); // returns "Let's Encrypt Authority X3"

Getting the domain name

Returns the primary domain name for the certificate

$certificate->getDomain(); // returns "spatie.be"

Getting the certificate's signing algorithm

Returns the algorithm used for signing the certificate

$certificate->getSignatureAlgorithm(); // returns "RSA-SHA256"

Getting the certificate's organization

Returns the organization belonging to the certificate

$certificate->getOrganization(); // returns "Spatie BVBA"

Getting the additional domain names

A certificate can cover multiple (sub)domains. Here's how to get them.

$certificate->getAdditionalDomains(); // returns ["spatie.be", "www.spatie.be]

A domain name return with this method can start with * meaning it is valid for all subdomains of that domain.

Getting the fingerprint

$certificate->getFingerprint(); // returns a fingerprint for the certificate

Getting the SHA256 fingerprint

$certificate->getFingerprintSha256(); // returns a SHA256 fingerprint for the certificate

Getting the date when the certificate becomes valid

$certificate->validFromDate(); // returns an instance of Carbon

Getting the expiration date

$certificate->expirationDate(); // returns an instance of Carbon

Determining if the certificate is still valid

Returns true if the current Date and time is between validFromDate and expirationDate.

$certificate->isValid(); // returns a boolean

You also use this method to determine if a given domain is covered by the certificate. Of course it'll keep checking if the current Date and time is between validFromDate and expirationDate.

$certificate->isValid('spatie.be'); // returns true;
$certificate->isValid('laravel.com'); // returns false;

Determining if the certificate is still valid until a given date

Returns true if the certificate is valid and if the expirationDate is after the given date.

$certificate->isValidUntil(Carbon::now()->addDays(7)); // returns a boolean

Determining if the certificate is expired

$certificate->isExpired(); // returns a boolean if expired

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Postcardware

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

We publish all received postcards on our company website.

Credits

The helper functions and tests were copied from the Laravel Framework.

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].