This commit is contained in:
terrafrost 2022-08-13 16:52:58 -05:00
commit 32e85c2145
167 changed files with 689 additions and 675 deletions

View File

@ -26,9 +26,7 @@ return (new PhpCsFixer\Config())
'phpdoc_trim_consecutive_blank_line_separation' => true, 'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_trim' => true, 'phpdoc_trim' => true,
'@PHP70Migration' => true,
'@PHP70Migration:risky' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true, '@PHP71Migration:risky' => true,
'@PHP73Migration' => true,
] ]
); );

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.23.0@f1fe6ff483bf325c803df9f510d09a03fd796f88"> <files psalm-version="4.24.0@06dd975cb55d36af80f242561738f16c5f58264f">
<file src="../phpseclib/Common/Functions/Strings.php"> <file src="../phpseclib/Common/Functions/Strings.php">
<MissingParamType occurrences="1"> <MissingParamType occurrences="1">
<code>$var</code> <code>$var</code>
@ -2048,7 +2048,7 @@
<MixedArrayOffset occurrences="1"> <MixedArrayOffset occurrences="1">
<code>[static::OID_NAME =&gt; static::OID_VALUE]</code> <code>[static::OID_NAME =&gt; static::OID_VALUE]</code>
</MixedArrayOffset> </MixedArrayOffset>
<MixedAssignment occurrences="15"> <MixedAssignment occurrences="16">
<code>$algorithm</code> <code>$algorithm</code>
<code>$encryptionAlgorithm</code> <code>$encryptionAlgorithm</code>
<code>$encryptionScheme</code> <code>$encryptionScheme</code>
@ -2057,6 +2057,7 @@
<code>$key</code> <code>$key</code>
<code>$key</code> <code>$key</code>
<code>$key['privateKeyAlgorithm']['parameters']</code> <code>$key['privateKeyAlgorithm']['parameters']</code>
<code>$key['publicKeyAlgorithm']['parameters']</code>
<code>$meta['meta']['algorithm']</code> <code>$meta['meta']['algorithm']</code>
<code>$meta['meta']['cipher']</code> <code>$meta['meta']['cipher']</code>
<code>$meta['meta']['keyDerivationFunc']</code> <code>$meta['meta']['keyDerivationFunc']</code>
@ -7808,7 +7809,7 @@
<code>$t</code> <code>$t</code>
</MixedOperand> </MixedOperand>
<MoreSpecificReturnType occurrences="1"> <MoreSpecificReturnType occurrences="1">
<code>RSA</code> <code>PrivateKey</code>
</MoreSpecificReturnType> </MoreSpecificReturnType>
<PossiblyFalseArgument occurrences="4"> <PossiblyFalseArgument occurrences="4">
<code>$primes[$i]</code> <code>$primes[$i]</code>
@ -9965,10 +9966,14 @@
<code>$this-&gt;x</code> <code>$this-&gt;x</code>
<code>$this-&gt;x + 1</code> <code>$this-&gt;x + 1</code>
</PossiblyInvalidArgument> </PossiblyInvalidArgument>
<PossiblyInvalidPropertyAssignmentValue occurrences="5"> <PossiblyInvalidPropertyAssignmentValue occurrences="9">
<code>$match[2] - 1</code> <code>$match[2] - 1</code>
<code>$this-&gt;x</code> <code>$this-&gt;x</code>
<code>$this-&gt;x</code> <code>$this-&gt;x</code>
<code>$this-&gt;x</code>
<code>$this-&gt;x</code>
<code>$this-&gt;x</code>
<code>$this-&gt;x</code>
<code>$this-&gt;x += $match[1]</code> <code>$this-&gt;x += $match[1]</code>
<code>$this-&gt;x -= $match[1]</code> <code>$this-&gt;x -= $match[1]</code>
</PossiblyInvalidPropertyAssignmentValue> </PossiblyInvalidPropertyAssignmentValue>
@ -9987,7 +9992,7 @@
<PossiblyUnusedReturnValue occurrences="1"> <PossiblyUnusedReturnValue occurrences="1">
<code>\phpseclib3\File\ANSI</code> <code>\phpseclib3\File\ANSI</code>
</PossiblyUnusedReturnValue> </PossiblyUnusedReturnValue>
<PropertyNotSetInConstructor occurrences="13"> <PropertyNotSetInConstructor occurrences="14">
<code>$ansi</code> <code>$ansi</code>
<code>$attr_row</code> <code>$attr_row</code>
<code>$attrs</code> <code>$attrs</code>
@ -9996,6 +10001,7 @@
<code>$max_history</code> <code>$max_history</code>
<code>$max_x</code> <code>$max_x</code>
<code>$max_y</code> <code>$max_y</code>
<code>$old_x</code>
<code>$old_y</code> <code>$old_y</code>
<code>$screen</code> <code>$screen</code>
<code>$tokenization</code> <code>$tokenization</code>
@ -10009,6 +10015,9 @@
<code>$this-&gt;screen</code> <code>$this-&gt;screen</code>
<code>$this-&gt;screen</code> <code>$this-&gt;screen</code>
</PropertyTypeCoercion> </PropertyTypeCoercion>
<UnusedProperty occurrences="1">
<code>$old_x</code>
</UnusedProperty>
</file> </file>
<file src="../phpseclib/File/ASN1.php"> <file src="../phpseclib/File/ASN1.php">
<DocblockTypeContradiction occurrences="4"> <DocblockTypeContradiction occurrences="4">
@ -14441,7 +14450,7 @@
<code>readlink</code> <code>readlink</code>
<code>realpath</code> <code>realpath</code>
</MissingReturnType> </MissingReturnType>
<MixedArgument occurrences="75"> <MixedArgument occurrences="72">
<code>$a['filename']</code> <code>$a['filename']</code>
<code>$attr['mode']</code> <code>$attr['mode']</code>
<code>$b['filename']</code> <code>$b['filename']</code>
@ -14475,7 +14484,6 @@
<code>$fp</code> <code>$fp</code>
<code>$fp</code> <code>$fp</code>
<code>$length</code> <code>$length</code>
<code>$length + $res_offset</code>
<code>$link</code> <code>$link</code>
<code>$link</code> <code>$link</code>
<code>$link</code> <code>$link</code>
@ -14492,8 +14500,6 @@
<code>$remote_file</code> <code>$remote_file</code>
<code>$remote_file</code> <code>$remote_file</code>
<code>$stat['atime']</code> <code>$stat['atime']</code>
<code>$stat['atime']</code>
<code>$stat['mtime']</code>
<code>$stat['mtime']</code> <code>$stat['mtime']</code>
<code>$status</code> <code>$status</code>
<code>$status</code> <code>$status</code>
@ -14539,7 +14545,7 @@
<code>$this-&gt;requestBuffer[$packet_id]</code> <code>$this-&gt;requestBuffer[$packet_id]</code>
<code>$this-&gt;requestBuffer[$request_id]</code> <code>$this-&gt;requestBuffer[$request_id]</code>
</MixedArrayOffset> </MixedArrayOffset>
<MixedAssignment occurrences="68"> <MixedAssignment occurrences="64">
<code>$a[$sort]</code> <code>$a[$sort]</code>
<code>$attr</code> <code>$attr</code>
<code>$attr</code> <code>$attr</code>
@ -14576,7 +14582,6 @@
<code>$props</code> <code>$props</code>
<code>$remote_file</code> <code>$remote_file</code>
<code>$remote_file</code> <code>$remote_file</code>
<code>$res_offset</code>
<code>$response</code> <code>$response</code>
<code>$response</code> <code>$response</code>
<code>$response</code> <code>$response</code>
@ -14588,9 +14593,6 @@
<code>$result</code> <code>$result</code>
<code>$result</code> <code>$result</code>
<code>$size</code> <code>$size</code>
<code>$size</code>
<code>$size</code>
<code>$size</code>
<code>$subtemp</code> <code>$subtemp</code>
<code>$temp</code> <code>$temp</code>
<code>$temp</code> <code>$temp</code>
@ -14619,7 +14621,7 @@
<code>string</code> <code>string</code>
<code>string|bool</code> <code>string|bool</code>
</MixedInferredReturnType> </MixedInferredReturnType>
<MixedOperand occurrences="31"> <MixedOperand occurrences="28">
<code>$a[$sort]</code> <code>$a[$sort]</code>
<code>$a[$sort]</code> <code>$a[$sort]</code>
<code>$attr</code> <code>$attr</code>
@ -14636,11 +14638,8 @@
<code>$key</code> <code>$key</code>
<code>$length</code> <code>$length</code>
<code>$offset</code> <code>$offset</code>
<code>$res_offset</code>
<code>$shortname</code> <code>$shortname</code>
<code>$shortname</code> <code>$shortname</code>
<code>$size</code>
<code>$size</code>
<code>$start</code> <code>$start</code>
<code>$subtemp</code> <code>$subtemp</code>
<code>$temp</code> <code>$temp</code>
@ -14737,7 +14736,7 @@
<code>$this-&gt;channel_status[self::CHANNEL]</code> <code>$this-&gt;channel_status[self::CHANNEL]</code>
<code>$this-&gt;server_channels[self::CHANNEL]</code> <code>$this-&gt;server_channels[self::CHANNEL]</code>
</PossiblyUndefinedIntArrayOffset> </PossiblyUndefinedIntArrayOffset>
<PossiblyUndefinedStringArrayOffset occurrences="20"> <PossiblyUndefinedStringArrayOffset occurrences="14">
<code>$a['filename']</code> <code>$a['filename']</code>
<code>$a['filename']</code> <code>$a['filename']</code>
<code>$a['filename']</code> <code>$a['filename']</code>
@ -14749,13 +14748,7 @@
<code>$b['filename']</code> <code>$b['filename']</code>
<code>$b['filename']</code> <code>$b['filename']</code>
<code>$stat['atime']</code> <code>$stat['atime']</code>
<code>$stat['atime']</code>
<code>$stat['atime']</code>
<code>$stat['mtime']</code> <code>$stat['mtime']</code>
<code>$stat['mtime']</code>
<code>$stat['mtime']</code>
<code>$stat['size']</code>
<code>$stat['size']</code>
<code>$stat['type']</code> <code>$stat['type']</code>
<code>$this-&gt;stat($remote_file)['size']</code> <code>$this-&gt;stat($remote_file)['size']</code>
</PossiblyUndefinedStringArrayOffset> </PossiblyUndefinedStringArrayOffset>
@ -17114,8 +17107,7 @@
<MissingParamType occurrences="1"> <MissingParamType occurrences="1">
<code>$args</code> <code>$args</code>
</MissingParamType> </MissingParamType>
<MixedArgument occurrences="4"> <MixedArgument occurrences="3">
<code>$key</code>
<code>$r['primes']</code> <code>$r['primes']</code>
<code>$r['primes']</code> <code>$r['primes']</code>
<code>$rsa-&gt;getPublicKey()-&gt;toString('PKCS1')</code> <code>$rsa-&gt;getPublicKey()-&gt;toString('PKCS1')</code>
@ -17124,21 +17116,19 @@
<code>$privatekey</code> <code>$privatekey</code>
<code>$publickey</code> <code>$publickey</code>
</MixedArrayAccess> </MixedArrayAccess>
<MixedAssignment occurrences="7"> <MixedAssignment occurrences="6">
<code>$actual</code> <code>$actual</code>
<code>$ciphertext</code> <code>$ciphertext</code>
<code>$key</code>
<code>$plaintext</code> <code>$plaintext</code>
<code>$prime</code> <code>$prime</code>
<code>$signature</code> <code>$signature</code>
<code>[$publickey, $privatekey]</code> <code>[$publickey, $privatekey]</code>
</MixedAssignment> </MixedAssignment>
<MixedMethodCall occurrences="5"> <MixedMethodCall occurrences="4">
<code>decrypt</code> <code>decrypt</code>
<code>encrypt</code> <code>encrypt</code>
<code>getLength</code> <code>getLength</code>
<code>toString</code> <code>toString</code>
<code>toString</code>
</MixedMethodCall> </MixedMethodCall>
<PossiblyUndefinedStringArrayOffset occurrences="3"> <PossiblyUndefinedStringArrayOffset occurrences="3">
<code>$r['primes']</code> <code>$r['primes']</code>
@ -17149,13 +17139,10 @@
<code>CreateKeyTest</code> <code>CreateKeyTest</code>
<code>CreateKeyTest</code> <code>CreateKeyTest</code>
</PropertyNotSetInConstructor> </PropertyNotSetInConstructor>
<UndefinedMethod occurrences="6"> <UndefinedMethod occurrences="3">
<code>getPublicKey</code>
<code>getPublicKey</code>
<code>getPublicKey</code> <code>getPublicKey</code>
<code>sign</code> <code>sign</code>
<code>verify</code> <code>verify</code>
<code>withPassword</code>
</UndefinedMethod> </UndefinedMethod>
<UnusedClass occurrences="1"> <UnusedClass occurrences="1">
<code>CreateKeyTest</code> <code>CreateKeyTest</code>
@ -17609,11 +17596,10 @@
<code>'phpseclib3\Math\BigInteger'</code> <code>'phpseclib3\Math\BigInteger'</code>
</ArgumentTypeCoercion> </ArgumentTypeCoercion>
<InvalidArgument occurrences="1"> <InvalidArgument occurrences="1">
<code>$privateKey</code>
</InvalidArgument>
<MixedArgument occurrences="4">
<code>$authority-&gt;sign($issuer, $subject)</code>
<code>$publicKey</code> <code>$publicKey</code>
</InvalidArgument>
<MixedArgument occurrences="3">
<code>$authority-&gt;sign($issuer, $subject)</code>
<code>$result</code> <code>$result</code>
<code>$subjectKey</code> <code>$subjectKey</code>
</MixedArgument> </MixedArgument>
@ -17628,11 +17614,10 @@
<code>$extension['extnValue']</code> <code>$extension['extnValue']</code>
<code>$loader-&gt;loadX509($cert)['tbsCertificate']</code> <code>$loader-&gt;loadX509($cert)['tbsCertificate']</code>
</MixedArrayAccess> </MixedArrayAccess>
<MixedAssignment occurrences="6"> <MixedAssignment occurrences="5">
<code>$customExtensionDecodedData</code> <code>$customExtensionDecodedData</code>
<code>$decodedData</code> <code>$decodedData</code>
<code>$extension</code> <code>$extension</code>
<code>$publicKey</code>
<code>$result</code> <code>$result</code>
<code>$subjectKey</code> <code>$subjectKey</code>
</MixedAssignment> </MixedAssignment>
@ -17651,9 +17636,6 @@
<code>X509ExtensionTest</code> <code>X509ExtensionTest</code>
<code>X509ExtensionTest</code> <code>X509ExtensionTest</code>
</PropertyNotSetInConstructor> </PropertyNotSetInConstructor>
<UndefinedMethod occurrences="1">
<code>getPublicKey</code>
</UndefinedMethod>
<UnusedClass occurrences="1"> <UnusedClass occurrences="1">
<code>X509ExtensionTest</code> <code>X509ExtensionTest</code>
</UnusedClass> </UnusedClass>

View File

@ -51,7 +51,7 @@
} }
], ],
"require": { "require": {
"php": ">=7.1", "php": ">=7.3",
"paragonie/constant_time_encoding": "^2" "paragonie/constant_time_encoding": "^2"
}, },
"require-dev": { "require-dev": {
@ -79,5 +79,22 @@
}, },
"config": { "config": {
"sort-packages": true "sort-packages": true
},
"scripts": {
"lint": "parallel-lint --show-deprecated build phpseclib tests",
"php_codesniffer": "phpcs --standard=build/php_codesniffer.xml",
"php_codesniffer-fix": "phpcbf --standard=build/php_codesniffer.xml",
"php-cs-fixer": "php-cs-fixer fix --config=build/php-cs-fixer.php --diff --using-cache=no --dry-run",
"php-cs-fixer-fix": "php-cs-fixer fix --config=build/php-cs-fixer.php --diff --using-cache=no",
"psalm": "psalm --config=build/psalm.xml --no-cache --long-progress",
"psalm-set-baseline": "psalm --config=build/psalm.xml --no-cache --long-progress --set-baseline=psalm_baseline.xml",
"test": "vendor/bin/phpunit --configuration tests/phpunit.xml",
"all-quality-tools": [
"@lint",
"@phpcs",
"@php-cs-fixer",
"@psalm",
"@test"
]
} }
} }

View File

