Skip to content

Commit

Permalink
Added support for DNS Names (domain names) longer than 64 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
skoerfgen authored Nov 23, 2023
2 parents 69d9a52 + b6fa5f1 commit 8098735
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ACMECert

PHP client library for [Let's Encrypt](https://letsencrypt.org/) and other [ACME v2 - RFC 8555](https://tools.ietf.org/html/rfc8555) compatible Certificate Authorities.
Version: 3.3.0
Version: 3.3.1

## Description

Expand Down Expand Up @@ -613,7 +613,7 @@ public string ACMECert::getCertificateChain ( mixed $pem, array $domain_config,
>
> An Array defining the domains and the corresponding challenge types to get a certificate for.
>
> The first one is used as `Common Name` for the certificate.
> The first domain name in the array is used as `Common Name` for the certificate if it does not exceed 64 characters, otherwise the `Common Name` field will be empty.
>
> Here is an example structure:
> ```php
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "skoerfgen/acmecert",
"version": "3.3.0",
"version": "3.3.1",
"description": "PHP client library for Let's Encrypt and other ACME v2 - RFC 8555 compatible Certificate Authorities",
"license": "MIT",
"authors": [
Expand Down
6 changes: 5 additions & 1 deletion src/ACMECert.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,11 @@ public function generateCSR($domain_key_pem,$domains){
}

$fn=$this->tmp_ssl_cnf($domains);
$dn=array('commonName'=>reset($domains));
$cn=reset($domains);
$dn=array();
if (strlen($cn)<=64){
$dn['commonName']=$cn;
}
$csr=openssl_csr_new($dn,$domain_key,array(
'config'=>$fn,
'req_extensions'=>'SAN',
Expand Down
2 changes: 1 addition & 1 deletion src/ACMEv2.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ private function http_request($url,$data=null){
}

$method=$data===false?'HEAD':($data===null?'GET':'POST');
$user_agent='ACMECert v3.3.0 (+https://github.com/skoerfgen/ACMECert)';
$user_agent='ACMECert v3.3.1 (+https://github.com/skoerfgen/ACMECert)';
$header=($data===null||$data===false)?array():array('Content-Type: application/jose+json');
if ($this->ch) {
$headers=array();
Expand Down

0 comments on commit 8098735

Please sign in to comment.