From 89b861119b5503274414d83814c43e4ac577d88c Mon Sep 17 00:00:00 2001 From: pero1203 Date: Wed, 5 May 2021 10:54:27 +0200 Subject: [PATCH] Premaknjena koda za squalo iz modulov v classes --- .../surveyEmails/squalo}/api_test.php | 6 +- .../surveyEmails/squalo}/class.SqualoApi.php | 0 .../squalo}/class.SurveyInvitationsSqualo.php | 2 +- composer.lock | 32 ++-- vendor/composer/autoload_classmap.php | 4 +- vendor/composer/autoload_static.php | 4 +- vendor/composer/installed.json | 146 +++++++++--------- vendor/fgrosse/phpasn1/CHANGELOG.md | 4 + vendor/fgrosse/phpasn1/lib/ASN1/OID.php | 1 + vendor/fgrosse/phpasn1/lib/X509/CSR/CSR.php | 26 +++- 10 files changed, 126 insertions(+), 99 deletions(-) rename admin/survey/{modules/mod_squalo => classes/surveyEmails/squalo}/api_test.php (93%) rename admin/survey/{modules/mod_squalo => classes/surveyEmails/squalo}/class.SqualoApi.php (100%) rename admin/survey/{modules/mod_squalo => classes/surveyEmails/squalo}/class.SurveyInvitationsSqualo.php (99%) diff --git a/admin/survey/modules/mod_squalo/api_test.php b/admin/survey/classes/surveyEmails/squalo/api_test.php similarity index 93% rename from admin/survey/modules/mod_squalo/api_test.php rename to admin/survey/classes/surveyEmails/squalo/api_test.php index af24e5c13..52fcec065 100644 --- a/admin/survey/modules/mod_squalo/api_test.php +++ b/admin/survey/classes/surveyEmails/squalo/api_test.php @@ -10,9 +10,9 @@ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); -include_once '../../definition.php'; -include_once '../../../../function.php'; -include_once '../../../../vendor/autoload.php'; +include_once '../../../definition.php'; +include_once '../../../../../function.php'; +include_once '../../../../../vendor/autoload.php'; diff --git a/admin/survey/modules/mod_squalo/class.SqualoApi.php b/admin/survey/classes/surveyEmails/squalo/class.SqualoApi.php similarity index 100% rename from admin/survey/modules/mod_squalo/class.SqualoApi.php rename to admin/survey/classes/surveyEmails/squalo/class.SqualoApi.php diff --git a/admin/survey/modules/mod_squalo/class.SurveyInvitationsSqualo.php b/admin/survey/classes/surveyEmails/squalo/class.SurveyInvitationsSqualo.php similarity index 99% rename from admin/survey/modules/mod_squalo/class.SurveyInvitationsSqualo.php rename to admin/survey/classes/surveyEmails/squalo/class.SurveyInvitationsSqualo.php index d6638b008..38a887753 100644 --- a/admin/survey/modules/mod_squalo/class.SurveyInvitationsSqualo.php +++ b/admin/survey/classes/surveyEmails/squalo/class.SurveyInvitationsSqualo.php @@ -40,7 +40,7 @@ class SurveyInvitationsSqualo { global $admin_type; global $squalo_user; global $squalo_key; - + return true; // Zaenkrat imajo squalo samo admini if($admin_type != 0) return false; diff --git a/composer.lock b/composer.lock index 44d5aa3ba..6d41f275d 100644 --- a/composer.lock +++ b/composer.lock @@ -66,16 +66,16 @@ }, { "name": "fgrosse/phpasn1", - "version": "v2.2.0", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/fgrosse/PHPASN1.git", - "reference": "d1978f7abd580f3fc33561e7f71d4c12c7531fad" + "reference": "20299033c35f4300eb656e7e8e88cf52d1d6694e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fgrosse/PHPASN1/zipball/d1978f7abd580f3fc33561e7f71d4c12c7531fad", - "reference": "d1978f7abd580f3fc33561e7f71d4c12c7531fad", + "url": "https://api.github.com/repos/fgrosse/PHPASN1/zipball/20299033c35f4300eb656e7e8e88cf52d1d6694e", + "reference": "20299033c35f4300eb656e7e8e88cf52d1d6694e", "shasum": "" }, "require": { @@ -133,7 +133,7 @@ "x509", "x690" ], - "time": "2020-10-11 16:28:18" + "time": "2021-04-24 19:01:55" }, { "name": "geoip2/geoip2", @@ -2085,16 +2085,16 @@ }, { "name": "psr/log", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { @@ -2118,7 +2118,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -2128,7 +2128,7 @@ "psr", "psr-3" ], - "time": "2020-03-23 09:12:05" + "time": "2021-05-03 11:20:27" }, { "name": "symfony/polyfill-mbstring", @@ -2261,16 +2261,16 @@ }, { "name": "symfony/var-dumper", - "version": "v4.4.21", + "version": "v4.4.22", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "0da0e174f728996f5d5072d6a9f0a42259dbc806" + "reference": "c194bcedde6295f3ec3e9eba1f5d484ea97c41a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0da0e174f728996f5d5072d6a9f0a42259dbc806", - "reference": "0da0e174f728996f5d5072d6a9f0a42259dbc806", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/c194bcedde6295f3ec3e9eba1f5d484ea97c41a7", + "reference": "c194bcedde6295f3ec3e9eba1f5d484ea97c41a7", "shasum": "" }, "require": { @@ -2329,7 +2329,7 @@ "debug", "dump" ], - "time": "2021-03-27 19:49:03" + "time": "2021-04-19 13:36:17" } ], "aliases": [], diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 32cab0dd9..efc88386d 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -684,7 +684,7 @@ return array( 'Sonata\\GoogleAuthenticator\\GoogleQrUrl' => $vendorDir . '/sonata-project/google-authenticator/src/GoogleQrUrl.php', 'Sonata\\GoogleAuthenticator\\RuntimeException' => $vendorDir . '/sonata-project/google-authenticator/src/RuntimeException.php', 'SpremenljivkaSkala' => $baseDir . '/admin/survey/classes/objects/obj.SpremenljivkaSkala.php', - 'SqualoApi' => $baseDir . '/admin/survey/modules/mod_squalo/class.SqualoApi.php', + 'SqualoApi' => $baseDir . '/admin/survey/classes/surveyEmails/squalo/class.SqualoApi.php', 'SteviloLatex' => $baseDir . '/admin/survey/export/latexclasses/Vprasanja/SteviloLatex.php', 'SteviloXml' => $baseDir . '/admin/survey/export/xmlClasses/Vprasanja/SteviloXml.php', 'Stripe\\Account' => $vendorDir . '/stripe/stripe-php/lib/Account.php', @@ -948,7 +948,7 @@ return array( 'SurveyInfo' => $baseDir . '/admin/survey/classes/class.SurveyInfo.php', 'SurveyInspect' => $baseDir . '/admin/survey/classes/class.SurveyInpect.php', 'SurveyInvitationsNew' => $baseDir . '/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php', - 'SurveyInvitationsSqualo' => $baseDir . '/admin/survey/modules/mod_squalo/class.SurveyInvitationsSqualo.php', + 'SurveyInvitationsSqualo' => $baseDir . '/admin/survey/classes/surveyEmails/squalo/class.SurveyInvitationsSqualo.php', 'SurveyJsonSurveyData' => $baseDir . '/admin/survey/modules/mod_json_survey_export/class.SurveyJsonSurveyData.php', 'SurveyKakovost' => $baseDir . '/admin/survey/modules/mod_kakovost/class.SurveyKakovost.php', 'SurveyLanguageTechnology' => $baseDir . '/admin/survey/classes/class.SurveyLanguageTechnology.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index a2d963843..9b4ee9136 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -888,7 +888,7 @@ class ComposerStaticInit6b03163c371c5541881b55b762b8c779 'Sonata\\GoogleAuthenticator\\GoogleQrUrl' => __DIR__ . '/..' . '/sonata-project/google-authenticator/src/GoogleQrUrl.php', 'Sonata\\GoogleAuthenticator\\RuntimeException' => __DIR__ . '/..' . '/sonata-project/google-authenticator/src/RuntimeException.php', 'SpremenljivkaSkala' => __DIR__ . '/../..' . '/admin/survey/classes/objects/obj.SpremenljivkaSkala.php', - 'SqualoApi' => __DIR__ . '/../..' . '/admin/survey/modules/mod_squalo/class.SqualoApi.php', + 'SqualoApi' => __DIR__ . '/../..' . '/admin/survey/classes/surveyEmails/squalo/class.SqualoApi.php', 'SteviloLatex' => __DIR__ . '/../..' . '/admin/survey/export/latexclasses/Vprasanja/SteviloLatex.php', 'SteviloXml' => __DIR__ . '/../..' . '/admin/survey/export/xmlClasses/Vprasanja/SteviloXml.php', 'Stripe\\Account' => __DIR__ . '/..' . '/stripe/stripe-php/lib/Account.php', @@ -1152,7 +1152,7 @@ class ComposerStaticInit6b03163c371c5541881b55b762b8c779 'SurveyInfo' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyInfo.php', 'SurveyInspect' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyInpect.php', 'SurveyInvitationsNew' => __DIR__ . '/../..' . '/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php', - 'SurveyInvitationsSqualo' => __DIR__ . '/../..' . '/admin/survey/modules/mod_squalo/class.SurveyInvitationsSqualo.php', + 'SurveyInvitationsSqualo' => __DIR__ . '/../..' . '/admin/survey/classes/surveyEmails/squalo/class.SurveyInvitationsSqualo.php', 'SurveyJsonSurveyData' => __DIR__ . '/../..' . '/admin/survey/modules/mod_json_survey_export/class.SurveyJsonSurveyData.php', 'SurveyKakovost' => __DIR__ . '/../..' . '/admin/survey/modules/mod_kakovost/class.SurveyKakovost.php', 'SurveyLanguageTechnology' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyLanguageTechnology.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 699855b1f..6a4d8008f 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -182,79 +182,6 @@ "url" ] }, - { - "name": "fgrosse/phpasn1", - "version": "v2.2.0", - "version_normalized": "2.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/fgrosse/PHPASN1.git", - "reference": "d1978f7abd580f3fc33561e7f71d4c12c7531fad" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fgrosse/PHPASN1/zipball/d1978f7abd580f3fc33561e7f71d4c12c7531fad", - "reference": "d1978f7abd580f3fc33561e7f71d4c12c7531fad", - "shasum": "" - }, - "require": { - "php": ">=7.0.0" - }, - "require-dev": { - "phpunit/phpunit": "~6.3", - "satooshi/php-coveralls": "~2.0" - }, - "suggest": { - "ext-bcmath": "BCmath is the fallback extension for big integer calculations", - "ext-curl": "For loading OID information from the web if they have not bee defined statically", - "ext-gmp": "GMP is the preferred extension for big integer calculations", - "phpseclib/bcmath_compat": "BCmath polyfill for servers where neither GMP nor BCmath is available" - }, - "time": "2020-10-11 16:28:18", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "FG\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Friedrich Große", - "email": "friedrich.grosse@gmail.com", - "homepage": "https://github.com/FGrosse", - "role": "Author" - }, - { - "name": "All contributors", - "homepage": "https://github.com/FGrosse/PHPASN1/contributors" - } - ], - "description": "A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.", - "homepage": "https://github.com/FGrosse/PHPASN1", - "keywords": [ - "DER", - "asn.1", - "asn1", - "ber", - "binary", - "decoding", - "encoding", - "x.509", - "x.690", - "x509", - "x690" - ] - }, { "name": "web-token/jwt-core", "version": "v1.3.10", @@ -1961,5 +1888,78 @@ "uri", "url" ] + }, + { + "name": "fgrosse/phpasn1", + "version": "v2.3.0", + "version_normalized": "2.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/fgrosse/PHPASN1.git", + "reference": "20299033c35f4300eb656e7e8e88cf52d1d6694e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fgrosse/PHPASN1/zipball/20299033c35f4300eb656e7e8e88cf52d1d6694e", + "reference": "20299033c35f4300eb656e7e8e88cf52d1d6694e", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.3", + "satooshi/php-coveralls": "~2.0" + }, + "suggest": { + "ext-bcmath": "BCmath is the fallback extension for big integer calculations", + "ext-curl": "For loading OID information from the web if they have not bee defined statically", + "ext-gmp": "GMP is the preferred extension for big integer calculations", + "phpseclib/bcmath_compat": "BCmath polyfill for servers where neither GMP nor BCmath is available" + }, + "time": "2021-04-24 19:01:55", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "FG\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Friedrich Große", + "email": "friedrich.grosse@gmail.com", + "homepage": "https://github.com/FGrosse", + "role": "Author" + }, + { + "name": "All contributors", + "homepage": "https://github.com/FGrosse/PHPASN1/contributors" + } + ], + "description": "A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.", + "homepage": "https://github.com/FGrosse/PHPASN1", + "keywords": [ + "DER", + "asn.1", + "asn1", + "ber", + "binary", + "decoding", + "encoding", + "x.509", + "x.690", + "x509", + "x690" + ] } ] diff --git a/vendor/fgrosse/phpasn1/CHANGELOG.md b/vendor/fgrosse/phpasn1/CHANGELOG.md index 25426e4c4..5a5f5caee 100644 --- a/vendor/fgrosse/phpasn1/CHANGELOG.md +++ b/vendor/fgrosse/phpasn1/CHANGELOG.md @@ -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 diff --git a/vendor/fgrosse/phpasn1/lib/ASN1/OID.php b/vendor/fgrosse/phpasn1/lib/ASN1/OID.php index 61ab01e15..7d331b0a7 100644 --- a/vendor/fgrosse/phpasn1/lib/ASN1/OID.php +++ b/vendor/fgrosse/phpasn1/lib/ASN1/OID.php @@ -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'; diff --git a/vendor/fgrosse/phpasn1/lib/X509/CSR/CSR.php b/vendor/fgrosse/phpasn1/lib/X509/CSR/CSR.php index 69decdbb5..8f2a31970 100644 --- a/vendor/fgrosse/phpasn1/lib/X509/CSR/CSR.php +++ b/vendor/fgrosse/phpasn1/lib/X509/CSR/CSR.php @@ -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());