@ -171,7 +171,7 @@ class Blowfish extends BlockCipher
0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5,
0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915,
0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a,
]; ];
/** /**
@ -211,7 +211,7 @@ class Blowfish extends BlockCipher
0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e,
0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340,
0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7,
]; ];
/** /**
@ -251,7 +251,7 @@ class Blowfish extends BlockCipher
0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76,
0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0,
]; ];
/** /**
@ -291,7 +291,7 @@ class Blowfish extends BlockCipher
0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6,
]; ];
/** /**
@ -302,7 +302,7 @@ class Blowfish extends BlockCipher
private static $parray = [ private static $parray = [
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0,
0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b,
]; ];
/** /**
@ -406,8 +406,8 @@ class Blowfish extends BlockCipher
self::$sbox0, self::$sbox0,
self::$sbox1, self::$sbox1,
self::$sbox2, self::$sbox2,
self::$sbox3 self::$sbox3,
] ],
]; ];
// unpack binary string in unsigned chars // unpack binary string in unsigned chars
@ -802,7 +802,7 @@ class Blowfish extends BlockCipher
'init_encrypt' => '', 'init_encrypt' => '',
'init_decrypt' => '', 'init_decrypt' => '',
'encrypt_block' => $encrypt_block, 'encrypt_block' => $encrypt_block,
'decrypt_block' => $decrypt_block 'decrypt_block' => $decrypt_block,
] ]
); );
} }

View File

@ -391,7 +391,7 @@ abstract class AsymmetricKey
// this test can be satisfied by either of the following: // this test can be satisfied by either of the following:
// http://php.net/manual/en/book.sodium.php // http://php.net/manual/en/book.sodium.php
// https://github.com/paragonie/sodium_compat // https://github.com/paragonie/sodium_compat
'libsodium' => function_exists('sodium_crypto_sign_keypair') 'libsodium' => function_exists('sodium_crypto_sign_keypair'),
]; ];
return static::$engines; return static::$engines;
@ -405,7 +405,7 @@ abstract class AsymmetricKey
static::$engines = [ static::$engines = [
'PHP' => true, 'PHP' => true,
'OpenSSL' => false, 'OpenSSL' => false,
'libsodium' => false 'libsodium' => false,
]; ];
} }

View File

@ -285,7 +285,7 @@ abstract class PKCS8 extends PKCS
'aes128-CBC-PAD' => '2.16.840.1.101.3.4.1.2', 'aes128-CBC-PAD' => '2.16.840.1.101.3.4.1.2',
'aes192-CBC-PAD' => '2.16.840.1.101.3.4.1.22', 'aes192-CBC-PAD' => '2.16.840.1.101.3.4.1.22',
'aes256-CBC-PAD' => '2.16.840.1.101.3.4.1.42' 'aes256-CBC-PAD' => '2.16.840.1.101.3.4.1.42',
]); ]);
self::$oidsLoaded = true; self::$oidsLoaded = true;
} }
@ -401,7 +401,7 @@ abstract class PKCS8 extends PKCS
'pbkdf2', 'pbkdf2',
$hash, $hash,
$salt, $salt,
(int) $iterationCount->toString() (int) $iterationCount->toString(),
]; ];
if (isset($keyLength)) { if (isset($keyLength)) {
$params[] = (int) $keyLength->toString(); $params[] = (int) $keyLength->toString();
@ -496,9 +496,9 @@ abstract class PKCS8 extends PKCS
$key = [ $key = [
'version' => 'v1', 'version' => 'v1',
'privateKeyAlgorithm' => [ 'privateKeyAlgorithm' => [
'algorithm' => is_string(static::OID_NAME) ? static::OID_NAME : $oid 'algorithm' => is_string(static::OID_NAME) ? static::OID_NAME : $oid,
], ],
'privateKey' => $key 'privateKey' => $key,
]; ];
if ($oid != 'id-Ed25519' && $oid != 'id-Ed448') { if ($oid != 'id-Ed25519' && $oid != 'id-Ed448') {
$key['privateKeyAlgorithm']['parameters'] = $params; $key['privateKeyAlgorithm']['parameters'] = $params;
@ -528,7 +528,7 @@ abstract class PKCS8 extends PKCS
$PBKDF2params = [ $PBKDF2params = [
'salt' => $salt, 'salt' => $salt,
'iterationCount' => $iterationCount, 'iterationCount' => $iterationCount,
'prf' => ['algorithm' => $prf, 'parameters' => null] 'prf' => ['algorithm' => $prf, 'parameters' => null],
]; ];
$PBKDF2params = ASN1::encodeDER($PBKDF2params, Maps\PBKDF2params::MAP); $PBKDF2params = ASN1::encodeDER($PBKDF2params, Maps\PBKDF2params::MAP);
@ -537,7 +537,7 @@ abstract class PKCS8 extends PKCS
} else { } else {
$params = [ $params = [
'rc2ParametersVersion' => 58, 'rc2ParametersVersion' => 58,
'iv' => $iv 'iv' => $iv,
]; ];
$params = ASN1::encodeDER($params, Maps\RC2CBCParameter::MAP); $params = ASN1::encodeDER($params, Maps\RC2CBCParameter::MAP);
$params = new ASN1\Element($params); $params = new ASN1\Element($params);
@ -546,12 +546,12 @@ abstract class PKCS8 extends PKCS
$params = [ $params = [
'keyDerivationFunc' => [ 'keyDerivationFunc' => [
'algorithm' => 'id-PBKDF2', 'algorithm' => 'id-PBKDF2',
'parameters' => new ASN1\Element($PBKDF2params) 'parameters' => new ASN1\Element($PBKDF2params),
], ],
'encryptionScheme' => [ 'encryptionScheme' => [
'algorithm' => $encryptionScheme, 'algorithm' => $encryptionScheme,
'parameters' => $params 'parameters' => $params,
] ],
]; ];
$params = ASN1::encodeDER($params, Maps\PBES2params::MAP); $params = ASN1::encodeDER($params, Maps\PBES2params::MAP);
@ -563,7 +563,7 @@ abstract class PKCS8 extends PKCS
$params = [ $params = [
'salt' => $salt, 'salt' => $salt,
'iterationCount' => $iterationCount 'iterationCount' => $iterationCount,
]; ];
$params = ASN1::encodeDER($params, Maps\PBEParameter::MAP); $params = ASN1::encodeDER($params, Maps\PBEParameter::MAP);
} }
@ -573,9 +573,9 @@ abstract class PKCS8 extends PKCS
$key = [ $key = [
'encryptionAlgorithm' => [ 'encryptionAlgorithm' => [
'algorithm' => $encryptionAlgorithm, 'algorithm' => $encryptionAlgorithm,
'parameters' => new ASN1\Element($params) 'parameters' => new ASN1\Element($params),
], ],
'encryptedData' => $key 'encryptedData' => $key,
]; ];
$key = ASN1::encodeDER($key, Maps\EncryptedPrivateKeyInfo::MAP); $key = ASN1::encodeDER($key, Maps\EncryptedPrivateKeyInfo::MAP);
@ -599,9 +599,9 @@ abstract class PKCS8 extends PKCS
$key = [ $key = [
'publicKeyAlgorithm' => [ 'publicKeyAlgorithm' => [
'algorithm' => is_string(static::OID_NAME) ? static::OID_NAME : $oid 'algorithm' => is_string(static::OID_NAME) ? static::OID_NAME : $oid,
], ],
'publicKey' => "\0" . $key 'publicKey' => "\0" . $key,
]; ];
if ($oid != 'id-Ed25519' && $oid != 'id-Ed448') { if ($oid != 'id-Ed25519' && $oid != 'id-Ed448') {

View File

@ -43,7 +43,7 @@ abstract class Raw
return [ return [
'r' => $sig['r'], 'r' => $sig['r'],
's' => $sig['s'] 's' => $sig['s'],
]; ];
} }

View File

@ -142,7 +142,7 @@ abstract class SymmetricKey
'ofb' => self::MODE_OFB, 'ofb' => self::MODE_OFB,
'ofb8' => self::MODE_OFB8, 'ofb8' => self::MODE_OFB8,
'gcm' => self::MODE_GCM, 'gcm' => self::MODE_GCM,
'stream' => self::MODE_STREAM 'stream' => self::MODE_STREAM,
]; ];
/** /**
@ -186,7 +186,7 @@ abstract class SymmetricKey
self::ENGINE_EVAL => 'Eval', self::ENGINE_EVAL => 'Eval',
self::ENGINE_OPENSSL => 'OpenSSL', self::ENGINE_OPENSSL => 'OpenSSL',
self::ENGINE_LIBSODIUM => 'libsodium', self::ENGINE_LIBSODIUM => 'libsodium',
self::ENGINE_OPENSSL_GCM => 'OpenSSL (GCM)' self::ENGINE_OPENSSL_GCM => 'OpenSSL (GCM)',
]; ];
/** /**
@ -1996,7 +1996,7 @@ abstract class SymmetricKey
self::ENGINE_LIBSODIUM, self::ENGINE_LIBSODIUM,
self::ENGINE_OPENSSL_GCM, self::ENGINE_OPENSSL_GCM,
self::ENGINE_OPENSSL, self::ENGINE_OPENSSL,
self::ENGINE_EVAL self::ENGINE_EVAL,
]; ];
if (isset($this->preferredEngine)) { if (isset($this->preferredEngine)) {
$temp = [$this->preferredEngine]; $temp = [$this->preferredEngine];
@ -2778,16 +2778,16 @@ abstract class SymmetricKey
// @see https://github.com/phpseclib/phpseclib/pull/1143 // @see https://github.com/phpseclib/phpseclib/pull/1143
/** @var \Closure $func */ /** @var \Closure $func */
$func = eval(<<<PHP $func = eval(<<<PHP
return function (string \$_action, string \$_text): string return function (string \$_action, string \$_text): string
{ {
{$init_crypt} {$init_crypt}
if (\$_action === 'encrypt') { if (\$_action === 'encrypt') {
{$encrypt} {$encrypt}
} else { } else {
{$decrypt} {$decrypt}
} }
}; };
PHP PHP
); );
$bindedClosure = \Closure::bind($func, $this, static::class); $bindedClosure = \Closure::bind($func, $this, static::class);

View File

