Premaknjena koda za squalo iz modulov v classes

This commit is contained in:
pero1203 2021-05-05 10:54:27 +02:00
parent e9e30fdbfa
commit 89b861119b
10 changed files with 126 additions and 99 deletions

View File

@ -10,9 +10,9 @@ ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
error_reporting(E_ALL); error_reporting(E_ALL);
include_once '../../definition.php'; include_once '../../../definition.php';
include_once '../../../../function.php'; include_once '../../../../../function.php';
include_once '../../../../vendor/autoload.php'; include_once '../../../../../vendor/autoload.php';

View File

@ -40,7 +40,7 @@ class SurveyInvitationsSqualo {
global $admin_type; global $admin_type;
global $squalo_user; global $squalo_user;
global $squalo_key; global $squalo_key;
return true;
// Zaenkrat imajo squalo samo admini // Zaenkrat imajo squalo samo admini
if($admin_type != 0) if($admin_type != 0)
return false; return false;

32
composer.lock generated
View File

@ -66,16 +66,16 @@
}, },
{ {
"name": "fgrosse/phpasn1", "name": "fgrosse/phpasn1",
"version": "v2.2.0", "version": "v2.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/fgrosse/PHPASN1.git", "url": "https://github.com/fgrosse/PHPASN1.git",
"reference": "d1978f7abd580f3fc33561e7f71d4c12c7531fad" "reference": "20299033c35f4300eb656e7e8e88cf52d1d6694e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/fgrosse/PHPASN1/zipball/d1978f7abd580f3fc33561e7f71d4c12c7531fad", "url": "https://api.github.com/repos/fgrosse/PHPASN1/zipball/20299033c35f4300eb656e7e8e88cf52d1d6694e",
"reference": "d1978f7abd580f3fc33561e7f71d4c12c7531fad", "reference": "20299033c35f4300eb656e7e8e88cf52d1d6694e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -133,7 +133,7 @@
"x509", "x509",
"x690" "x690"
], ],
"time": "2020-10-11 16:28:18" "time": "2021-04-24 19:01:55"
}, },
{ {
"name": "geoip2/geoip2", "name": "geoip2/geoip2",
@ -2085,16 +2085,16 @@
}, },
{ {
"name": "psr/log", "name": "psr/log",
"version": "1.1.3", "version": "1.1.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/log.git", "url": "https://github.com/php-fig/log.git",
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2118,7 +2118,7 @@
"authors": [ "authors": [
{ {
"name": "PHP-FIG", "name": "PHP-FIG",
"homepage": "http://www.php-fig.org/" "homepage": "https://www.php-fig.org/"
} }
], ],
"description": "Common interface for logging libraries", "description": "Common interface for logging libraries",
@ -2128,7 +2128,7 @@
"psr", "psr",
"psr-3" "psr-3"
], ],
"time": "2020-03-23 09:12:05" "time": "2021-05-03 11:20:27"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
@ -2261,16 +2261,16 @@
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v4.4.21", "version": "v4.4.22",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "0da0e174f728996f5d5072d6a9f0a42259dbc806" "reference": "c194bcedde6295f3ec3e9eba1f5d484ea97c41a7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/0da0e174f728996f5d5072d6a9f0a42259dbc806", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/c194bcedde6295f3ec3e9eba1f5d484ea97c41a7",
"reference": "0da0e174f728996f5d5072d6a9f0a42259dbc806", "reference": "c194bcedde6295f3ec3e9eba1f5d484ea97c41a7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2329,7 +2329,7 @@
"debug", "debug",
"dump" "dump"
], ],
"time": "2021-03-27 19:49:03" "time": "2021-04-19 13:36:17"
} }
], ],
"aliases": [], "aliases": [],

View File

