Giter VIP home page Giter VIP logo

self-signed-certs's Introduction

self-signed-certs

PHP library for creating self-signed certificates. No dependencies.

Installation

composer require sashabo/self-signed-certs

Usage

<?php

use SashaBo\SelfSignedCerts\CertificateGenerator;

$generator = new CertificateGenerator();
$generator
    ->setName('Some Name')
    ->setEmail('[email protected]')
    ->setAddress('CC', 'State or province', 'City')
    ->setOrganization('Organization', 'Department')
;

$pair = $generator->generate();
$pair->save('/etc/nginx/ssl/my.key', '/etc/nginx/ssl/my.crt');

CertificateGenerator methods:

generate(): CertificatePair

These settings are not necessary, you may use defaults in most cases:

setExpireDays(int $days): static - 3650 by default

setPrivateKeyBits(int $bits): static - 4096 by default

setPrivateKeyType(int $type): static - OPENSSL_KEYTYPE_RSA by default

setDigestAlgorithm(string $algorithm): static - AES-128-CBC by default

setOpenSslConfPath(string $path): static - /etc/ssl/openssl.cnf by default (standard path for Ubuntu and most of linuxes)

These settings override openssl.cnf settings:

setName(string $name): static

setEmail(string $email): static

setAddress(string $countryCode, string $stateOrProvince, string $city): static

setOrganization(string $name, string $unit): static

CertificatePair methods:

getPrivateKey(): \OpenSSLAsymmetricKey

getCertificate(): \OpenSSLCertificate

exportPrivateKey(?string $passPhrase = null): string

exportCertificate(): string

save(string $privateKeyPath, string $certPath, ?string $passPhrase = null): void

self-signed-certs's People

Contributors

xbndrv avatar sasha-bo avatar

Stargazers

Eduardo Gusmão avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.