@ -93,7 +93,7 @@ class DES extends BlockCipher
self::MODE_ECB => 'des-ecb', self::MODE_ECB => 'des-ecb',
self::MODE_CBC => 'des-cbc', self::MODE_CBC => 'des-cbc',
self::MODE_CFB => 'des-cfb', self::MODE_CFB => 'des-cfb',
self::MODE_OFB => 'des-ofb' self::MODE_OFB => 'des-ofb',
// self::MODE_CTR is undefined for DES // self::MODE_CTR is undefined for DES
]; ];
@ -268,7 +268,7 @@ class DES extends BlockCipher
"\xFF\xFF\xFF\xFF\xFF\x00\x00\x00", "\xFF\xFF\xFF\xFF\xFF\x00\x00\xFF", "\xFF\xFF\xFF\xFF\xFF\x00\x00\x00", "\xFF\xFF\xFF\xFF\xFF\x00\x00\xFF",
"\xFF\xFF\xFF\xFF\xFF\x00\xFF\x00", "\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF", "\xFF\xFF\xFF\xFF\xFF\x00\xFF\x00", "\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF",
"\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00", "\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF", "\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00", "\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF",
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00", "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00", "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF",
]; ];
/** /**
@ -310,7 +310,7 @@ class DES extends BlockCipher
0x8C, 0x9C, 0x8D, 0x9D, 0xAC, 0xBC, 0xAD, 0xBD, 0x8C, 0x9C, 0x8D, 0x9D, 0xAC, 0xBC, 0xAD, 0xBD,
0x8E, 0x9E, 0x8F, 0x9F, 0xAE, 0xBE, 0xAF, 0xBF, 0x8E, 0x9E, 0x8F, 0x9F, 0xAE, 0xBE, 0xAF, 0xBF,
0xCC, 0xDC, 0xCD, 0xDD, 0xEC, 0xFC, 0xED, 0xFD, 0xCC, 0xDC, 0xCD, 0xDD, 0xEC, 0xFC, 0xED, 0xFD,
0xCE, 0xDE, 0xCF, 0xDF, 0xEE, 0xFE, 0xEF, 0xFF 0xCE, 0xDE, 0xCF, 0xDF, 0xEE, 0xFE, 0xEF, 0xFF,
]; ];
/** /**
@ -351,7 +351,7 @@ class DES extends BlockCipher
0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, 0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7,
0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF,
0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF,
]; ];
/** /**
@ -378,7 +378,7 @@ class DES extends BlockCipher
0x00808202, 0x00008002, 0x00808000, 0x00800202, 0x00808202, 0x00008002, 0x00808000, 0x00800202,
0x00800002, 0x00000202, 0x00008202, 0x00808200, 0x00800002, 0x00000202, 0x00008202, 0x00808200,
0x00000202, 0x00800200, 0x00800200, 0x00000000, 0x00000202, 0x00800200, 0x00800200, 0x00000000,
0x00008002, 0x00008200, 0x00000000, 0x00808002 0x00008002, 0x00008200, 0x00000000, 0x00808002,
]; ];
/** /**
@ -402,7 +402,7 @@ class DES extends BlockCipher
0x00004010, 0x40084000, 0x00080000, 0x40000010, 0x00004010, 0x40084000, 0x00080000, 0x40000010,
0x00080010, 0x40004010, 0x40000010, 0x00080010, 0x00080010, 0x40004010, 0x40000010, 0x00080010,
0x00084000, 0x00000000, 0x40004000, 0x00004010, 0x00084000, 0x00000000, 0x40004000, 0x00004010,
0x40000000, 0x40080010, 0x40084010, 0x00084000 0x40000000, 0x40080010, 0x40084010, 0x00084000,
]; ];
/** /**
@ -426,7 +426,7 @@ class DES extends BlockCipher
0x04000104, 0x00010000, 0x04000000, 0x04010104, 0x04000104, 0x00010000, 0x04000000, 0x04010104,
0x00000004, 0x00010104, 0x00010100, 0x04000004, 0x00000004, 0x00010104, 0x00010100, 0x04000004,
0x04010000, 0x04000104, 0x00000104, 0x04010000, 0x04010000, 0x04000104, 0x00000104, 0x04010000,
0x00010104, 0x00000004, 0x04010004, 0x00010100 0x00010104, 0x00000004, 0x04010004, 0x00010100,
]; ];
/** /**
@ -450,7 +450,7 @@ class DES extends BlockCipher
0x80401040, 0x80000040, 0x80000000, 0x00001000, 0x80401040, 0x80000040, 0x80000000, 0x00001000,
0x80400000, 0x80001000, 0x00401040, 0x80400040, 0x80400000, 0x80001000, 0x00401040, 0x80400040,
0x80001000, 0x00001040, 0x00400000, 0x80401000, 0x80001000, 0x00001040, 0x00400000, 0x80401000,
0x00000040, 0x00400000, 0x00001000, 0x00401040 0x00000040, 0x00400000, 0x00001000, 0x00401040,
]; ];
/** /**
@ -474,7 +474,7 @@ class DES extends BlockCipher
0x21040080, 0x00040080, 0x21000000, 0x21040080, 0x21040080, 0x00040080, 0x21000000, 0x21040080,
0x01040000, 0x00000000, 0x20040000, 0x21000000, 0x01040000, 0x00000000, 0x20040000, 0x21000000,
0x00040080, 0x01000080, 0x20000080, 0x00040000, 0x00040080, 0x01000080, 0x20000080, 0x00040000,
0x00000000, 0x20040000, 0x01040080, 0x20000080 0x00000000, 0x20040000, 0x01040080, 0x20000080,
]; ];
/** /**
@ -498,7 +498,7 @@ class DES extends BlockCipher
0x00202008, 0x10202000, 0x00000000, 0x10200008, 0x00202008, 0x10202000, 0x00000000, 0x10200008,
0x00000008, 0x00002000, 0x10200000, 0x00202008, 0x00000008, 0x00002000, 0x10200000, 0x00202008,
0x00002000, 0x00200008, 0x10002008, 0x00000000, 0x00002000, 0x00200008, 0x10002008, 0x00000000,
0x10202000, 0x10000000, 0x00200008, 0x10002008 0x10202000, 0x10000000, 0x00200008, 0x10002008,
]; ];
/** /**
@ -522,7 +522,7 @@ class DES extends BlockCipher
0x00000401, 0x02000001, 0x02100401, 0x02100000, 0x00000401, 0x02000001, 0x02100401, 0x02100000,
0x00100400, 0x00000000, 0x00000001, 0x02100401, 0x00100400, 0x00000000, 0x00000001, 0x02100401,
0x00000000, 0x00100401, 0x02100000, 0x00000400, 0x00000000, 0x00100401, 0x02100000, 0x00000400,
0x02000001, 0x02000400, 0x00000400, 0x00100001 0x02000001, 0x02000400, 0x00000400, 0x00100001,
]; ];
/** /**
@ -546,7 +546,7 @@ class DES extends BlockCipher
0x00000000, 0x08020820, 0x00020020, 0x08000020, 0x00000000, 0x08020820, 0x00020020, 0x08000020,
0x08020000, 0x08000800, 0x08000820, 0x00000000, 0x08020000, 0x08000800, 0x08000820, 0x00000000,
0x08020820, 0x00020800, 0x00020800, 0x00000820, 0x08020820, 0x00020800, 0x00020800, 0x00000820,
0x00000820, 0x00020020, 0x08000000, 0x08020800 0x00000820, 0x00020020, 0x08000000, 0x08020800,
]; ];
/** /**
@ -725,7 +725,7 @@ class DES extends BlockCipher
$this->kl = ['key' => $this->key, 'des_rounds' => $this->des_rounds]; $this->kl = ['key' => $this->key, 'des_rounds' => $this->des_rounds];
static $shifts = [ // number of key bits shifted per round static $shifts = [ // number of key bits shifted per round
1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1,
]; ];
static $pc1map = [ static $pc1map = [
@ -760,7 +760,7 @@ class DES extends BlockCipher
0xE0, 0xE0, 0xE8, 0xE8, 0xE4, 0xE4, 0xEC, 0xEC, 0xE0, 0xE0, 0xE8, 0xE8, 0xE4, 0xE4, 0xEC, 0xEC,
0xE2, 0xE2, 0xEA, 0xEA, 0xE6, 0xE6, 0xEE, 0xEE, 0xE2, 0xE2, 0xEA, 0xEA, 0xE6, 0xE6, 0xEE, 0xEE,
0xF0, 0xF0, 0xF8, 0xF8, 0xF4, 0xF4, 0xFC, 0xFC, 0xF0, 0xF0, 0xF8, 0xF8, 0xF4, 0xF4, 0xFC, 0xFC,
0xF2, 0xF2, 0xFA, 0xFA, 0xF6, 0xF6, 0xFE, 0xFE 0xF2, 0xF2, 0xFA, 0xFA, 0xF6, 0xF6, 0xFE, 0xFE,
]; ];
// Mapping tables for the PC-2 transformation. // Mapping tables for the PC-2 transformation.
@ -768,7 +768,7 @@ class DES extends BlockCipher
0x00000000, 0x00000400, 0x00200000, 0x00200400, 0x00000000, 0x00000400, 0x00200000, 0x00200400,
0x00000001, 0x00000401, 0x00200001, 0x00200401, 0x00000001, 0x00000401, 0x00200001, 0x00200401,
0x02000000, 0x02000400, 0x02200000, 0x02200400, 0x02000000, 0x02000400, 0x02200000, 0x02200400,
0x02000001, 0x02000401, 0x02200001, 0x02200401 0x02000001, 0x02000401, 0x02200001, 0x02200401,
]; ];
static $pc2mapc2 = [ static $pc2mapc2 = [
0x00000000, 0x00000800, 0x08000000, 0x08000800, 0x00000000, 0x00000800, 0x08000000, 0x08000800,
@ -834,7 +834,7 @@ class DES extends BlockCipher
0x01040110, 0x01040910, 0x09040110, 0x09040910, 0x01040110, 0x01040910, 0x09040110, 0x09040910,
0x01050110, 0x01050910, 0x09050110, 0x09050910, 0x01050110, 0x01050910, 0x09050110, 0x09050910,
0x01040110, 0x01040910, 0x09040110, 0x09040910, 0x01040110, 0x01040910, 0x09040110, 0x09040910,
0x01050110, 0x01050910, 0x09050110, 0x09050910 0x01050110, 0x01050910, 0x09050110, 0x09050910,
]; ];
static $pc2mapc3 = [ static $pc2mapc3 = [
0x00000000, 0x00000004, 0x00001000, 0x00001004, 0x00000000, 0x00000004, 0x00001000, 0x00001004,
@ -900,7 +900,7 @@ class DES extends BlockCipher
0x20080022, 0x20080026, 0x20081022, 0x20081026, 0x20080022, 0x20080026, 0x20081022, 0x20081026,
0x20080022, 0x20080026, 0x20081022, 0x20081026, 0x20080022, 0x20080026, 0x20081022, 0x20081026,
0x30080022, 0x30080026, 0x30081022, 0x30081026, 0x30080022, 0x30080026, 0x30081022, 0x30081026,
0x30080022, 0x30080026, 0x30081022, 0x30081026 0x30080022, 0x30080026, 0x30081022, 0x30081026,
]; ];
static $pc2mapc4 = [ static $pc2mapc4 = [
0x00000000, 0x00100000, 0x00000008, 0x00100008, 0x00000000, 0x00100000, 0x00000008, 0x00100008,
@ -966,13 +966,13 @@ class DES extends BlockCipher
0x04022000, 0x04122000, 0x04022008, 0x04122008, 0x04022000, 0x04122000, 0x04022008, 0x04122008,
0x04022200, 0x04122200, 0x04022208, 0x04122208, 0x04022200, 0x04122200, 0x04022208, 0x04122208,
0x04022000, 0x04122000, 0x04022008, 0x04122008, 0x04022000, 0x04122000, 0x04022008, 0x04122008,
0x04022200, 0x04122200, 0x04022208, 0x04122208 0x04022200, 0x04122200, 0x04022208, 0x04122208,
]; ];
static $pc2mapd1 = [ static $pc2mapd1 = [
0x00000000, 0x00000001, 0x08000000, 0x08000001, 0x00000000, 0x00000001, 0x08000000, 0x08000001,
0x00200000, 0x00200001, 0x08200000, 0x08200001, 0x00200000, 0x00200001, 0x08200000, 0x08200001,
0x00000002, 0x00000003, 0x08000002, 0x08000003, 0x00000002, 0x00000003, 0x08000002, 0x08000003,
0x00200002, 0x00200003, 0x08200002, 0x08200003 0x00200002, 0x00200003, 0x08200002, 0x08200003,
]; ];
static $pc2mapd2 = [ static $pc2mapd2 = [
0x00000000, 0x00100000, 0x00000800, 0x00100800, 0x00000000, 0x00100000, 0x00000800, 0x00100800,
@ -1038,7 +1038,7 @@ class DES extends BlockCipher
0x00020204, 0x00120204, 0x00020A04, 0x00120A04, 0x00020204, 0x00120204, 0x00020A04, 0x00120A04,
0x00020204, 0x00120204, 0x00020A04, 0x00120A04, 0x00020204, 0x00120204, 0x00020A04, 0x00120A04,
0x04020204, 0x04120204, 0x04020A04, 0x04120A04, 0x04020204, 0x04120204, 0x04020A04, 0x04120A04,
0x04020204, 0x04120204, 0x04020A04, 0x04120A04 0x04020204, 0x04120204, 0x04020A04, 0x04120A04,
]; ];
static $pc2mapd3 = [ static $pc2mapd3 = [
0x00000000, 0x00010000, 0x02000000, 0x02010000, 0x00000000, 0x00010000, 0x02000000, 0x02010000,
@ -1104,7 +1104,7 @@ class DES extends BlockCipher
0x20002010, 0x20012010, 0x22002010, 0x22012010, 0x20002010, 0x20012010, 0x22002010, 0x22012010,
0x20002030, 0x20012030, 0x22002030, 0x22012030, 0x20002030, 0x20012030, 0x22002030, 0x22012030,
0x20042010, 0x20052010, 0x22042010, 0x22052010, 0x20042010, 0x20052010, 0x22042010, 0x22052010,
0x20042030, 0x20052030, 0x22042030, 0x22052030 0x20042030, 0x20052030, 0x22042030, 0x22052030,
]; ];
static $pc2mapd4 = [ static $pc2mapd4 = [
0x00000000, 0x00000400, 0x01000000, 0x01000400, 0x00000000, 0x00000400, 0x01000000, 0x01000400,
@ -1170,7 +1170,7 @@ class DES extends BlockCipher
0x10081008, 0x10081408, 0x11081008, 0x11081408, 0x10081008, 0x10081408, 0x11081008, 0x11081408,
0x10081008, 0x10081408, 0x11081008, 0x11081408, 0x10081008, 0x10081408, 0x11081008, 0x11081408,
0x10081108, 0x10081508, 0x11081108, 0x11081508, 0x10081108, 0x10081508, 0x11081108, 0x11081508,
0x10081108, 0x10081508, 0x11081108, 0x11081508 0x10081108, 0x10081508, 0x11081108, 0x11081508,
]; ];
$keys = []; $keys = [];
@ -1195,7 +1195,7 @@ class DES extends BlockCipher
$keys[$des_round] = [ $keys[$des_round] = [
self::ENCRYPT => [], self::ENCRYPT => [],
self::DECRYPT => array_fill(0, 32, 0) self::DECRYPT => array_fill(0, 32, 0),
]; ];
for ($i = 0, $ki = 31; $i < 16; ++$i, $ki -= 2) { for ($i = 0, $ki = 31; $i < 16; ++$i, $ki -= 2) {
$c <<= $shifts[$i]; $c <<= $shifts[$i];
@ -1233,14 +1233,14 @@ class DES extends BlockCipher
$keys[2][self::DECRYPT], $keys[2][self::DECRYPT],
$keys[1][self::ENCRYPT], $keys[1][self::ENCRYPT],
$keys[0][self::DECRYPT] $keys[0][self::DECRYPT]
) ),
]; ];
break; break;
// case 1: // DES keys // case 1: // DES keys
default: default:
$this->keys = [ $this->keys = [
self::ENCRYPT => $keys[0][self::ENCRYPT], self::ENCRYPT => $keys[0][self::ENCRYPT],
self::DECRYPT => $keys[0][self::DECRYPT] self::DECRYPT => $keys[0][self::DECRYPT],
]; ];
} }
} }
@ -1277,7 +1277,7 @@ class DES extends BlockCipher
$k = [ $k = [
self::ENCRYPT => $this->keys[self::ENCRYPT], self::ENCRYPT => $this->keys[self::ENCRYPT],
self::DECRYPT => $this->keys[self::DECRYPT] self::DECRYPT => $this->keys[self::DECRYPT],
]; ];
$init_encrypt = ''; $init_encrypt = '';
$init_decrypt = ''; $init_decrypt = '';
@ -1352,7 +1352,7 @@ class DES extends BlockCipher
'init_encrypt' => $init_encrypt, 'init_encrypt' => $init_encrypt,
'init_decrypt' => $init_decrypt, 'init_decrypt' => $init_decrypt,
'encrypt_block' => $crypt_block[self::ENCRYPT], 'encrypt_block' => $crypt_block[self::ENCRYPT],
'decrypt_block' => $crypt_block[self::DECRYPT] 'decrypt_block' => $crypt_block[self::DECRYPT],
] ]
); );
} }

View File

@ -64,7 +64,7 @@ abstract class PKCS1 extends Progenitor
{ {
$params = [ $params = [
'prime' => $prime, 'prime' => $prime,
'base' => $base 'base' => $base,
]; ];
$params = ASN1::encodeDER($params, Maps\DHParameter::MAP); $params = ASN1::encodeDER($params, Maps\DHParameter::MAP);

View File

@ -107,7 +107,7 @@ abstract class PKCS8 extends Progenitor
{ {
$params = [ $params = [
'prime' => $prime, 'prime' => $prime,
'base' => $base 'base' => $base,
]; ];
$params = ASN1::encodeDER($params, Maps\DHParameter::MAP); $params = ASN1::encodeDER($params, Maps\DHParameter::MAP);
$params = new ASN1\Element($params); $params = new ASN1\Element($params);
@ -124,7 +124,7 @@ abstract class PKCS8 extends Progenitor
{ {
$params = [ $params = [
'prime' => $prime, 'prime' => $prime,
'base' => $base 'base' => $base,
]; ];
$params = ASN1::encodeDER($params, Maps\DHParameter::MAP); $params = ASN1::encodeDER($params, Maps\DHParameter::MAP);
$params = new ASN1\Element($params); $params = new ASN1\Element($params);

View File

@ -82,7 +82,7 @@ abstract class PKCS1 extends Progenitor
$key = [ $key = [
'p' => $p, 'p' => $p,
'q' => $q, 'q' => $q,
'g' => $g 'g' => $g,
]; ];
$key = ASN1::encodeDER($key, Maps\DSAParams::MAP); $key = ASN1::encodeDER($key, Maps\DSAParams::MAP);
@ -106,7 +106,7 @@ abstract class PKCS1 extends Progenitor
'q' => $q, 'q' => $q,
'g' => $g, 'g' => $g,
'y' => $y, 'y' => $y,
'x' => $x 'x' => $x,
]; ];
$key = ASN1::encodeDER($key, Maps\DSAPrivateKey::MAP); $key = ASN1::encodeDER($key, Maps\DSAPrivateKey::MAP);

View File

@ -118,7 +118,7 @@ abstract class PKCS8 extends Progenitor
$params = [ $params = [
'p' => $p, 'p' => $p,
'q' => $q, 'q' => $q,
'g' => $g 'g' => $g,
]; ];
$params = ASN1::encodeDER($params, Maps\DSAParams::MAP); $params = ASN1::encodeDER($params, Maps\DSAParams::MAP);
$params = new ASN1\Element($params); $params = new ASN1\Element($params);
@ -136,7 +136,7 @@ abstract class PKCS8 extends Progenitor
$params = [ $params = [
'p' => $p, 'p' => $p,
'q' => $q, 'q' => $q,
'g' => $g 'g' => $g,
]; ];
$params = ASN1::encodeDER($params, Maps\DSAParams::MAP); $params = ASN1::encodeDER($params, Maps\DSAParams::MAP);
$params = new ASN1\Element($params); $params = new ASN1\Element($params);

View File

@ -47,7 +47,7 @@ abstract class SSH2
return [ return [
'r' => new BigInteger(substr($blob, 0, 20), 256), 'r' => new BigInteger(substr($blob, 0, 20), 256),
's' => new BigInteger(substr($blob, 20), 256) 's' => new BigInteger(substr($blob, 20), 256),
]; ];
} }

View File

@ -189,7 +189,7 @@ abstract class Base
{ {
$temp = [ $temp = [
$p[0], $p[0],
$p[1]->negate() $p[1]->negate(),
]; ];
if (isset($p[2])) { if (isset($p[2])) {
$temp[] = $p[2]; $temp[] = $p[2];

View File

@ -125,7 +125,7 @@ class Binary extends Base
} }
$this->p = [ $this->p = [
is_string($x) ? $this->factory->newInteger(pack('H*', $x)) : $x, is_string($x) ? $this->factory->newInteger(pack('H*', $x)) : $x,
is_string($y) ? $this->factory->newInteger(pack('H*', $y)) : $y is_string($y) ? $this->factory->newInteger(pack('H*', $y)) : $y,
]; ];
} }
@ -346,7 +346,7 @@ class Binary extends Base
$z2 = $z->multiply($z); $z2 = $z->multiply($z);
return [ return [
$x->multiply($z2), $x->multiply($z2),
$y->multiply($z2)->multiply($z) $y->multiply($z2)->multiply($z),
]; ];
} }

View File

@ -77,7 +77,7 @@ class KoblitzPrime extends Prime
$s = $this->three->negate()->squareRoot()->multiply($inv); $s = $this->three->negate()->squareRoot()->multiply($inv);
$betas = [ $betas = [
$inv->add($s), $inv->add($s),
$inv->subtract($s) $inv->subtract($s),
]; ];
$this->beta = $betas[0]->compare($betas[1]) < 0 ? $betas[0] : $betas[1]; $this->beta = $betas[0]->compare($betas[1]) < 0 ? $betas[0] : $betas[1];
//echo strtoupper($this->beta->toHex(true)) . "\n"; exit; //echo strtoupper($this->beta->toHex(true)) . "\n"; exit;
@ -94,7 +94,7 @@ class KoblitzPrime extends Prime
$lambdas = [ $lambdas = [
$inv->add($s), $inv->add($s),
$inv->subtract($s) $inv->subtract($s),
]; ];
$lhs = $this->multiplyPoint($this->p, $lambdas[0])[0]; $lhs = $this->multiplyPoint($this->p, $lambdas[0])[0];
@ -143,7 +143,7 @@ class KoblitzPrime extends Prime
$beta = [ $beta = [
$p[0]->multiply($this->beta), $p[0]->multiply($this->beta),
$p[1], $p[1],
clone $this->one clone $this->one,
]; ];
if (isset($p['naf'])) { if (isset($p['naf'])) {
@ -151,7 +151,7 @@ class KoblitzPrime extends Prime
return [ return [
$p[0]->multiply($this->beta), $p[0]->multiply($this->beta),
$p[1], $p[1],
clone $this->one clone $this->one,
]; ];
}, $p['naf']); }, $p['naf']);
$beta['nafwidth'] = $p['nafwidth']; $beta['nafwidth'] = $p['nafwidth'];
@ -324,7 +324,7 @@ class KoblitzPrime extends Prime
return [ return [
['a' => $a1, 'b' => $b1], ['a' => $a1, 'b' => $b1],
['a' => $a2, 'b' => $b2] ['a' => $a2, 'b' => $b2],
]; ];
} }
} }

View File

@ -139,7 +139,7 @@ class Montgomery extends Base
} }
$this->p = [ $this->p = [
$x instanceof BigInteger ? $this->factory->newInteger($x) : $x, $x instanceof BigInteger ? $this->factory->newInteger($x) : $x,
$y instanceof BigInteger ? $this->factory->newInteger($y) : $y $y instanceof BigInteger ? $this->factory->newInteger($y) : $y,
]; ];
} }
@ -204,7 +204,7 @@ class Montgomery extends Base
return [ return [
[$x4, $z4], [$x4, $z4],
[$x5, $z5] [$x5, $z5],
]; ];
} }

View File

@ -159,7 +159,7 @@ class Prime extends Base
} }
$this->p = [ $this->p = [
$x instanceof BigInteger ? $this->factory->newInteger($x) : $x, $x instanceof BigInteger ? $this->factory->newInteger($x) : $x,
$y instanceof BigInteger ? $this->factory->newInteger($y) : $y $y instanceof BigInteger ? $this->factory->newInteger($y) : $y,
]; ];
} }
@ -549,7 +549,7 @@ class Prime extends Base
$points[$a], // 1 $points[$a], // 1
null, // 3 null, // 3
null, // 5 null, // 5
$points[$b] // 7 $points[$b], // 7
]; ];
$comb[1] = $this->addPoint($points[$a], $points[$b]); $comb[1] = $this->addPoint($points[$a], $points[$b]);
@ -564,7 +564,7 @@ class Prime extends Base
7, /* 0 1 */ 7, /* 0 1 */
5, /* 1 -1 */ 5, /* 1 -1 */
1, /* 1 0 */ 1, /* 1 0 */
3 /* 1 1 */ 3, /* 1 1 */
]; ];
$jsf = self::getJSFPoints($scalars[$a], $scalars[$b]); $jsf = self::getJSFPoints($scalars[$a], $scalars[$b]);
@ -760,7 +760,7 @@ class Prime extends Base
$z2 = $z->multiply($z); $z2 = $z->multiply($z);
return [ return [
$x->multiply($z2), $x->multiply($z2),
$y->multiply($z2)->multiply($z) $y->multiply($z2)->multiply($z),
]; ];
} }

View File

@ -128,7 +128,7 @@ class TwistedEdwards extends Base
} }
$this->p = [ $this->p = [
$x instanceof BigInteger ? $this->factory->newInteger($x) : $x, $x instanceof BigInteger ? $this->factory->newInteger($x) : $x,
$y instanceof BigInteger ? $this->factory->newInteger($y) : $y $y instanceof BigInteger ? $this->factory->newInteger($y) : $y,
]; ];
} }
@ -182,7 +182,7 @@ class TwistedEdwards extends Base
$z = $this->one->divide($z); $z = $this->one->divide($z);
return [ return [
$x->multiply($z), $x->multiply($z),
$y->multiply($z) $y->multiply($z),
]; ];
} }

View File

