Skip to content

Commit 8098735

Browse files
authored
Added support for DNS Names (domain names) longer than 64 characters
2 parents 69d9a52 + b6fa5f1 commit 8098735

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ACMECert
22

33
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.
4-
Version: 3.3.0
4+
Version: 3.3.1
55

66
## Description
77

@@ -613,7 +613,7 @@ public string ACMECert::getCertificateChain ( mixed $pem, array $domain_config,
613613
>
614614
> An Array defining the domains and the corresponding challenge types to get a certificate for.
615615
>
616-
> The first one is used as `Common Name` for the certificate.
616+
> 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.
617617
>
618618
> Here is an example structure:
619619
> ```php

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "skoerfgen/acmecert",
3-
"version": "3.3.0",
3+
"version": "3.3.1",
44
"description": "PHP client library for Let's Encrypt and other ACME v2 - RFC 8555 compatible Certificate Authorities",
55
"license": "MIT",
66
"authors": [

src/ACMECert.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,11 @@ public function generateCSR($domain_key_pem,$domains){
333333
}
334334

335335
$fn=$this->tmp_ssl_cnf($domains);
336-
$dn=array('commonName'=>reset($domains));
336+
$cn=reset($domains);
337+
$dn=array();
338+
if (strlen($cn)<=64){
339+
$dn['commonName']=$cn;
340+
}
337341
$csr=openssl_csr_new($dn,$domain_key,array(
338342
'config'=>$fn,
339343
'req_extensions'=>'SAN',

src/ACMEv2.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ private function http_request($url,$data=null){
309309
}
310310

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

0 commit comments

Comments
 (0)