updated composer

This commit is contained in:
2021-05-18 13:47:03 +00:00
parent e248cd036c
commit ba92152daa
1187 changed files with 20804 additions and 22320 deletions

View File

@@ -1,3 +1,7 @@
#### v2.3.0 (2021-04)
* Allow creating an unsigned CSR and adding the signature later
https://github.com/fgrosse/PHPASN1/pull/82
#### v2.2.0 (2020-08)
* support polyfills for bcmath and gmp, and add a composer.json
suggestion for the `phpseclib/bcmath_polyfill` for servers unable

View File

@@ -15,6 +15,7 @@ class OID
const RSA_ENCRYPTION = '1.2.840.113549.1.1.1';
const MD5_WITH_RSA_ENCRYPTION = '1.2.840.113549.1.1.4';
const SHA1_WITH_RSA_SIGNATURE = '1.2.840.113549.1.1.5';
const SHA256_WITH_RSA_SIGNATURE = '1.2.840.113549.1.1.11';
const PKCS9_EMAIL = '1.2.840.113549.1.9.1';
const PKCS9_UNSTRUCTURED_NAME = '1.2.840.113549.1.9.2';
const PKCS9_CONTENT_TYPE = '1.2.840.113549.1.9.3';

View File

@@ -41,7 +41,7 @@ class CSR extends Sequence
* @param string $signature
* @param string $signatureAlgorithm
*/
public function __construct($commonName, $email, $organization, $locality, $state, $country, $organizationalUnit, $publicKey, $signature, $signatureAlgorithm = OID::SHA1_WITH_RSA_SIGNATURE)
public function __construct($commonName, $email, $organization, $locality, $state, $country, $organizationalUnit, $publicKey, $signature = null, $signatureAlgorithm = OID::SHA1_WITH_RSA_SIGNATURE)
{
$this->subject = new CertificateSubject(
$commonName,
@@ -56,7 +56,9 @@ class CSR extends Sequence
$this->signature = $signature;
$this->signatureAlgorithm = $signatureAlgorithm;
$this->createCSRSequence();
if (isset($signature)) {
$this->createCSRSequence();
}
}
protected function createCSRSequence()
@@ -68,11 +70,31 @@ class CSR extends Sequence
$certRequestInfo = new Sequence($versionNr, $this->subject, $publicKey);
// Clear the underlying Construct
$this->rewind();
$this->children = [];
$this->addChild($certRequestInfo);
$this->addChild($signatureAlgorithm);
$this->addChild($signature);
}
public function getSignatureSubject()
{
$versionNr = new Integer(self::CSR_VERSION_NR);
$publicKey = new PublicKey($this->publicKey);
$certRequestInfo = new Sequence($versionNr, $this->subject, $publicKey);
return $certRequestInfo->getBinary();
}
public function setSignature($signature, $signatureAlgorithm = OID::SHA1_WITH_RSA_SIGNATURE)
{
$this->signature = $signature;
$this->signatureAlgorithm = $signatureAlgorithm;
$this->createCSRSequence();
}
public function __toString()
{
$tmp = base64_encode($this->getBinary());