@ -37,11 +37,11 @@ class secp160k1 extends KoblitzPrime
$this->basis = []; $this->basis = [];
$this->basis[] = [ $this->basis[] = [
'a' => new BigInteger('0096341F1138933BC2F505', -16), 'a' => new BigInteger('0096341F1138933BC2F505', -16),
'b' => new BigInteger('FF6E9D0418C67BB8D5F562', -16) 'b' => new BigInteger('FF6E9D0418C67BB8D5F562', -16),
]; ];
$this->basis[] = [ $this->basis[] = [
'a' => new BigInteger('01BDCB3A09AAAABEAFF4A8', -16), 'a' => new BigInteger('01BDCB3A09AAAABEAFF4A8', -16),
'b' => new BigInteger('04D12329FF0EF498EA67', -16) 'b' => new BigInteger('04D12329FF0EF498EA67', -16),
]; ];
$this->beta = $this->factory->newInteger(new BigInteger('645B7345A143464942CC46D7CF4D5D1E1E6CBB68', -16)); $this->beta = $this->factory->newInteger(new BigInteger('645B7345A143464942CC46D7CF4D5D1E1E6CBB68', -16));
} }

View File

@ -36,11 +36,11 @@ class secp192k1 extends KoblitzPrime
$this->basis = []; $this->basis = [];
$this->basis[] = [ $this->basis[] = [
'a' => new BigInteger('00B3FB3400DEC5C4ADCEB8655C', -16), 'a' => new BigInteger('00B3FB3400DEC5C4ADCEB8655C', -16),
'b' => new BigInteger('8EE96418CCF4CFC7124FDA0F', -16) 'b' => new BigInteger('8EE96418CCF4CFC7124FDA0F', -16),
]; ];
$this->basis[] = [ $this->basis[] = [
'a' => new BigInteger('01D90D03E8F096B9948B20F0A9', -16), 'a' => new BigInteger('01D90D03E8F096B9948B20F0A9', -16),
'b' => new BigInteger('42E49819ABBA9474E1083F6B', -16) 'b' => new BigInteger('42E49819ABBA9474E1083F6B', -16),
]; ];
$this->beta = $this->factory->newInteger(new BigInteger('447A96E6C647963E2F7809FEAAB46947F34B0AA3CA0BBA74', -16)); $this->beta = $this->factory->newInteger(new BigInteger('447A96E6C647963E2F7809FEAAB46947F34B0AA3CA0BBA74', -16));
} }

View File

@ -36,11 +36,11 @@ class secp224k1 extends KoblitzPrime
$this->basis = []; $this->basis = [];
$this->basis[] = [ $this->basis[] = [
'a' => new BigInteger('00B8ADF1378A6EB73409FA6C9C637D', -16), 'a' => new BigInteger('00B8ADF1378A6EB73409FA6C9C637D', -16),
'b' => new BigInteger('94730F82B358A3776A826298FA6F', -16) 'b' => new BigInteger('94730F82B358A3776A826298FA6F', -16),
]; ];
$this->basis[] = [ $this->basis[] = [
'a' => new BigInteger('01DCE8D2EC6184CAF0A972769FCC8B', -16), 'a' => new BigInteger('01DCE8D2EC6184CAF0A972769FCC8B', -16),
'b' => new BigInteger('4D2100BA3DC75AAB747CCF355DEC', -16) 'b' => new BigInteger('4D2100BA3DC75AAB747CCF355DEC', -16),
]; ];
$this->beta = $this->factory->newInteger(new BigInteger('01F178FFA4B17C89E6F73AECE2AAD57AF4C0A748B63C830947B27E04', -16)); $this->beta = $this->factory->newInteger(new BigInteger('01F178FFA4B17C89E6F73AECE2AAD57AF4C0A748B63C830947B27E04', -16));
} }

View File

@ -40,11 +40,11 @@ class secp256k1 extends KoblitzPrime
$this->basis = []; $this->basis = [];
$this->basis[] = [ $this->basis[] = [
'a' => new BigInteger('3086D221A7D46BCDE86C90E49284EB15', -16), 'a' => new BigInteger('3086D221A7D46BCDE86C90E49284EB15', -16),
'b' => new BigInteger('FF1BBC8129FEF177D790AB8056F5401B3D', -16) 'b' => new BigInteger('FF1BBC8129FEF177D790AB8056F5401B3D', -16),
]; ];
$this->basis[] = [ $this->basis[] = [
'a' => new BigInteger('114CA50F7A8E2F3F657C1108D9D44CFD8', -16), 'a' => new BigInteger('114CA50F7A8E2F3F657C1108D9D44CFD8', -16),
'b' => new BigInteger('3086D221A7D46BCDE86C90E49284EB15', -16) 'b' => new BigInteger('3086D221A7D46BCDE86C90E49284EB15', -16),
]; ];
$this->beta = $this->factory->newInteger(new BigInteger('7AE96A2B657C07106E64479EAC3434E99CF0497512F58995C1396C28719501EE', -16)); $this->beta = $this->factory->newInteger(new BigInteger('7AE96A2B657C07106E64479EAC3434E99CF0497512F58995C1396C28719501EE', -16));
} }

View File

@ -166,7 +166,7 @@ trait Common
'brainpoolP384r1' => '1.3.36.3.3.2.8.1.1.11', 'brainpoolP384r1' => '1.3.36.3.3.2.8.1.1.11',
'brainpoolP384t1' => '1.3.36.3.3.2.8.1.1.12', 'brainpoolP384t1' => '1.3.36.3.3.2.8.1.1.12',
'brainpoolP512r1' => '1.3.36.3.3.2.8.1.1.13', 'brainpoolP512r1' => '1.3.36.3.3.2.8.1.1.13',
'brainpoolP512t1' => '1.3.36.3.3.2.8.1.1.14' 'brainpoolP512t1' => '1.3.36.3.3.2.8.1.1.14',
]; ];
ASN1::loadOIDs([ ASN1::loadOIDs([
'prime-field' => '1.2.840.10045.1.1', 'prime-field' => '1.2.840.10045.1.1',
@ -175,7 +175,7 @@ trait Common
// per http://www.secg.org/SEC1-Ver-1.0.pdf#page=84, gnBasis "not used here" // per http://www.secg.org/SEC1-Ver-1.0.pdf#page=84, gnBasis "not used here"
'gnBasis' => '1.2.840.10045.1.2.3.1', // NULL 'gnBasis' => '1.2.840.10045.1.2.3.1', // NULL
'tpBasis' => '1.2.840.10045.1.2.3.2', // Trinomial 'tpBasis' => '1.2.840.10045.1.2.3.2', // Trinomial
'ppBasis' => '1.2.840.10045.1.2.3.3' // Pentanomial 'ppBasis' => '1.2.840.10045.1.2.3.3', // Pentanomial
] + self::$curveOIDs); ] + self::$curveOIDs);
} }
} }
@ -316,7 +316,7 @@ trait Common
} }
$point = [ $point = [
$curve->convertInteger(new BigInteger($x, 256)), $curve->convertInteger(new BigInteger($x, 256)),
$curve->convertInteger(new BigInteger($y, 256)) $curve->convertInteger(new BigInteger($y, 256)),
]; ];
if (!$curve->verifyPoint($point)) { if (!$curve->verifyPoint($point)) {
@ -449,14 +449,14 @@ trait Common
'version' => 'ecdpVer1', 'version' => 'ecdpVer1',
'fieldID' => [ 'fieldID' => [
'fieldType' => 'prime-field', 'fieldType' => 'prime-field',
'parameters' => $curve->getModulo() 'parameters' => $curve->getModulo(),
], ],
'curve' => [ 'curve' => [
'a' => $curve->getA()->toBytes(), 'a' => $curve->getA()->toBytes(),
'b' => $curve->getB()->toBytes() 'b' => $curve->getB()->toBytes(),
], ],
'base' => "\4" . $x . $y, 'base' => "\4" . $x . $y,
'order' => $order 'order' => $order,
]; ];
return $returnArray ? return $returnArray ?
@ -480,7 +480,7 @@ trait Common
$modulo = [ $modulo = [
'k1' => new BigInteger($modulo[2]), 'k1' => new BigInteger($modulo[2]),
'k2' => new BigInteger($modulo[1]), 'k2' => new BigInteger($modulo[1]),
'k3' => new BigInteger($modulo[0]) 'k3' => new BigInteger($modulo[0]),
]; ];
$modulo = ASN1::encodeDER($modulo, Maps\Pentanomial::MAP); $modulo = ASN1::encodeDER($modulo, Maps\Pentanomial::MAP);
$modulo = new ASN1\Element($modulo); $modulo = new ASN1\Element($modulo);
@ -488,7 +488,7 @@ trait Common
$params = ASN1::encodeDER([ $params = ASN1::encodeDER([
'm' => new BigInteger($m), 'm' => new BigInteger($m),
'basis' => $basis, 'basis' => $basis,
'parameters' => $modulo 'parameters' => $modulo,
], Maps\Characteristic_two::MAP); ], Maps\Characteristic_two::MAP);
$params = new ASN1\Element($params); $params = new ASN1\Element($params);
$a = ltrim($curve->getA()->toBytes(), "\0"); $a = ltrim($curve->getA()->toBytes(), "\0");
@ -503,14 +503,14 @@ trait Common
'version' => 'ecdpVer1', 'version' => 'ecdpVer1',
'fieldID' => [ 'fieldID' => [
'fieldType' => 'characteristic-two-field', 'fieldType' => 'characteristic-two-field',
'parameters' => $params 'parameters' => $params,
], ],
'curve' => [ 'curve' => [
'a' => $a, 'a' => $a,
'b' => $b 'b' => $b,
], ],
'base' => "\4" . $x . $y, 'base' => "\4" . $x . $y,
'order' => $order 'order' => $order,
]; ];
return $returnArray ? return $returnArray ?

View File

