2017 © Pedro Peláez
 

library ca-config

Default configuration for certificate authorities

image

totten/ca-config

Default configuration for certificate authorities

  • Wednesday, May 10, 2017
  • by totten
  • Repository
  • 1 Watchers
  • 0 Stars
  • 45,854 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 8 % Grown

The README.md

CA_Config is a small PHP library for determining a default certificate-authority configuration for use by PHP's HTTP/SSL clients., (*1)

Examples

<?php

// For CURL
$caConfig = CA_Config_Curl::singleton();
if ($caConfig->isEnableSSL()) {
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, );
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt_array($ch, $caConfig->toCurlOptions());
  $response = curl_exec($ch);
} else {
  printf("This system does not support SSL.");
} 


// For PHP Streams
$caConfig = CA_Config_Stream::singleton();
if ($caConfig->isEnableSSL()) {
  $context = stream_context_create(array(
    'ssl' => $caConfig->toStreamOptions(),
  ));
  $data = file_get_contents('https://example.com/', 0, $context);
} else {
  printf("This system does not support SSL.");
}

Helpers

When requesting an instance, one can use either singleton() or probe(). singleton() is intended for modest apps that don't have a service container. singleton() is just a wrapper for probe() which reads extra configuration options from a global variable and returns a single instance., (*2)

Testing

This has not been tested on a broad range of configurations, and the underlying problem is that CA configurations are not well-standardized in different PHP environments. To determine if this produces a valid configuration in your environment, run the phpunit test suite., (*3)

If you encounter problems, feel free to submit a patch or to report the problem., (*4)

The Versions

10/05 2017

dev-master

9999999-dev https://github.com/totten/ca_config

Default configuration for certificate authorities

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.2

 

by Tim Otten

10/05 2017

v17.05.0

17.05.0.0 https://github.com/totten/ca_config

Default configuration for certificate authorities

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.2

 

by Tim Otten

13/02 2013

v13.02.0

13.02.0.0 https://github.com/totten/ca_config

Default configuration for certificate authorities

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.2

 

by Tim Otten