@ -684,7 +684,7 @@ return array(
'Sonata\\GoogleAuthenticator\\GoogleQrUrl' => $vendorDir . '/sonata-project/google-authenticator/src/GoogleQrUrl.php', 'Sonata\\GoogleAuthenticator\\GoogleQrUrl' => $vendorDir . '/sonata-project/google-authenticator/src/GoogleQrUrl.php',
'Sonata\\GoogleAuthenticator\\RuntimeException' => $vendorDir . '/sonata-project/google-authenticator/src/RuntimeException.php', 'Sonata\\GoogleAuthenticator\\RuntimeException' => $vendorDir . '/sonata-project/google-authenticator/src/RuntimeException.php',
'SpremenljivkaSkala' => $baseDir . '/admin/survey/classes/objects/obj.SpremenljivkaSkala.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', 'SteviloLatex' => $baseDir . '/admin/survey/export/latexclasses/Vprasanja/SteviloLatex.php',
'SteviloXml' => $baseDir . '/admin/survey/export/xmlClasses/Vprasanja/SteviloXml.php', 'SteviloXml' => $baseDir . '/admin/survey/export/xmlClasses/Vprasanja/SteviloXml.php',
'Stripe\\Account' => $vendorDir . '/stripe/stripe-php/lib/Account.php', 'Stripe\\Account' => $vendorDir . '/stripe/stripe-php/lib/Account.php',
@ -948,7 +948,7 @@ return array(
'SurveyInfo' => $baseDir . '/admin/survey/classes/class.SurveyInfo.php', 'SurveyInfo' => $baseDir . '/admin/survey/classes/class.SurveyInfo.php',
'SurveyInspect' => $baseDir . '/admin/survey/classes/class.SurveyInpect.php', 'SurveyInspect' => $baseDir . '/admin/survey/classes/class.SurveyInpect.php',
'SurveyInvitationsNew' => $baseDir . '/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.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', 'SurveyJsonSurveyData' => $baseDir . '/admin/survey/modules/mod_json_survey_export/class.SurveyJsonSurveyData.php',
'SurveyKakovost' => $baseDir . '/admin/survey/modules/mod_kakovost/class.SurveyKakovost.php', 'SurveyKakovost' => $baseDir . '/admin/survey/modules/mod_kakovost/class.SurveyKakovost.php',
'SurveyLanguageTechnology' => $baseDir . '/admin/survey/classes/class.SurveyLanguageTechnology.php', 'SurveyLanguageTechnology' => $baseDir . '/admin/survey/classes/class.SurveyLanguageTechnology.php',

View File

@ -888,7 +888,7 @@ class ComposerStaticInit6b03163c371c5541881b55b762b8c779
'Sonata\\GoogleAuthenticator\\GoogleQrUrl' => __DIR__ . '/..' . '/sonata-project/google-authenticator/src/GoogleQrUrl.php', 'Sonata\\GoogleAuthenticator\\GoogleQrUrl' => __DIR__ . '/..' . '/sonata-project/google-authenticator/src/GoogleQrUrl.php',
'Sonata\\GoogleAuthenticator\\RuntimeException' => __DIR__ . '/..' . '/sonata-project/google-authenticator/src/RuntimeException.php', 'Sonata\\GoogleAuthenticator\\RuntimeException' => __DIR__ . '/..' . '/sonata-project/google-authenticator/src/RuntimeException.php',
'SpremenljivkaSkala' => __DIR__ . '/../..' . '/admin/survey/classes/objects/obj.SpremenljivkaSkala.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', 'SteviloLatex' => __DIR__ . '/../..' . '/admin/survey/export/latexclasses/Vprasanja/SteviloLatex.php',
'SteviloXml' => __DIR__ . '/../..' . '/admin/survey/export/xmlClasses/Vprasanja/SteviloXml.php', 'SteviloXml' => __DIR__ . '/../..' . '/admin/survey/export/xmlClasses/Vprasanja/SteviloXml.php',
'Stripe\\Account' => __DIR__ . '/..' . '/stripe/stripe-php/lib/Account.php', 'Stripe\\Account' => __DIR__ . '/..' . '/stripe/stripe-php/lib/Account.php',
@ -1152,7 +1152,7 @@ class ComposerStaticInit6b03163c371c5541881b55b762b8c779
'SurveyInfo' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyInfo.php', 'SurveyInfo' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyInfo.php',
'SurveyInspect' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyInpect.php', 'SurveyInspect' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyInpect.php',
'SurveyInvitationsNew' => __DIR__ . '/../..' . '/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.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', 'SurveyJsonSurveyData' => __DIR__ . '/../..' . '/admin/survey/modules/mod_json_survey_export/class.SurveyJsonSurveyData.php',
'SurveyKakovost' => __DIR__ . '/../..' . '/admin/survey/modules/mod_kakovost/class.SurveyKakovost.php', 'SurveyKakovost' => __DIR__ . '/../..' . '/admin/survey/modules/mod_kakovost/class.SurveyKakovost.php',
'SurveyLanguageTechnology' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyLanguageTechnology.php', 'SurveyLanguageTechnology' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyLanguageTechnology.php',

View File

@ -182,79 +182,6 @@
"url" "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", "name": "web-token/jwt-core",
"version": "v1.3.10", "version": "v1.3.10",
@ -1961,5 +1888,78 @@
"uri", "uri",
"url" "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"
]
} }
] ]

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) #### v2.2.0 (2020-08)
* support polyfills for bcmath and gmp, and add a composer.json * support polyfills for bcmath and gmp, and add a composer.json
suggestion for the `phpseclib/bcmath_polyfill` for servers unable 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 RSA_ENCRYPTION = '1.2.840.113549.1.1.1';
const MD5_WITH_RSA_ENCRYPTION = '1.2.840.113549.1.1.4'; 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 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_EMAIL = '1.2.840.113549.1.9.1';
const PKCS9_UNSTRUCTURED_NAME = '1.2.840.113549.1.9.2'; const PKCS9_UNSTRUCTURED_NAME = '1.2.840.113549.1.9.2';
const PKCS9_CONTENT_TYPE = '1.2.840.113549.1.9.3'; 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 $signature
* @param string $signatureAlgorithm * @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( $this->subject = new CertificateSubject(
$commonName, $commonName,
@ -56,8 +56,10 @@ class CSR extends Sequence
$this->signature = $signature; $this->signature = $signature;
$this->signatureAlgorithm = $signatureAlgorithm; $this->signatureAlgorithm = $signatureAlgorithm;
if (isset($signature)) {
$this->createCSRSequence(); $this->createCSRSequence();
} }
}
protected function createCSRSequence() protected function createCSRSequence()
{ {
@ -68,11 +70,31 @@ class CSR extends Sequence
$certRequestInfo = new Sequence($versionNr, $this->subject, $publicKey); $certRequestInfo = new Sequence($versionNr, $this->subject, $publicKey);
// Clear the underlying Construct
$this->rewind();
$this->children = [];
$this->addChild($certRequestInfo); $this->addChild($certRequestInfo);
$this->addChild($signatureAlgorithm); $this->addChild($signatureAlgorithm);
$this->addChild($signature); $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() public function __toString()
{ {
$tmp = base64_encode($this->getBinary()); $tmp = base64_encode($this->getBinary());