@ -42,7 +42,7 @@ abstract class OpenSSH extends Progenitor
'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp256',
'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp384',
'ecdsa-sha2-nistp521', 'ecdsa-sha2-nistp521',
'ssh-ed25519' 'ssh-ed25519',
]; ];
/** /**
@ -73,7 +73,7 @@ abstract class OpenSSH extends Progenitor
'curve' => $curve, 'curve' => $curve,
'dA' => $privateKey, 'dA' => $privateKey,
'QA' => self::extractPoint("\0$publicKey", $curve), 'QA' => self::extractPoint("\0$publicKey", $curve),
'comment' => $comment 'comment' => $comment,
]; ];
} }
@ -95,7 +95,7 @@ abstract class OpenSSH extends Progenitor
return [ return [
'curve' => $curve, 'curve' => $curve,
'QA' => $qa, 'QA' => $qa,
'comment' => $parsed['comment'] 'comment' => $parsed['comment'],
]; ];
} }

View File

@ -178,7 +178,7 @@ abstract class PKCS1 extends Progenitor
'version' => 'ecPrivkeyVer1', 'version' => 'ecPrivkeyVer1',
'privateKey' => $privateKey->toBytes(), 'privateKey' => $privateKey->toBytes(),
'parameters' => new ASN1\Element(self::encodeParameters($curve)), 'parameters' => new ASN1\Element(self::encodeParameters($curve)),
'publicKey' => "\0" . $publicKey 'publicKey' => "\0" . $publicKey,
]; ];
$key = ASN1::encodeDER($key, Maps\ECPrivateKey::MAP); $key = ASN1::encodeDER($key, Maps\ECPrivateKey::MAP);

View File

@ -229,7 +229,7 @@ abstract class PKCS8 extends Progenitor
'version' => 'ecPrivkeyVer1', 'version' => 'ecPrivkeyVer1',
'privateKey' => $privateKey->toBytes(), 'privateKey' => $privateKey->toBytes(),
//'parameters' => $params, //'parameters' => $params,
'publicKey' => "\0" . $publicKey 'publicKey' => "\0" . $publicKey,
]; ];
$key = ASN1::encodeDER($key, Maps\ECPrivateKey::MAP); $key = ASN1::encodeDER($key, Maps\ECPrivateKey::MAP);

View File

@ -47,7 +47,7 @@ abstract class PuTTY extends Progenitor
'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp256',
'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp384',
'ecdsa-sha2-nistp521', 'ecdsa-sha2-nistp521',
'ssh-ed25519' 'ssh-ed25519',
]; ];
/** /**

View File

@ -178,7 +178,7 @@ abstract class XML
} }
$point = [ $point = [
$curve->convertInteger(new BigInteger($x->item(0)->getAttribute('Value'))), $curve->convertInteger(new BigInteger($x->item(0)->getAttribute('Value'))),
$curve->convertInteger(new BigInteger($y->item(0)->getAttribute('Value'))) $curve->convertInteger(new BigInteger($y->item(0)->getAttribute('Value'))),
]; ];
if (!$curve->verifyPoint($point)) { if (!$curve->verifyPoint($point)) {
throw new \RuntimeException('Unable to verify that point exists on curve'); throw new \RuntimeException('Unable to verify that point exists on curve');
@ -225,7 +225,7 @@ abstract class XML
'gnb' => ['fieldid/gnb/m'], 'gnb' => ['fieldid/gnb/m'],
'tnb' => ['fieldid/tnb/k'], 'tnb' => ['fieldid/tnb/k'],
'pnb' => ['fieldid/pnb/k1', 'fieldid/pnb/k2', 'fieldid/pnb/k3'], 'pnb' => ['fieldid/pnb/k1', 'fieldid/pnb/k2', 'fieldid/pnb/k3'],
'unknown' => [] 'unknown' => [],
]; ];
foreach ($fieldTypes as $type => $queries) { foreach ($fieldTypes as $type => $queries) {
@ -275,7 +275,7 @@ abstract class XML
{ {
$fieldTypes = [ $fieldTypes = [
'prime-field' => ['primefieldparamstype/p'], 'prime-field' => ['primefieldparamstype/p'],
'unknown' => [] 'unknown' => [],
]; ];
foreach ($fieldTypes as $type => $queries) { foreach ($fieldTypes as $type => $queries) {

View File

@ -58,7 +58,7 @@ abstract class SSH2
return [ return [
'r' => $result[0], 'r' => $result[0],
's' => $result[1] 's' => $result[1],
]; ];
} }

View File

@ -389,7 +389,7 @@ class Hash
'capacity' => 1600 - $this->blockSize, 'capacity' => 1600 - $this->blockSize,
'rate' => $this->blockSize, 'rate' => $this->blockSize,
'length' => $this->length, 'length' => $this->length,
'padding' => $this->paddingType 'padding' => $this->paddingType,
]; ];
$hash = ['phpseclib3\Crypt\Hash', PHP_INT_SIZE == 8 ? 'sha3_64' : 'sha3_32']; $hash = ['phpseclib3\Crypt\Hash', PHP_INT_SIZE == 8 ? 'sha3_64' : 'sha3_32'];
} }
@ -403,11 +403,11 @@ class Hash
$initial = $hash == 'sha512/256' ? $initial = $hash == 'sha512/256' ?
[ [
'22312194FC2BF72C', '9F555FA3C84C64C2', '2393B86B6F53B151', '963877195940EABD', '22312194FC2BF72C', '9F555FA3C84C64C2', '2393B86B6F53B151', '963877195940EABD',
'96283EE2A88EFFE3', 'BE5E1E2553863992', '2B0199FC2C85B8AA', '0EB72DDC81C52CA2' '96283EE2A88EFFE3', 'BE5E1E2553863992', '2B0199FC2C85B8AA', '0EB72DDC81C52CA2',
] : ] :
[ [
'8C3D37C819544DA2', '73E1996689DCD4D6', '1DFAB7AE32FF9C82', '679DD514582F9FCF', '8C3D37C819544DA2', '73E1996689DCD4D6', '1DFAB7AE32FF9C82', '679DD514582F9FCF',
'0F6D2B697BD44DA8', '77E36F7304C48942', '3F9D85A86A1D36C8', '1112E6AD91D692A1' '0F6D2B697BD44DA8', '77E36F7304C48942', '3F9D85A86A1D36C8', '1112E6AD91D692A1',
]; ];
for ($i = 0; $i < 8; $i++) { for ($i = 0; $i < 8; $i++) {
$initial[$i] = new BigInteger($initial[$i], 16); $initial[$i] = new BigInteger($initial[$i], 16);
@ -936,7 +936,7 @@ class Hash
[[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]], [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]],
[[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]], [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]],
[[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]], [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]],
[[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]] [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]],
]; ];
$p = str_split($p, $block_size); $p = str_split($p, $block_size);
@ -982,7 +982,7 @@ class Hash
[36, 44, 6, 55, 20], [36, 44, 6, 55, 20],
[ 3, 10, 43, 25, 39], [ 3, 10, 43, 25, 39],
[41, 45, 15, 21, 8], [41, 45, 15, 21, 8],
[18, 2, 61, 56, 14] [18, 2, 61, 56, 14],
]; ];
// the standards give these constants in hexadecimal notation. it's tempting to want to use // the standards give these constants in hexadecimal notation. it's tempting to want to use
@ -1012,7 +1012,7 @@ class Hash
[-2147483648, -2147450751], [-2147483648, -2147450751],
[-2147483648, 32896], [-2147483648, 32896],
[0, -2147483647], [0, -2147483647],
[-2147483648, -2147450872] [-2147483648, -2147450872],
]; ];
for ($round = 0; $round < 24; $round++) { for ($round = 0; $round < 24; $round++) {
@ -1021,7 +1021,7 @@ class Hash
for ($i = 0; $i < 5; $i++) { for ($i = 0; $i < 5; $i++) {
$parity[] = [ $parity[] = [
$s[0][$i][0] ^ $s[1][$i][0] ^ $s[2][$i][0] ^ $s[3][$i][0] ^ $s[4][$i][0], $s[0][$i][0] ^ $s[1][$i][0] ^ $s[2][$i][0] ^ $s[3][$i][0] ^ $s[4][$i][0],
$s[0][$i][1] ^ $s[1][$i][1] ^ $s[2][$i][1] ^ $s[3][$i][1] ^ $s[4][$i][1] $s[0][$i][1] ^ $s[1][$i][1] ^ $s[2][$i][1] ^ $s[3][$i][1] ^ $s[4][$i][1],
]; ];
$rotated[] = static::rotateLeft32($parity[$i], 1); $rotated[] = static::rotateLeft32($parity[$i], 1);
} }
@ -1031,7 +1031,7 @@ class Hash
[$parity[0][0] ^ $rotated[2][0], $parity[0][1] ^ $rotated[2][1]], [$parity[0][0] ^ $rotated[2][0], $parity[0][1] ^ $rotated[2][1]],
[$parity[1][0] ^ $rotated[3][0], $parity[1][1] ^ $rotated[3][1]], [$parity[1][0] ^ $rotated[3][0], $parity[1][1] ^ $rotated[3][1]],
[$parity[2][0] ^ $rotated[4][0], $parity[2][1] ^ $rotated[4][1]], [$parity[2][0] ^ $rotated[4][0], $parity[2][1] ^ $rotated[4][1]],
[$parity[3][0] ^ $rotated[0][0], $parity[3][1] ^ $rotated[0][1]] [$parity[3][0] ^ $rotated[0][0], $parity[3][1] ^ $rotated[0][1]],
]; ];
for ($i = 0; $i < 5; $i++) { for ($i = 0; $i < 5; $i++) {
for ($j = 0; $j < 5; $j++) { for ($j = 0; $j < 5; $j++) {
@ -1053,23 +1053,23 @@ class Hash
for ($i = 0; $i < 5; $i++) { for ($i = 0; $i < 5; $i++) {
$s[$i][0] = [ $s[$i][0] = [
$st[$i][0][0] ^ (~$st[$i][1][0] & $st[$i][2][0]), $st[$i][0][0] ^ (~$st[$i][1][0] & $st[$i][2][0]),
$st[$i][0][1] ^ (~$st[$i][1][1] & $st[$i][2][1]) $st[$i][0][1] ^ (~$st[$i][1][1] & $st[$i][2][1]),
]; ];
$s[$i][1] = [ $s[$i][1] = [
$st[$i][1][0] ^ (~$st[$i][2][0] & $st[$i][3][0]), $st[$i][1][0] ^ (~$st[$i][2][0] & $st[$i][3][0]),
$st[$i][1][1] ^ (~$st[$i][2][1] & $st[$i][3][1]) $st[$i][1][1] ^ (~$st[$i][2][1] & $st[$i][3][1]),
]; ];
$s[$i][2] = [ $s[$i][2] = [
$st[$i][2][0] ^ (~$st[$i][3][0] & $st[$i][4][0]), $st[$i][2][0] ^ (~$st[$i][3][0] & $st[$i][4][0]),
$st[$i][2][1] ^ (~$st[$i][3][1] & $st[$i][4][1]) $st[$i][2][1] ^ (~$st[$i][3][1] & $st[$i][4][1]),
]; ];
$s[$i][3] = [ $s[$i][3] = [
$st[$i][3][0] ^ (~$st[$i][4][0] & $st[$i][0][0]), $st[$i][3][0] ^ (~$st[$i][4][0] & $st[$i][0][0]),
$st[$i][3][1] ^ (~$st[$i][4][1] & $st[$i][0][1]) $st[$i][3][1] ^ (~$st[$i][4][1] & $st[$i][0][1]),
]; ];
$s[$i][4] = [ $s[$i][4] = [
$st[$i][4][0] ^ (~$st[$i][0][0] & $st[$i][1][0]), $st[$i][4][0] ^ (~$st[$i][0][0] & $st[$i][1][0]),
$st[$i][4][1] ^ (~$st[$i][0][1] & $st[$i][1][1]) $st[$i][4][1] ^ (~$st[$i][0][1] & $st[$i][1][1]),
]; ];
} }
@ -1093,7 +1093,7 @@ class Hash
return [ return [
($hi << $shift) | (($lo >> (32 - $shift)) & (1 << $shift) - 1), ($hi << $shift) | (($lo >> (32 - $shift)) & (1 << $shift) - 1),
($lo << $shift) | (($hi >> (32 - $shift)) & (1 << $shift) - 1) ($lo << $shift) | (($hi >> (32 - $shift)) & (1 << $shift) - 1),
]; ];
} }
@ -1115,7 +1115,7 @@ class Hash
[0, 0, 0, 0, 0], [0, 0, 0, 0, 0],
[0, 0, 0, 0, 0], [0, 0, 0, 0, 0],
[0, 0, 0, 0, 0], [0, 0, 0, 0, 0],
[0, 0, 0, 0, 0] [0, 0, 0, 0, 0],
]; ];
$p = str_split($p, $block_size); $p = str_split($p, $block_size);
@ -1160,7 +1160,7 @@ class Hash
[36, 44, 6, 55, 20], [36, 44, 6, 55, 20],
[ 3, 10, 43, 25, 39], [ 3, 10, 43, 25, 39],
[41, 45, 15, 21, 8], [41, 45, 15, 21, 8],
[18, 2, 61, 56, 14] [18, 2, 61, 56, 14],
]; ];
static $roundConstants = [ static $roundConstants = [
@ -1187,7 +1187,7 @@ class Hash
-9223372034707259263, -9223372034707259263,
-9223372036854742912, -9223372036854742912,
2147483649, 2147483649,
-9223372034707259384 -9223372034707259384,
]; ];
for ($round = 0; $round < 24; $round++) { for ($round = 0; $round < 24; $round++) {
@ -1201,7 +1201,7 @@ class Hash
$parity[0] ^ static::rotateLeft64($parity[2], 1), $parity[0] ^ static::rotateLeft64($parity[2], 1),
$parity[1] ^ static::rotateLeft64($parity[3], 1), $parity[1] ^ static::rotateLeft64($parity[3], 1),
$parity[2] ^ static::rotateLeft64($parity[4], 1), $parity[2] ^ static::rotateLeft64($parity[4], 1),
$parity[3] ^ static::rotateLeft64($parity[0], 1) $parity[3] ^ static::rotateLeft64($parity[0], 1),
]; ];
for ($i = 0; $i < 5; $i++) { for ($i = 0; $i < 5; $i++) {
for ($j = 0; $j < 5; $j++) { for ($j = 0; $j < 5; $j++) {
@ -1225,7 +1225,7 @@ class Hash
$st[$i][1] ^ (~$st[$i][2] & $st[$i][3]), $st[$i][1] ^ (~$st[$i][2] & $st[$i][3]),
$st[$i][2] ^ (~$st[$i][3] & $st[$i][4]), $st[$i][2] ^ (~$st[$i][3] & $st[$i][4]),
$st[$i][3] ^ (~$st[$i][4] & $st[$i][0]), $st[$i][3] ^ (~$st[$i][4] & $st[$i][0]),
$st[$i][4] ^ (~$st[$i][0] & $st[$i][1]) $st[$i][4] ^ (~$st[$i][0] & $st[$i][1]),
]; ];
} }
@ -1272,7 +1272,7 @@ class Hash
'ca273eceea26619c', 'd186b8c721c0c207', 'eada7dd6cde0eb1e', 'f57d4f7fee6ed178', 'ca273eceea26619c', 'd186b8c721c0c207', 'eada7dd6cde0eb1e', 'f57d4f7fee6ed178',
'06f067aa72176fba', '0a637dc5a2c898a6', '113f9804bef90dae', '1b710b35131c471b', '06f067aa72176fba', '0a637dc5a2c898a6', '113f9804bef90dae', '1b710b35131c471b',
'28db77f523047d84', '32caab7b40c72493', '3c9ebe0a15c9bebc', '431d67c49c100d4c', '28db77f523047d84', '32caab7b40c72493', '3c9ebe0a15c9bebc', '431d67c49c100d4c',
'4cc5d4becb3e42b6', '597f299cfc657e2a', '5fcb6fab3ad6faec', '6c44198c4a475817' '4cc5d4becb3e42b6', '597f299cfc657e2a', '5fcb6fab3ad6faec', '6c44198c4a475817',
]; ];
for ($i = 0; $i < 80; $i++) { for ($i = 0; $i < 80; $i++) {
@ -1303,14 +1303,14 @@ class Hash
$temp = [ $temp = [
$w[$i - 15]->bitwise_rightRotate(1), $w[$i - 15]->bitwise_rightRotate(1),
$w[$i - 15]->bitwise_rightRotate(8), $w[$i - 15]->bitwise_rightRotate(8),
$w[$i - 15]->bitwise_rightShift(7) $w[$i - 15]->bitwise_rightShift(7),
]; ];
$s0 = $temp[0]->bitwise_xor($temp[1]); $s0 = $temp[0]->bitwise_xor($temp[1]);
$s0 = $s0->bitwise_xor($temp[2]); $s0 = $s0->bitwise_xor($temp[2]);
$temp = [ $temp = [
$w[$i - 2]->bitwise_rightRotate(19), $w[$i - 2]->bitwise_rightRotate(19),
$w[$i - 2]->bitwise_rightRotate(61), $w[$i - 2]->bitwise_rightRotate(61),
$w[$i - 2]->bitwise_rightShift(6) $w[$i - 2]->bitwise_rightShift(6),
]; ];
$s1 = $temp[0]->bitwise_xor($temp[1]); $s1 = $temp[0]->bitwise_xor($temp[1]);
$s1 = $s1->bitwise_xor($temp[2]); $s1 = $s1->bitwise_xor($temp[2]);
@ -1335,14 +1335,14 @@ class Hash
$temp = [ $temp = [
$a->bitwise_rightRotate(28), $a->bitwise_rightRotate(28),
$a->bitwise_rightRotate(34), $a->bitwise_rightRotate(34),
$a->bitwise_rightRotate(39) $a->bitwise_rightRotate(39),
]; ];
$s0 = $temp[0]->bitwise_xor($temp[1]); $s0 = $temp[0]->bitwise_xor($temp[1]);
$s0 = $s0->bitwise_xor($temp[2]); $s0 = $s0->bitwise_xor($temp[2]);
$temp = [ $temp = [
$a->bitwise_and($b), $a->bitwise_and($b),
$a->bitwise_and($c), $a->bitwise_and($c),
$b->bitwise_and($c) $b->bitwise_and($c),
]; ];
$maj = $temp[0]->bitwise_xor($temp[1]); $maj = $temp[0]->bitwise_xor($temp[1]);
$maj = $maj->bitwise_xor($temp[2]); $maj = $maj->bitwise_xor($temp[2]);
@ -1351,13 +1351,13 @@ class Hash
$temp = [ $temp = [
$e->bitwise_rightRotate(14), $e->bitwise_rightRotate(14),
$e->bitwise_rightRotate(18), $e->bitwise_rightRotate(18),
$e->bitwise_rightRotate(41) $e->bitwise_rightRotate(41),
]; ];
$s1 = $temp[0]->bitwise_xor($temp[1]); $s1 = $temp[0]->bitwise_xor($temp[1]);
$s1 = $s1->bitwise_xor($temp[2]); $s1 = $s1->bitwise_xor($temp[2]);
$temp = [ $temp = [
$e->bitwise_and($f), $e->bitwise_and($f),
$g->bitwise_and($e->bitwise_not()) $g->bitwise_and($e->bitwise_not()),
]; ];
$ch = $temp[0]->bitwise_xor($temp[1]); $ch = $temp[0]->bitwise_xor($temp[1]);
$t1 = $h->add($s1); $t1 = $h->add($s1);
@ -1384,7 +1384,7 @@ class Hash
$hash[4]->add($e), $hash[4]->add($e),
$hash[5]->add($f), $hash[5]->add($f),
$hash[6]->add($g), $hash[6]->add($g),
$hash[7]->add($h) $hash[7]->add($h),
]; ];
} }

View File

@ -182,7 +182,7 @@ class RC2 extends BlockCipher
0x0D, 0x38, 0x34, 0x1B, 0xAB, 0x33, 0xFF, 0xB0, 0x0D, 0x38, 0x34, 0x1B, 0xAB, 0x33, 0xFF, 0xB0,
0xBB, 0x48, 0x0C, 0x5F, 0xB9, 0xB1, 0xCD, 0x2E, 0xBB, 0x48, 0x0C, 0x5F, 0xB9, 0xB1, 0xCD, 0x2E,
0xC5, 0xF3, 0xDB, 0x47, 0xE5, 0xA5, 0x9C, 0x77, 0xC5, 0xF3, 0xDB, 0x47, 0xE5, 0xA5, 0x9C, 0x77,
0x0A, 0xA6, 0x20, 0x68, 0xFE, 0x7F, 0xC1, 0xAD 0x0A, 0xA6, 0x20, 0x68, 0xFE, 0x7F, 0xC1, 0xAD,
]; ];
/** /**
@ -223,7 +223,7 @@ class RC2 extends BlockCipher
0xA1, 0xD4, 0xDD, 0xC4, 0x56, 0xF4, 0xD2, 0x77, 0xA1, 0xD4, 0xDD, 0xC4, 0x56, 0xF4, 0xD2, 0x77,
0x81, 0x09, 0x82, 0x33, 0x9F, 0x07, 0x86, 0x75, 0x81, 0x09, 0x82, 0x33, 0x9F, 0x07, 0x86, 0x75,
0x38, 0x4E, 0x69, 0xF1, 0xAD, 0x23, 0x73, 0x87, 0x38, 0x4E, 0x69, 0xF1, 0xAD, 0x23, 0x73, 0x87,
0x70, 0x02, 0xC2, 0x1E, 0xB8, 0x0A, 0xFC, 0xE6 0x70, 0x02, 0xC2, 0x1E, 0xB8, 0x0A, 0xFC, 0xE6,
]; ];
/** /**
@ -599,7 +599,7 @@ class RC2 extends BlockCipher
[ [
'init_crypt' => $init_crypt, 'init_crypt' => $init_crypt,
'encrypt_block' => $encrypt_block, 'encrypt_block' => $encrypt_block,
'decrypt_block' => $decrypt_block 'decrypt_block' => $decrypt_block,
] ]
); );
} }

View File

@ -228,7 +228,7 @@ class RC4 extends StreamCipher
$this->stream[self::DECRYPT] = $this->stream[self::ENCRYPT] = [ $this->stream[self::DECRYPT] = $this->stream[self::ENCRYPT] = [
0, // index $i 0, // index $i
0, // index $j 0, // index $j
$keyStream $keyStream,
]; ];
} }

View File

@ -339,7 +339,7 @@ abstract class RSA extends AsymmetricKey
$exponents = $coefficients = $primes = []; $exponents = $coefficients = $primes = [];
$lcm = [ $lcm = [
'top' => clone self::$one, 'top' => clone self::$one,
'bottom' => false 'bottom' => false,
]; ];
do { do {
@ -794,7 +794,7 @@ abstract class RSA extends AsymmetricKey
$masks = [ $masks = [
self::ENCRYPTION_OAEP, self::ENCRYPTION_OAEP,
self::ENCRYPTION_PKCS1, self::ENCRYPTION_PKCS1,
self::ENCRYPTION_NONE self::ENCRYPTION_NONE,
]; ];
$numSelected = 0; $numSelected = 0;
$selected = 0; $selected = 0;
@ -812,7 +812,7 @@ abstract class RSA extends AsymmetricKey
$masks = [ $masks = [
self::SIGNATURE_PSS, self::SIGNATURE_PSS,
self::SIGNATURE_RELAXED_PKCS1, self::SIGNATURE_RELAXED_PKCS1,
self::SIGNATURE_PKCS1 self::SIGNATURE_PKCS1,
]; ];
$numSelected = 0; $numSelected = 0;
$selected = 0; $selected = 0;

View File

@ -83,7 +83,7 @@ abstract class OpenSSH extends Progenitor
'isPublicKey' => true, 'isPublicKey' => true,
'modulus' => $modulus, 'modulus' => $modulus,
'publicExponent' => $publicExponent, 'publicExponent' => $publicExponent,
'comment' => $parsed['comment'] 'comment' => $parsed['comment'],
]; ];
} }

View File

@ -72,7 +72,7 @@ abstract class PKCS1 extends Progenitor
'privateExponent' => $key['privateExponent'], 'privateExponent' => $key['privateExponent'],
'primes' => [1 => $key['prime1'], $key['prime2']], 'primes' => [1 => $key['prime1'], $key['prime2']],
'exponents' => [1 => $key['exponent1'], $key['exponent2']], 'exponents' => [1 => $key['exponent1'], $key['exponent2']],
'coefficients' => [2 => $key['coefficient']] 'coefficients' => [2 => $key['coefficient']],
]; ];
if ($key['version'] == 'multi') { if ($key['version'] == 'multi') {
foreach ($key['otherPrimeInfos'] as $primeInfo) { foreach ($key['otherPrimeInfos'] as $primeInfo) {
@ -118,13 +118,13 @@ abstract class PKCS1 extends Progenitor
'prime2' => $primes[2], 'prime2' => $primes[2],
'exponent1' => $exponents[1], 'exponent1' => $exponents[1],
'exponent2' => $exponents[2], 'exponent2' => $exponents[2],
'coefficient' => $coefficients[2] 'coefficient' => $coefficients[2],
]; ];
for ($i = 3; $i <= $num_primes; $i++) { for ($i = 3; $i <= $num_primes; $i++) {
$key['otherPrimeInfos'][] = [ $key['otherPrimeInfos'][] = [
'prime' => $primes[$i], 'prime' => $primes[$i],
'exponent' => $exponents[$i], 'exponent' => $exponents[$i],
'coefficient' => $coefficients[$i] 'coefficient' => $coefficients[$i],
]; ];
} }
@ -140,7 +140,7 @@ abstract class PKCS1 extends Progenitor
{ {
$key = [ $key = [
'modulus' => $n, 'modulus' => $n,
'publicExponent' => $e 'publicExponent' => $e,
]; ];
$key = ASN1::encodeDER($key, Maps\RSAPublicKey::MAP); $key = ASN1::encodeDER($key, Maps\RSAPublicKey::MAP);

View File

@ -84,7 +84,7 @@ abstract class PSS extends Progenitor
'id-sha512/224' => '2.16.840.1.101.3.4.2.5', 'id-sha512/224' => '2.16.840.1.101.3.4.2.5',
'id-sha512/256' => '2.16.840.1.101.3.4.2.6', 'id-sha512/256' => '2.16.840.1.101.3.4.2.6',
'id-mgf1' => '1.2.840.113549.1.1.8' 'id-mgf1' => '1.2.840.113549.1.1.8',
]); ]);
self::$oidsLoaded = true; self::$oidsLoaded = true;
} }
@ -130,7 +130,7 @@ abstract class PSS extends Progenitor
} else { } else {
$params['maskGenAlgorithm'] = [ $params['maskGenAlgorithm'] = [
'algorithm' => 'id-mgf1', 'algorithm' => 'id-mgf1',
'parameters' => ['algorithm' => 'id-sha1'] 'parameters' => ['algorithm' => 'id-sha1'],
]; ];
} }
@ -202,7 +202,7 @@ abstract class PSS extends Progenitor
source: https://tools.ietf.org/html/rfc4055#page-9 source: https://tools.ietf.org/html/rfc4055#page-9
*/ */
$params = [ $params = [
'trailerField' => new BigInteger(1) 'trailerField' => new BigInteger(1),
]; ];
if (isset($options['hash'])) { if (isset($options['hash'])) {
$params['hashAlgorithm']['algorithm'] = 'id-' . $options['hash']; $params['hashAlgorithm']['algorithm'] = 'id-' . $options['hash'];
@ -212,7 +212,7 @@ abstract class PSS extends Progenitor
$temp = ASN1::encodeDER($temp, Maps\HashAlgorithm::MAP); $temp = ASN1::encodeDER($temp, Maps\HashAlgorithm::MAP);
$params['maskGenAlgorithm'] = [ $params['maskGenAlgorithm'] = [
'algorithm' => 'id-mgf1', 'algorithm' => 'id-mgf1',
'parameters' => new ASN1\Element($temp) 'parameters' => new ASN1\Element($temp),
]; ];
} }
if (isset($options['saltLength'])) { if (isset($options['saltLength'])) {

View File

@ -73,7 +73,7 @@ abstract class Raw
} elseif (isset($key['p']) && isset($key['q'])) { } elseif (isset($key['p']) && isset($key['q'])) {
$indices = [ $indices = [
['p', 'q'], ['p', 'q'],
['prime1', 'prime2'] ['prime1', 'prime2'],
]; ];
foreach ($indices as $index) { foreach ($indices as $index) {
[$i0, $i1] = $index; [$i0, $i1] = $index;
@ -88,7 +88,7 @@ abstract class Raw
} else { } else {
$indices = [ $indices = [
['dp', 'dq'], ['dp', 'dq'],
['exponent1', 'exponent2'] ['exponent1', 'exponent2'],
]; ];
foreach ($indices as $index) { foreach ($indices as $index) {
[$i0, $i1] = $index; [$i0, $i1] = $index;
@ -157,7 +157,7 @@ abstract class Raw
}, $exponents), }, $exponents),
'coefficients' => array_map(function ($var) { 'coefficients' => array_map(function ($var) {
return clone $var; return clone $var;
}, $coefficients) }, $coefficients),
]); ]);
} }

