定制 alanmburr/self-signed-tls-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alanmburr/self-signed-tls-generator

最新稳定版本:v1.1.2

Composer 安装命令:

composer require alanmburr/self-signed-tls-generator

包简介

Quick & dirty library to generate your own TLS certificates from your CA.

README 文档

README

This library depends on a dev package. You may have to set your "minimim-stability" to "dev" in composer.json.

  1. Install and update Composer dependencies… composer install then composer update

  2. Use…

    1. First, create a DistinguishedName class…
$dn = new DistinguishedName("US", "Virginia", "Richmond", "org", false, "mynewawesometlsdomain.local", false);
  1. Create a new CaInformation class…

    1. Inputs:

      1. Full file path to the CA (the certificate must be in PEM format)

      2. Full file path to the CA key

      3. Password for the CA key (in plaintext, only)

$ca = new CaInformation(__DIR__."/ca.crt", __DIR__."/ca.key", "123abc");
  1. Create a new SelfSignedTlsGenerator class…

    1. Inputs:

      1. DistinguishedName (required)

      2. OpenSSL Configuration (optional)

        1. Leave null or pass in null to use the default config.
      3. Per-domain OpenSSL Configuration (optional)

        1. If left blank, the class will generate a UUID (gen 5) from the Common Name portion of the Distinguished Name.
      4. Vendor OpenSSL Config Filename (optional)

        1. Defaults to VendorConfig.cnf. Pass in a full path if you have a custom config.
$tlsgen = new SelfSignedTlsGenerator($dn);
  1. Run the generateFromDN function of the SelfSignedTlsGenerator class…

    1. Inputs:

      1. CaInformation (required)

      2. Private Key bits (defaults to 2048)

      3. Days valid (defaults to 3650 (10 years), capped at 10 years)

        1. Capped at 10y because some browsers reject certificates that are valid for more than a decade. I haven't encountered this, and it seems like neither have other people, but it's a theoretical limitation to be aware of.
    2. Returns:

      1. An array of strings:

        1. The Private Key for the new certificate

        2. The Certificate contents.

$crt = $tlsgen->generateFromDN($ca);
print_r($crt);

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MPL-2.0
  • 更新时间: 2024-05-04