View File

@ -54,7 +54,7 @@ abstract class XML
'isPublicKey' => false, 'isPublicKey' => false,
'primes' => [], 'primes' => [],
'exponents' => [], 'exponents' => [],
'coefficients' => [] 'coefficients' => [],
]; ];
$use_errors = libxml_use_internal_errors(true); $use_errors = libxml_use_internal_errors(true);

View File

@ -100,7 +100,7 @@ class PrivateKey extends RSA implements Common\PrivateKey
if (!static::$enableBlinding) { if (!static::$enableBlinding) {
$m_i = [ $m_i = [
1 => $x->modPow($this->exponents[1], $this->primes[1]), 1 => $x->modPow($this->exponents[1], $this->primes[1]),
2 => $x->modPow($this->exponents[2], $this->primes[2]) 2 => $x->modPow($this->exponents[2], $this->primes[2]),
]; ];
$h = $m_i[1]->subtract($m_i[2]); $h = $m_i[1]->subtract($m_i[2]);
$h = $h->multiply($this->coefficients[2]); $h = $h->multiply($this->coefficients[2]);
@ -131,7 +131,7 @@ class PrivateKey extends RSA implements Common\PrivateKey
$m_i = [ $m_i = [
1 => $this->blind($x, $r, 1), 1 => $this->blind($x, $r, 1),
2 => $this->blind($x, $r, 2) 2 => $this->blind($x, $r, 2),
]; ];
$h = $m_i[1]->subtract($m_i[2]); $h = $m_i[1]->subtract($m_i[2]);
$h = $h->multiply($this->coefficients[2]); $h = $h->multiply($this->coefficients[2]);
@ -460,7 +460,7 @@ class PrivateKey extends RSA implements Common\PrivateKey
$options += [ $options += [
'hash' => $this->hash->getHash(), 'hash' => $this->hash->getHash(),
'MGFHash' => $this->mgfHash->getHash(), 'MGFHash' => $this->mgfHash->getHash(),
'saltLength' => $this->getSaltLength() 'saltLength' => $this->getSaltLength(),
]; ];
} else { } else {
throw new UnsupportedFormatException('The PSS format can only be used when the signature method has been explicitly set to PSS'); throw new UnsupportedFormatException('The PSS format can only be used when the signature method has been explicitly set to PSS');

View File

@ -459,7 +459,7 @@ class PublicKey extends RSA implements Common\PublicKey
$options += [ $options += [
'hash' => $this->hash->getHash(), 'hash' => $this->hash->getHash(),
'MGFHash' => $this->mgfHash->getHash(), 'MGFHash' => $this->mgfHash->getHash(),
'saltLength' => $this->getSaltLength() 'saltLength' => $this->getSaltLength(),
]; ];
} else { } else {
throw new UnsupportedFormatException('The PSS format can only be used when the signature method has been explicitly set to PSS'); throw new UnsupportedFormatException('The PSS format can only be used when the signature method has been explicitly set to PSS');

View File

@ -487,7 +487,7 @@ class Rijndael extends BlockCipher
0x6C000000, 0xD8000000, 0xAB000000, 0x4D000000, 0x9A000000, 0x6C000000, 0xD8000000, 0xAB000000, 0x4D000000, 0x9A000000,
0x2F000000, 0x5E000000, 0xBC000000, 0x63000000, 0xC6000000, 0x2F000000, 0x5E000000, 0xBC000000, 0x63000000, 0xC6000000,
0x97000000, 0x35000000, 0x6A000000, 0xD4000000, 0xB3000000, 0x97000000, 0x35000000, 0x6A000000, 0xD4000000, 0xB3000000,
0x7D000000, 0xFA000000, 0xEF000000, 0xC5000000, 0x91000000 0x7D000000, 0xFA000000, 0xEF000000, 0xC5000000, 0x91000000,
]; ];
if (isset($this->kl['key']) && $this->key === $this->kl['key'] && $this->key_length === $this->kl['key_length'] && $this->block_size === $this->kl['block_size']) { if (isset($this->kl['key']) && $this->key === $this->kl['key'] && $this->key_length === $this->kl['key_length'] && $this->block_size === $this->kl['block_size']) {
@ -651,7 +651,7 @@ class Rijndael extends BlockCipher
0xE1E138D9, 0xF8F813EB, 0x9898B32B, 0x11113322, 0x6969BBD2, 0xD9D970A9, 0x8E8E8907, 0x9494A733, 0xE1E138D9, 0xF8F813EB, 0x9898B32B, 0x11113322, 0x6969BBD2, 0xD9D970A9, 0x8E8E8907, 0x9494A733,
0x9B9BB62D, 0x1E1E223C, 0x87879215, 0xE9E920C9, 0xCECE4987, 0x5555FFAA, 0x28287850, 0xDFDF7AA5, 0x9B9BB62D, 0x1E1E223C, 0x87879215, 0xE9E920C9, 0xCECE4987, 0x5555FFAA, 0x28287850, 0xDFDF7AA5,
0x8C8C8F03, 0xA1A1F859, 0x89898009, 0x0D0D171A, 0xBFBFDA65, 0xE6E631D7, 0x4242C684, 0x6868B8D0, 0x8C8C8F03, 0xA1A1F859, 0x89898009, 0x0D0D171A, 0xBFBFDA65, 0xE6E631D7, 0x4242C684, 0x6868B8D0,
0x4141C382, 0x9999B029, 0x2D2D775A, 0x0F0F111E, 0xB0B0CB7B, 0x5454FCA8, 0xBBBBD66D, 0x16163A2C 0x4141C382, 0x9999B029, 0x2D2D775A, 0x0F0F111E, 0xB0B0CB7B, 0x5454FCA8, 0xBBBBD66D, 0x16163A2C,
]); ]);
foreach ($t3 as $t3i) { foreach ($t3 as $t3i) {
@ -683,8 +683,8 @@ class Rijndael extends BlockCipher
0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A, 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A,
0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E,
0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF, 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16,
] ],
]; ];
} }
return $tables; return $tables;
@ -734,7 +734,7 @@ class Rijndael extends BlockCipher
0xD7618C9A, 0xA10C7A37, 0xF8148E59, 0x133C89EB, 0xA927EECE, 0x61C935B7, 0x1CE5EDE1, 0x47B13C7A, 0xD7618C9A, 0xA10C7A37, 0xF8148E59, 0x133C89EB, 0xA927EECE, 0x61C935B7, 0x1CE5EDE1, 0x47B13C7A,
0xD2DF599C, 0xF2733F55, 0x14CE7918, 0xC737BF73, 0xF7CDEA53, 0xFDAA5B5F, 0x3D6F14DF, 0x44DB8678, 0xD2DF599C, 0xF2733F55, 0x14CE7918, 0xC737BF73, 0xF7CDEA53, 0xFDAA5B5F, 0x3D6F14DF, 0x44DB8678,
0xAFF381CA, 0x68C43EB9, 0x24342C38, 0xA3405FC2, 0x1DC37216, 0xE2250CBC, 0x3C498B28, 0x0D9541FF, 0xAFF381CA, 0x68C43EB9, 0x24342C38, 0xA3405FC2, 0x1DC37216, 0xE2250CBC, 0x3C498B28, 0x0D9541FF,
0xA8017139, 0x0CB3DE08, 0xB4E49CD8, 0x56C19064, 0xCB84617B, 0x32B670D5, 0x6C5C7448, 0xB85742D0 0xA8017139, 0x0CB3DE08, 0xB4E49CD8, 0x56C19064, 0xCB84617B, 0x32B670D5, 0x6C5C7448, 0xB85742D0,
]); ]);
foreach ($dt3 as $dt3i) { foreach ($dt3 as $dt3i) {
@ -766,8 +766,8 @@ class Rijndael extends BlockCipher
0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F, 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F,
0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF,
0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61, 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61,
0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D,
] ],
]; ];
} }
return $tables; return $tables;
@ -909,7 +909,7 @@ class Rijndael extends BlockCipher
'init_encrypt' => $init_encrypt, 'init_encrypt' => $init_encrypt,
'init_decrypt' => $init_decrypt, 'init_decrypt' => $init_decrypt,
'encrypt_block' => $encrypt_block, 'encrypt_block' => $encrypt_block,
'decrypt_block' => $decrypt_block 'decrypt_block' => $decrypt_block,
] ]
); );
} }

View File

@ -85,7 +85,7 @@ class Twofish extends BlockCipher
0x6E, 0x50, 0xDE, 0x68, 0x65, 0xBC, 0xDB, 0xF8, 0x6E, 0x50, 0xDE, 0x68, 0x65, 0xBC, 0xDB, 0xF8,
0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4, 0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4,
0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00, 0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00,
0x6F, 0x9D, 0x36, 0x42, 0x4A, 0x5E, 0xC1, 0xE0 0x6F, 0x9D, 0x36, 0x42, 0x4A, 0x5E, 0xC1, 0xE0,
]; ];
/** /**
@ -125,7 +125,7 @@ class Twofish extends BlockCipher
0x22, 0xC9, 0xC0, 0x9B, 0x89, 0xD4, 0xED, 0xAB, 0x22, 0xC9, 0xC0, 0x9B, 0x89, 0xD4, 0xED, 0xAB,
0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9, 0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9,
0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2, 0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2,
0x16, 0x25, 0x86, 0x56, 0x55, 0x09, 0xBE, 0x91 0x16, 0x25, 0x86, 0x56, 0x55, 0x09, 0xBE, 0x91,
]; ];
/** /**
@ -165,7 +165,7 @@ class Twofish extends BlockCipher
0x8F8F9E22, 0x7171A1C9, 0x9090F0C0, 0xAAAA539B, 0x0101F189, 0x8B8BE1D4, 0x4E4E8CED, 0x8E8E6FAB, 0x8F8F9E22, 0x7171A1C9, 0x9090F0C0, 0xAAAA539B, 0x0101F189, 0x8B8BE1D4, 0x4E4E8CED, 0x8E8E6FAB,
0xABABA212, 0x6F6F3EA2, 0xE6E6540D, 0xDBDBF252, 0x92927BBB, 0xB7B7B602, 0x6969CA2F, 0x3939D9A9, 0xABABA212, 0x6F6F3EA2, 0xE6E6540D, 0xDBDBF252, 0x92927BBB, 0xB7B7B602, 0x6969CA2F, 0x3939D9A9,
0xD3D30CD7, 0xA7A72361, 0xA2A2AD1E, 0xC3C399B4, 0x6C6C4450, 0x07070504, 0x04047FF6, 0x272746C2, 0xD3D30CD7, 0xA7A72361, 0xA2A2AD1E, 0xC3C399B4, 0x6C6C4450, 0x07070504, 0x04047FF6, 0x272746C2,
0xACACA716, 0xD0D07625, 0x50501386, 0xDCDCF756, 0x84841A55, 0xE1E15109, 0x7A7A25BE, 0x1313EF91 0xACACA716, 0xD0D07625, 0x50501386, 0xDCDCF756, 0x84841A55, 0xE1E15109, 0x7A7A25BE, 0x1313EF91,
]; ];
/** /**
@ -205,7 +205,7 @@ class Twofish extends BlockCipher
0x6EC1F6F6, 0x50446C6C, 0xDE5D3232, 0x68724646, 0x6526A0A0, 0xBC93CDCD, 0xDB03DADA, 0xF8C6BABA, 0x6EC1F6F6, 0x50446C6C, 0xDE5D3232, 0x68724646, 0x6526A0A0, 0xBC93CDCD, 0xDB03DADA, 0xF8C6BABA,
0xC8FA9E9E, 0xA882D6D6, 0x2BCF6E6E, 0x40507070, 0xDCEB8585, 0xFE750A0A, 0x328A9393, 0xA48DDFDF, 0xC8FA9E9E, 0xA882D6D6, 0x2BCF6E6E, 0x40507070, 0xDCEB8585, 0xFE750A0A, 0x328A9393, 0xA48DDFDF,
0xCA4C2929, 0x10141C1C, 0x2173D7D7, 0xF0CCB4B4, 0xD309D4D4, 0x5D108A8A, 0x0FE25151, 0x00000000, 0xCA4C2929, 0x10141C1C, 0x2173D7D7, 0xF0CCB4B4, 0xD309D4D4, 0x5D108A8A, 0x0FE25151, 0x00000000,
0x6F9A1919, 0x9DE01A1A, 0x368F9494, 0x42E6C7C7, 0x4AECC9C9, 0x5EFDD2D2, 0xC1AB7F7F, 0xE0D8A8A8 0x6F9A1919, 0x9DE01A1A, 0x368F9494, 0x42E6C7C7, 0x4AECC9C9, 0x5EFDD2D2, 0xC1AB7F7F, 0xE0D8A8A8,
]; ];
/** /**
@ -245,7 +245,7 @@ class Twofish extends BlockCipher
0x8F228F9E, 0x71C971A1, 0x90C090F0, 0xAA9BAA53, 0x018901F1, 0x8BD48BE1, 0x4EED4E8C, 0x8EAB8E6F, 0x8F228F9E, 0x71C971A1, 0x90C090F0, 0xAA9BAA53, 0x018901F1, 0x8BD48BE1, 0x4EED4E8C, 0x8EAB8E6F,
0xAB12ABA2, 0x6FA26F3E, 0xE60DE654, 0xDB52DBF2, 0x92BB927B, 0xB702B7B6, 0x692F69CA, 0x39A939D9, 0xAB12ABA2, 0x6FA26F3E, 0xE60DE654, 0xDB52DBF2, 0x92BB927B, 0xB702B7B6, 0x692F69CA, 0x39A939D9,
0xD3D7D30C, 0xA761A723, 0xA21EA2AD, 0xC3B4C399, 0x6C506C44, 0x07040705, 0x04F6047F, 0x27C22746, 0xD3D7D30C, 0xA761A723, 0xA21EA2AD, 0xC3B4C399, 0x6C506C44, 0x07040705, 0x04F6047F, 0x27C22746,
0xAC16ACA7, 0xD025D076, 0x50865013, 0xDC56DCF7, 0x8455841A, 0xE109E151, 0x7ABE7A25, 0x139113EF 0xAC16ACA7, 0xD025D076, 0x50865013, 0xDC56DCF7, 0x8455841A, 0xE109E151, 0x7ABE7A25, 0x139113EF,
]; ];
/** /**
@ -285,7 +285,7 @@ class Twofish extends BlockCipher
0xC1F66EC1, 0x446C5044, 0x5D32DE5D, 0x72466872, 0x26A06526, 0x93CDBC93, 0x03DADB03, 0xC6BAF8C6, 0xC1F66EC1, 0x446C5044, 0x5D32DE5D, 0x72466872, 0x26A06526, 0x93CDBC93, 0x03DADB03, 0xC6BAF8C6,
0xFA9EC8FA, 0x82D6A882, 0xCF6E2BCF, 0x50704050, 0xEB85DCEB, 0x750AFE75, 0x8A93328A, 0x8DDFA48D, 0xFA9EC8FA, 0x82D6A882, 0xCF6E2BCF, 0x50704050, 0xEB85DCEB, 0x750AFE75, 0x8A93328A, 0x8DDFA48D,
0x4C29CA4C, 0x141C1014, 0x73D72173, 0xCCB4F0CC, 0x09D4D309, 0x108A5D10, 0xE2510FE2, 0x00000000, 0x4C29CA4C, 0x141C1014, 0x73D72173, 0xCCB4F0CC, 0x09D4D309, 0x108A5D10, 0xE2510FE2, 0x00000000,
0x9A196F9A, 0xE01A9DE0, 0x8F94368F, 0xE6C742E6, 0xECC94AEC, 0xFDD25EFD, 0xAB7FC1AB, 0xD8A8E0D8 0x9A196F9A, 0xE01A9DE0, 0x8F94368F, 0xE6C742E6, 0xECC94AEC, 0xFDD25EFD, 0xAB7FC1AB, 0xD8A8E0D8,
]; ];
/** /**
@ -545,7 +545,7 @@ class Twofish extends BlockCipher
0xff & $B >> 24, 0xff & $B >> 24,
0xff & $B >> 16, 0xff & $B >> 16,
0xff & $B >> 8, 0xff & $B >> 8,
0xff & $B]; 0xff & $B, ];
} }
/** /**
@ -593,10 +593,13 @@ class Twofish extends BlockCipher
} }
// @codingStandardsIgnoreStart // @codingStandardsIgnoreStart
return pack("V4", $K[4] ^ $R2, return pack(
$K[5] ^ $R3, "V4",
$K[6] ^ $R0, $K[4] ^ $R2,
$K[7] ^ $R1); $K[5] ^ $R3,
$K[6] ^ $R0,
$K[7] ^ $R1
);
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
} }
@ -645,10 +648,13 @@ class Twofish extends BlockCipher
} }
// @codingStandardsIgnoreStart // @codingStandardsIgnoreStart
return pack("V4", $K[0] ^ $R2, return pack(
$K[1] ^ $R3, "V4",
$K[2] ^ $R0, $K[0] ^ $R2,
$K[3] ^ $R1); $K[1] ^ $R3,
$K[2] ^ $R0,
$K[3] ^ $R1
);
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
} }
@ -762,7 +768,7 @@ class Twofish extends BlockCipher
'init_encrypt' => '', 'init_encrypt' => '',
'init_decrypt' => '', 'init_decrypt' => '',
'encrypt_block' => $encrypt_block, 'encrypt_block' => $encrypt_block,
'decrypt_block' => $decrypt_block 'decrypt_block' => $decrypt_block,
] ]
); );
} }

View File

@ -76,6 +76,13 @@ class ANSI
*/ */
private $y; private $y;
/**
* Old Column
*
* @var int
*/
private $old_x;
/** /**
* Old Row * Old Row
* *
@ -214,6 +221,7 @@ class ANSI
// http://ascii-table.com/ansi-escape-sequences-vt-100.php // http://ascii-table.com/ansi-escape-sequences-vt-100.php
switch ($this->ansi) { switch ($this->ansi) {
case "\x1B[H": // Move cursor to upper left corner case "\x1B[H": // Move cursor to upper left corner
$this->old_x = $this->x;
$this->old_y = $this->y; $this->old_y = $this->y;
$this->x = $this->y = 0; $this->x = $this->y = 0;
break; break;
@ -253,14 +261,17 @@ class ANSI
$this->y += (int) $match[1]; $this->y += (int) $match[1];
break; break;
case preg_match('#\x1B\[(\d+);(\d+)H#', $this->ansi, $match): // Move cursor to screen location v,h case preg_match('#\x1B\[(\d+);(\d+)H#', $this->ansi, $match): // Move cursor to screen location v,h
$this->old_x = $this->x;
$this->old_y = $this->y; $this->old_y = $this->y;
$this->x = $match[2] - 1; $this->x = $match[2] - 1;
$this->y = (int) $match[1] - 1; $this->y = (int) $match[1] - 1;
break; break;
case preg_match('#\x1B\[(\d+)C#', $this->ansi, $match): // Move cursor right n lines case preg_match('#\x1B\[(\d+)C#', $this->ansi, $match): // Move cursor right n lines
$this->old_x = $this->x;
$this->x += $match[1]; $this->x += $match[1];
break; break;
case preg_match('#\x1B\[(\d+)D#', $this->ansi, $match): // Move cursor left n lines case preg_match('#\x1B\[(\d+)D#', $this->ansi, $match): // Move cursor left n lines
$this->old_x = $this->x;
$this->x -= $match[1]; $this->x -= $match[1];
if ($this->x < 0) { if ($this->x < 0) {
$this->x = 0; $this->x = 0;

View File

@ -166,7 +166,7 @@ abstract class ASN1
self::TYPE_GENERAL_STRING => 'generalString', self::TYPE_GENERAL_STRING => 'generalString',
self::TYPE_UNIVERSAL_STRING => 'universalString', self::TYPE_UNIVERSAL_STRING => 'universalString',
//self::TYPE_CHARACTER_STRING => 'characterString', //self::TYPE_CHARACTER_STRING => 'characterString',
self::TYPE_BMP_STRING => 'bmpString' self::TYPE_BMP_STRING => 'bmpString',
]; ];
/** /**
@ -307,7 +307,7 @@ abstract class ASN1
'type' => $class, 'type' => $class,
'constant' => $tag, 'constant' => $tag,
'content' => $content, 'content' => $content,
'length' => $length + $start - $current['start'] 'length' => $length + $start - $current['start'],
] + $current; ] + $current;
} }
@ -340,7 +340,7 @@ abstract class ASN1
// the only time when $content['headerlength'] isn't defined is when the length is indefinite. // the only time when $content['headerlength'] isn't defined is when the length is indefinite.
// the absence of $content['headerlength'] is how we know if something is indefinite or not. // the absence of $content['headerlength'] is how we know if something is indefinite or not.
// technically, it could be defined to be 2 and then another indicator could be used but whatever. // technically, it could be defined to be 2 and then another indicator could be used but whatever.
'length' => $start - $current['start'] 'length' => $start - $current['start'],
] + $current; ] + $current;
} }

View File

@ -28,7 +28,7 @@ abstract class AccessDescription
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'children' => [ 'children' => [
'accessMethod' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'accessMethod' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER],
'accessLocation' => GeneralName::MAP 'accessLocation' => GeneralName::MAP,
] ],
]; ];
} }

View File

@ -32,7 +32,7 @@ abstract class AdministrationDomainName
'cast' => 2, 'cast' => 2,
'children' => [ 'children' => [
'numeric' => ['type' => ASN1::TYPE_NUMERIC_STRING], 'numeric' => ['type' => ASN1::TYPE_NUMERIC_STRING],
'printable' => ['type' => ASN1::TYPE_PRINTABLE_STRING] 'printable' => ['type' => ASN1::TYPE_PRINTABLE_STRING],
] ],
]; ];
} }

View File

@ -30,8 +30,8 @@ abstract class AlgorithmIdentifier
'algorithm' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'algorithm' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER],
'parameters' => [ 'parameters' => [
'type' => ASN1::TYPE_ANY, 'type' => ASN1::TYPE_ANY,
'optional' => true 'optional' => true,
] ],
] ],
]; ];
} }

View File

@ -32,8 +32,8 @@ abstract class AnotherName
'type' => ASN1::TYPE_ANY, 'type' => ASN1::TYPE_ANY,
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'explicit' => true 'explicit' => true,
] ],
] ],
]; ];
} }

View File

@ -32,8 +32,8 @@ abstract class Attribute
'type' => ASN1::TYPE_SET, 'type' => ASN1::TYPE_SET,
'min' => 1, 'min' => 1,
'max' => -1, 'max' => -1,
'children' => AttributeValue::MAP 'children' => AttributeValue::MAP,
] ],
] ],
]; ];
} }

View File

@ -28,7 +28,7 @@ abstract class AttributeTypeAndValue
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'children' => [ 'children' => [
'type' => AttributeType::MAP, 'type' => AttributeType::MAP,
'value' => AttributeValue::MAP 'value' => AttributeValue::MAP,
] ],
]; ];
} }

View File

@ -28,6 +28,6 @@ abstract class Attributes
'type' => ASN1::TYPE_SET, 'type' => ASN1::TYPE_SET,
'min' => 1, 'min' => 1,
'max' => -1, 'max' => -1,
'children' => Attribute::MAP 'children' => Attribute::MAP,
]; ];
} }

View File

@ -28,6 +28,6 @@ abstract class AuthorityInfoAccessSyntax
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'min' => 1, 'min' => 1,
'max' => -1, 'max' => -1,
'children' => AccessDescription::MAP 'children' => AccessDescription::MAP,
]; ];
} }

View File

@ -30,18 +30,18 @@ abstract class AuthorityKeyIdentifier
'keyIdentifier' => [ 'keyIdentifier' => [
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + KeyIdentifier::MAP, ] + KeyIdentifier::MAP,
'authorityCertIssuer' => [ 'authorityCertIssuer' => [
'constant' => 1, 'constant' => 1,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + GeneralNames::MAP, ] + GeneralNames::MAP,
'authorityCertSerialNumber' => [ 'authorityCertSerialNumber' => [
'constant' => 2, 'constant' => 2,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + CertificateSerialNumber::MAP ] + CertificateSerialNumber::MAP,
] ],
]; ];
} }

View File

@ -30,12 +30,12 @@ abstract class BasicConstraints
'cA' => [ 'cA' => [
'type' => ASN1::TYPE_BOOLEAN, 'type' => ASN1::TYPE_BOOLEAN,
'optional' => true, 'optional' => true,
'default' => false 'default' => false,
], ],
'pathLenConstraint' => [ 'pathLenConstraint' => [
'type' => ASN1::TYPE_INTEGER, 'type' => ASN1::TYPE_INTEGER,
'optional' => true 'optional' => true,
] ],
] ],
]; ];
} }

View File

@ -28,7 +28,7 @@ abstract class BuiltInDomainDefinedAttribute
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'children' => [ 'children' => [
'type' => ['type' => ASN1::TYPE_PRINTABLE_STRING], 'type' => ['type' => ASN1::TYPE_PRINTABLE_STRING],
'value' => ['type' => ASN1::TYPE_PRINTABLE_STRING] 'value' => ['type' => ASN1::TYPE_PRINTABLE_STRING],
] ],
]; ];
} }

View File

@ -28,6 +28,6 @@ abstract class BuiltInDomainDefinedAttributes
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'min' => 1, 'min' => 1,
'max' => 4, // ub-domain-defined-attributes 'max' => 4, // ub-domain-defined-attributes
'children' => BuiltInDomainDefinedAttribute::MAP 'children' => BuiltInDomainDefinedAttribute::MAP,
]; ];
} }

View File

@ -32,38 +32,38 @@ abstract class BuiltInStandardAttributes
'network-address' => [ 'network-address' => [
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + NetworkAddress::MAP, ] + NetworkAddress::MAP,
'terminal-identifier' => [ 'terminal-identifier' => [
'constant' => 1, 'constant' => 1,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + TerminalIdentifier::MAP, ] + TerminalIdentifier::MAP,
'private-domain-name' => [ 'private-domain-name' => [
'constant' => 2, 'constant' => 2,
'optional' => true, 'optional' => true,
'explicit' => true 'explicit' => true,
] + PrivateDomainName::MAP, ] + PrivateDomainName::MAP,
'organization-name' => [ 'organization-name' => [
'constant' => 3, 'constant' => 3,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + OrganizationName::MAP, ] + OrganizationName::MAP,
'numeric-user-identifier' => [ 'numeric-user-identifier' => [
'constant' => 4, 'constant' => 4,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + NumericUserIdentifier::MAP, ] + NumericUserIdentifier::MAP,
'personal-name' => [ 'personal-name' => [
'constant' => 5, 'constant' => 5,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + PersonalName::MAP, ] + PersonalName::MAP,
'organizational-unit-names' => [ 'organizational-unit-names' => [
'constant' => 6, 'constant' => 6,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + OrganizationalUnitNames::MAP ] + OrganizationalUnitNames::MAP,
] ],
]; ];
} }

View File

@ -28,6 +28,6 @@ abstract class CRLDistributionPoints
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'min' => 1, 'min' => 1,
'max' => -1, 'max' => -1,
'children' => DistributionPoint::MAP 'children' => DistributionPoint::MAP,
]; ];
} }

View File

@ -37,7 +37,7 @@ abstract class CRLReason
// Value 7 is not used. // Value 7 is not used.
8 => 'removeFromCRL', 8 => 'removeFromCRL',
'privilegeWithdrawn', 'privilegeWithdrawn',
'aACompromise' 'aACompromise',
] ],
]; ];
} }

View File

@ -29,7 +29,7 @@ abstract class Certificate
'children' => [ 'children' => [
'tbsCertificate' => TBSCertificate::MAP, 'tbsCertificate' => TBSCertificate::MAP,
'signatureAlgorithm' => AlgorithmIdentifier::MAP, 'signatureAlgorithm' => AlgorithmIdentifier::MAP,
'signature' => ['type' => ASN1::TYPE_BIT_STRING] 'signature' => ['type' => ASN1::TYPE_BIT_STRING],
] ],
]; ];
} }

View File

@ -29,7 +29,7 @@ abstract class CertificateList
'children' => [ 'children' => [
'tbsCertList' => TBSCertList::MAP, 'tbsCertList' => TBSCertList::MAP,
'signatureAlgorithm' => AlgorithmIdentifier::MAP, 'signatureAlgorithm' => AlgorithmIdentifier::MAP,
'signature' => ['type' => ASN1::TYPE_BIT_STRING] 'signature' => ['type' => ASN1::TYPE_BIT_STRING],
] ],
]; ];
} }

View File

@ -28,6 +28,6 @@ abstract class CertificatePolicies
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'min' => 1, 'min' => 1,
'max' => -1, 'max' => -1,
'children' => PolicyInformation::MAP 'children' => PolicyInformation::MAP,
]; ];
} }

View File

@ -29,7 +29,7 @@ abstract class CertificationRequest
'children' => [ 'children' => [
'certificationRequestInfo' => CertificationRequestInfo::MAP, 'certificationRequestInfo' => CertificationRequestInfo::MAP,
'signatureAlgorithm' => AlgorithmIdentifier::MAP, 'signatureAlgorithm' => AlgorithmIdentifier::MAP,
'signature' => ['type' => ASN1::TYPE_BIT_STRING] 'signature' => ['type' => ASN1::TYPE_BIT_STRING],
] ],
]; ];
} }

View File

@ -29,15 +29,15 @@ abstract class CertificationRequestInfo
'children' => [ 'children' => [
'version' => [ 'version' => [
'type' => ASN1::TYPE_INTEGER, 'type' => ASN1::TYPE_INTEGER,
'mapping' => ['v1'] 'mapping' => ['v1'],
], ],
'subject' => Name::MAP, 'subject' => Name::MAP,
'subjectPKInfo' => SubjectPublicKeyInfo::MAP, 'subjectPKInfo' => SubjectPublicKeyInfo::MAP,
'attributes' => [ 'attributes' => [
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + Attributes::MAP, ] + Attributes::MAP,
] ],
]; ];
} }

View File

@ -31,8 +31,8 @@ abstract class Characteristic_two
'basis' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'basis' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER],
'parameters' => [ 'parameters' => [
'type' => ASN1::TYPE_ANY, 'type' => ASN1::TYPE_ANY,
'optional' => true 'optional' => true,
] ],
] ],
]; ];
} }

View File

@ -32,7 +32,7 @@ abstract class CountryName
'cast' => 1, 'cast' => 1,
'children' => [ 'children' => [
'x121-dcc-code' => ['type' => ASN1::TYPE_NUMERIC_STRING], 'x121-dcc-code' => ['type' => ASN1::TYPE_NUMERIC_STRING],
'iso-3166-alpha2-code' => ['type' => ASN1::TYPE_PRINTABLE_STRING] 'iso-3166-alpha2-code' => ['type' => ASN1::TYPE_PRINTABLE_STRING],
] ],
]; ];
} }

View File

@ -31,8 +31,8 @@ abstract class Curve
'b' => FieldElement::MAP, 'b' => FieldElement::MAP,
'seed' => [ 'seed' => [
'type' => ASN1::TYPE_BIT_STRING, 'type' => ASN1::TYPE_BIT_STRING,
'optional' => true 'optional' => true,
] ],
] ],
]; ];
} }

View File

@ -33,8 +33,8 @@ abstract class DHParameter
'base' => ['type' => ASN1::TYPE_INTEGER], 'base' => ['type' => ASN1::TYPE_INTEGER],
'privateValueLength' => [ 'privateValueLength' => [
'type' => ASN1::TYPE_INTEGER, 'type' => ASN1::TYPE_INTEGER,
'optional' => true 'optional' => true,
] ],
] ],
]; ];
} }

View File

@ -29,7 +29,7 @@ abstract class DSAParams
'children' => [ 'children' => [
'p' => ['type' => ASN1::TYPE_INTEGER], 'p' => ['type' => ASN1::TYPE_INTEGER],
'q' => ['type' => ASN1::TYPE_INTEGER], 'q' => ['type' => ASN1::TYPE_INTEGER],
'g' => ['type' => ASN1::TYPE_INTEGER] 'g' => ['type' => ASN1::TYPE_INTEGER],
] ],
]; ];
} }

View File

@ -32,7 +32,7 @@ abstract class DSAPrivateKey
'q' => ['type' => ASN1::TYPE_INTEGER], 'q' => ['type' => ASN1::TYPE_INTEGER],
'g' => ['type' => ASN1::TYPE_INTEGER], 'g' => ['type' => ASN1::TYPE_INTEGER],
'y' => ['type' => ASN1::TYPE_INTEGER], 'y' => ['type' => ASN1::TYPE_INTEGER],
'x' => ['type' => ASN1::TYPE_INTEGER] 'x' => ['type' => ASN1::TYPE_INTEGER],
] ],
]; ];
} }

View File

@ -30,7 +30,7 @@ abstract class DigestInfo
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'children' => [ 'children' => [
'digestAlgorithm' => AlgorithmIdentifier::MAP, 'digestAlgorithm' => AlgorithmIdentifier::MAP,
'digest' => ['type' => ASN1::TYPE_OCTET_STRING] 'digest' => ['type' => ASN1::TYPE_OCTET_STRING],
] ],
]; ];
} }

View File

@ -31,7 +31,7 @@ abstract class DirectoryString
'printableString' => ['type' => ASN1::TYPE_PRINTABLE_STRING], 'printableString' => ['type' => ASN1::TYPE_PRINTABLE_STRING],
'universalString' => ['type' => ASN1::TYPE_UNIVERSAL_STRING], 'universalString' => ['type' => ASN1::TYPE_UNIVERSAL_STRING],
'utf8String' => ['type' => ASN1::TYPE_UTF8_STRING], 'utf8String' => ['type' => ASN1::TYPE_UTF8_STRING],
'bmpString' => ['type' => ASN1::TYPE_BMP_STRING] 'bmpString' => ['type' => ASN1::TYPE_BMP_STRING],
] ],
]; ];
} }

View File

@ -30,7 +30,7 @@ abstract class DisplayText
'ia5String' => ['type' => ASN1::TYPE_IA5_STRING], 'ia5String' => ['type' => ASN1::TYPE_IA5_STRING],
'visibleString' => ['type' => ASN1::TYPE_VISIBLE_STRING], 'visibleString' => ['type' => ASN1::TYPE_VISIBLE_STRING],
'bmpString' => ['type' => ASN1::TYPE_BMP_STRING], 'bmpString' => ['type' => ASN1::TYPE_BMP_STRING],
'utf8String' => ['type' => ASN1::TYPE_UTF8_STRING] 'utf8String' => ['type' => ASN1::TYPE_UTF8_STRING],
] ],
]; ];
} }

View File

@ -30,18 +30,18 @@ abstract class DistributionPoint
'distributionPoint' => [ 'distributionPoint' => [
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'explicit' => true 'explicit' => true,
] + DistributionPointName::MAP, ] + DistributionPointName::MAP,
'reasons' => [ 'reasons' => [
'constant' => 1, 'constant' => 1,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + ReasonFlags::MAP, ] + ReasonFlags::MAP,
'cRLIssuer' => [ 'cRLIssuer' => [
'constant' => 2, 'constant' => 2,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + GeneralNames::MAP ] + GeneralNames::MAP,
] ],
]; ];
} }

View File

@ -30,13 +30,13 @@ abstract class DistributionPointName
'fullName' => [ 'fullName' => [
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + GeneralNames::MAP, ] + GeneralNames::MAP,
'nameRelativeToCRLIssuer' => [ 'nameRelativeToCRLIssuer' => [
'constant' => 1, 'constant' => 1,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + RelativeDistinguishedName::MAP ] + RelativeDistinguishedName::MAP,
] ],
]; ];
} }

View File

@ -28,7 +28,7 @@ abstract class DssSigValue
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'children' => [ 'children' => [
'r' => ['type' => ASN1::TYPE_INTEGER], 'r' => ['type' => ASN1::TYPE_INTEGER],
's' => ['type' => ASN1::TYPE_INTEGER] 's' => ['type' => ASN1::TYPE_INTEGER],
] ],
]; ];
} }

View File

@ -41,7 +41,7 @@ abstract class ECParameters
'children' => [ 'children' => [
'namedCurve' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'namedCurve' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER],
'implicitCurve' => ['type' => ASN1::TYPE_NULL], 'implicitCurve' => ['type' => ASN1::TYPE_NULL],
'specifiedCurve' => SpecifiedECDomain::MAP 'specifiedCurve' => SpecifiedECDomain::MAP,
] ],
]; ];
} }

View File

@ -31,20 +31,20 @@ abstract class ECPrivateKey
'children' => [ 'children' => [
'version' => [ 'version' => [
'type' => ASN1::TYPE_INTEGER, 'type' => ASN1::TYPE_INTEGER,
'mapping' => [1 => 'ecPrivkeyVer1'] 'mapping' => [1 => 'ecPrivkeyVer1'],
], ],
'privateKey' => ['type' => ASN1::TYPE_OCTET_STRING], 'privateKey' => ['type' => ASN1::TYPE_OCTET_STRING],
'parameters' => [ 'parameters' => [
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'explicit' => true 'explicit' => true,
] + ECParameters::MAP, ] + ECParameters::MAP,
'publicKey' => [ 'publicKey' => [
'type' => ASN1::TYPE_BIT_STRING, 'type' => ASN1::TYPE_BIT_STRING,
'constant' => 1, 'constant' => 1,
'optional' => true, 'optional' => true,
'explicit' => true 'explicit' => true,
] ],
] ],
]; ];
} }

View File

@ -30,15 +30,15 @@ abstract class EDIPartyName
'nameAssigner' => [ 'nameAssigner' => [
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + DirectoryString::MAP, ] + DirectoryString::MAP,
// partyName is technically required but \phpseclib3\File\ASN1 doesn't currently support non-optional constants and // partyName is technically required but \phpseclib3\File\ASN1 doesn't currently support non-optional constants and
// setting it to optional gets the job done in any event. // setting it to optional gets the job done in any event.
'partyName' => [ 'partyName' => [
'constant' => 1, 'constant' => 1,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + DirectoryString::MAP ] + DirectoryString::MAP,
] ],
]; ];
} }

View File

@ -28,7 +28,7 @@ abstract class EcdsaSigValue
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'children' => [ 'children' => [
'r' => ['type' => ASN1::TYPE_INTEGER], 'r' => ['type' => ASN1::TYPE_INTEGER],
's' => ['type' => ASN1::TYPE_INTEGER] 's' => ['type' => ASN1::TYPE_INTEGER],
] ],
]; ];
} }

View File

@ -28,7 +28,7 @@ abstract class EncryptedPrivateKeyInfo
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'children' => [ 'children' => [
'encryptionAlgorithm' => AlgorithmIdentifier::MAP, 'encryptionAlgorithm' => AlgorithmIdentifier::MAP,
'encryptedData' => EncryptedData::MAP 'encryptedData' => EncryptedData::MAP,
] ],
]; ];
} }

View File

@ -28,6 +28,6 @@ abstract class ExtKeyUsageSyntax
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'min' => 1, 'min' => 1,
'max' => -1, 'max' => -1,
'children' => KeyPurposeId::MAP 'children' => KeyPurposeId::MAP,
]; ];
} }

View File

@ -37,9 +37,9 @@ abstract class Extension
'critical' => [ 'critical' => [
'type' => ASN1::TYPE_BOOLEAN, 'type' => ASN1::TYPE_BOOLEAN,
'optional' => true, 'optional' => true,
'default' => false 'default' => false,
], ],
'extnValue' => ['type' => ASN1::TYPE_OCTET_STRING] 'extnValue' => ['type' => ASN1::TYPE_OCTET_STRING],
] ],
]; ];
} }

View File

@ -31,14 +31,14 @@ abstract class ExtensionAttribute
'type' => ASN1::TYPE_PRINTABLE_STRING, 'type' => ASN1::TYPE_PRINTABLE_STRING,
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
], ],
'extension-attribute-value' => [ 'extension-attribute-value' => [
'type' => ASN1::TYPE_ANY, 'type' => ASN1::TYPE_ANY,
'constant' => 1, 'constant' => 1,
'optional' => true, 'optional' => true,
'explicit' => true 'explicit' => true,
] ],
] ],
]; ];
} }

View File

@ -28,6 +28,6 @@ abstract class ExtensionAttributes
'type' => ASN1::TYPE_SET, 'type' => ASN1::TYPE_SET,
'min' => 1, 'min' => 1,
'max' => 256, // ub-extension-attributes 'max' => 256, // ub-extension-attributes
'children' => ExtensionAttribute::MAP 'children' => ExtensionAttribute::MAP,
]; ];
} }

View File

@ -30,6 +30,6 @@ abstract class Extensions
// technically, it's MAX, but we'll assume anything < 0 is MAX // technically, it's MAX, but we'll assume anything < 0 is MAX
'max' => -1, 'max' => -1,
// if 'children' isn't an array then 'min' and 'max' must be defined // if 'children' isn't an array then 'min' and 'max' must be defined
'children' => Extension::MAP 'children' => Extension::MAP,
]; ];
} }

View File

@ -30,8 +30,8 @@ abstract class FieldID
'fieldType' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'fieldType' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER],
'parameters' => [ 'parameters' => [
'type' => ASN1::TYPE_ANY, 'type' => ASN1::TYPE_ANY,
'optional' => true 'optional' => true,
] ],
] ],
]; ];
} }

View File

@ -30,53 +30,53 @@ abstract class GeneralName
'otherName' => [ 'otherName' => [
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + AnotherName::MAP, ] + AnotherName::MAP,
'rfc822Name' => [ 'rfc822Name' => [
'type' => ASN1::TYPE_IA5_STRING, 'type' => ASN1::TYPE_IA5_STRING,
'constant' => 1, 'constant' => 1,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
], ],
'dNSName' => [ 'dNSName' => [
'type' => ASN1::TYPE_IA5_STRING, 'type' => ASN1::TYPE_IA5_STRING,
'constant' => 2, 'constant' => 2,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
], ],
'x400Address' => [ 'x400Address' => [
'constant' => 3, 'constant' => 3,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + ORAddress::MAP, ] + ORAddress::MAP,
'directoryName' => [ 'directoryName' => [
'constant' => 4, 'constant' => 4,
'optional' => true, 'optional' => true,
'explicit' => true 'explicit' => true,
] + Name::MAP, ] + Name::MAP,
'ediPartyName' => [ 'ediPartyName' => [
'constant' => 5, 'constant' => 5,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + EDIPartyName::MAP, ] + EDIPartyName::MAP,
'uniformResourceIdentifier' => [ 'uniformResourceIdentifier' => [
'type' => ASN1::TYPE_IA5_STRING, 'type' => ASN1::TYPE_IA5_STRING,
'constant' => 6, 'constant' => 6,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
], ],
'iPAddress' => [ 'iPAddress' => [
'type' => ASN1::TYPE_OCTET_STRING, 'type' => ASN1::TYPE_OCTET_STRING,
'constant' => 7, 'constant' => 7,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
], ],
'registeredID' => [ 'registeredID' => [
'type' => ASN1::TYPE_OBJECT_IDENTIFIER, 'type' => ASN1::TYPE_OBJECT_IDENTIFIER,
'constant' => 8, 'constant' => 8,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] ],
] ],
]; ];
} }

View File

@ -28,6 +28,6 @@ abstract class GeneralNames
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'min' => 1, 'min' => 1,
'max' => -1, 'max' => -1,
'children' => GeneralName::MAP 'children' => GeneralName::MAP,
]; ];
} }

View File

@ -32,13 +32,13 @@ abstract class GeneralSubtree
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'implicit' => true, 'implicit' => true,
'default' => '0' 'default' => '0',
] + BaseDistance::MAP, ] + BaseDistance::MAP,
'maximum' => [ 'maximum' => [
'constant' => 1, 'constant' => 1,
'optional' => true, 'optional' => true,
'implicit' => true, 'implicit' => true,
] + BaseDistance::MAP ] + BaseDistance::MAP,
] ],
]; ];
} }

View File

@ -28,6 +28,6 @@ abstract class GeneralSubtrees
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'min' => 1, 'min' => 1,
'max' => -1, 'max' => -1,
'children' => GeneralSubtree::MAP 'children' => GeneralSubtree::MAP,
]; ];
} }

View File

@ -30,41 +30,41 @@ abstract class IssuingDistributionPoint
'distributionPoint' => [ 'distributionPoint' => [
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'explicit' => true 'explicit' => true,
] + DistributionPointName::MAP, ] + DistributionPointName::MAP,
'onlyContainsUserCerts' => [ 'onlyContainsUserCerts' => [
'type' => ASN1::TYPE_BOOLEAN, 'type' => ASN1::TYPE_BOOLEAN,
'constant' => 1, 'constant' => 1,
'optional' => true, 'optional' => true,
'default' => false, 'default' => false,
'implicit' => true 'implicit' => true,
], ],
'onlyContainsCACerts' => [ 'onlyContainsCACerts' => [
'type' => ASN1::TYPE_BOOLEAN, 'type' => ASN1::TYPE_BOOLEAN,
'constant' => 2, 'constant' => 2,
'optional' => true, 'optional' => true,
'default' => false, 'default' => false,
'implicit' => true 'implicit' => true,
], ],
'onlySomeReasons' => [ 'onlySomeReasons' => [
'constant' => 3, 'constant' => 3,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + ReasonFlags::MAP, ] + ReasonFlags::MAP,
'indirectCRL' => [ 'indirectCRL' => [
'type' => ASN1::TYPE_BOOLEAN, 'type' => ASN1::TYPE_BOOLEAN,
'constant' => 4, 'constant' => 4,
'optional' => true, 'optional' => true,
'default' => false, 'default' => false,
'implicit' => true 'implicit' => true,
], ],
'onlyContainsAttributeCerts' => [ 'onlyContainsAttributeCerts' => [
'type' => ASN1::TYPE_BOOLEAN, 'type' => ASN1::TYPE_BOOLEAN,
'constant' => 5, 'constant' => 5,
'optional' => true, 'optional' => true,
'default' => false, 'default' => false,
'implicit' => true 'implicit' => true,
] ],
] ],
]; ];
} }

View File

@ -35,7 +35,7 @@ abstract class KeyUsage
'keyCertSign', 'keyCertSign',
'cRLSign', 'cRLSign',
'encipherOnly', 'encipherOnly',
'decipherOnly' 'decipherOnly',
] ],
]; ];
} }

View File

@ -27,7 +27,7 @@ abstract class Name
public const MAP = [ public const MAP = [
'type' => ASN1::TYPE_CHOICE, 'type' => ASN1::TYPE_CHOICE,
'children' => [ 'children' => [
'rdnSequence' => RDNSequence::MAP 'rdnSequence' => RDNSequence::MAP,
] ],
]; ];
} }

View File

@ -30,13 +30,13 @@ abstract class NameConstraints
'permittedSubtrees' => [ 'permittedSubtrees' => [
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + GeneralSubtrees::MAP, ] + GeneralSubtrees::MAP,
'excludedSubtrees' => [ 'excludedSubtrees' => [
'constant' => 1, 'constant' => 1,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + GeneralSubtrees::MAP ] + GeneralSubtrees::MAP,
] ],
]; ];
} }

View File

@ -32,8 +32,8 @@ abstract class NoticeReference
'type' => ASN1::TYPE_SEQUENCE, 'type' => ASN1::TYPE_SEQUENCE,
'min' => 1, 'min' => 1,
'max' => 200, 'max' => 200,
'children' => ['type' => ASN1::TYPE_INTEGER] 'children' => ['type' => ASN1::TYPE_INTEGER],
] ],
] ],
]; ];
} }

View File

@ -29,7 +29,7 @@ abstract class ORAddress
'children' => [ 'children' => [
'built-in-standard-attributes' => BuiltInStandardAttributes::MAP, 'built-in-standard-attributes' => BuiltInStandardAttributes::MAP,
'built-in-domain-defined-attributes' => ['optional' => true] + BuiltInDomainDefinedAttributes::MAP, 'built-in-domain-defined-attributes' => ['optional' => true] + BuiltInDomainDefinedAttributes::MAP,
'extension-attributes' => ['optional' => true] + ExtensionAttributes::MAP 'extension-attributes' => ['optional' => true] + ExtensionAttributes::MAP,
] ],
]; ];
} }

View File

@ -31,20 +31,20 @@ abstract class OneAsymmetricKey
'children' => [ 'children' => [
'version' => [ 'version' => [
'type' => ASN1::TYPE_INTEGER, 'type' => ASN1::TYPE_INTEGER,
'mapping' => ['v1', 'v2'] 'mapping' => ['v1', 'v2'],
], ],
'privateKeyAlgorithm' => AlgorithmIdentifier::MAP, 'privateKeyAlgorithm' => AlgorithmIdentifier::MAP,
'privateKey' => PrivateKey::MAP, 'privateKey' => PrivateKey::MAP,
'attributes' => [ 'attributes' => [
'constant' => 0, 'constant' => 0,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + Attributes::MAP, ] + Attributes::MAP,
'publicKey' => [ 'publicKey' => [
'constant' => 1, 'constant' => 1,
'optional' => true, 'optional' => true,
'implicit' => true 'implicit' => true,
] + PublicKey::MAP ] + PublicKey::MAP,
] ],
]; ];
} }

Some files were not shown because too many files have changed in this diff Show More