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' => true,
'@PHP70Migration' => true,
'@PHP70Migration:risky' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'@PHP73Migration' => true,
]
);

View File

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

View File

@ -51,7 +51,7 @@
}
],
"require": {
"php": ">=7.1",
"php": ">=7.3",
"paragonie/constant_time_encoding": "^2"
},
"require-dev": {
@ -79,5 +79,22 @@
},
"config": {
"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,
0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
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,
0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
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,
0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
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,
0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
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 = [
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0,
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::$sbox1,
self::$sbox2,
self::$sbox3
]
self::$sbox3,
],
];
// unpack binary string in unsigned chars
@ -802,7 +802,7 @@ class Blowfish extends BlockCipher
'init_encrypt' => '',
'init_decrypt' => '',
'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:
// http://php.net/manual/en/book.sodium.php
// https://github.com/paragonie/sodium_compat
'libsodium' => function_exists('sodium_crypto_sign_keypair')
'libsodium' => function_exists('sodium_crypto_sign_keypair'),
];
return static::$engines;
@ -405,7 +405,7 @@ abstract class AsymmetricKey
static::$engines = [
'PHP' => true,
'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',
'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;
}
@ -401,7 +401,7 @@ abstract class PKCS8 extends PKCS
'pbkdf2',
$hash,
$salt,
(int) $iterationCount->toString()
(int) $iterationCount->toString(),
];
if (isset($keyLength)) {
$params[] = (int) $keyLength->toString();
@ -496,9 +496,9 @@ abstract class PKCS8 extends PKCS
$key = [
'version' => 'v1',
'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') {
$key['privateKeyAlgorithm']['parameters'] = $params;
@ -528,7 +528,7 @@ abstract class PKCS8 extends PKCS
$PBKDF2params = [
'salt' => $salt,
'iterationCount' => $iterationCount,
'prf' => ['algorithm' => $prf, 'parameters' => null]
'prf' => ['algorithm' => $prf, 'parameters' => null],
];
$PBKDF2params = ASN1::encodeDER($PBKDF2params, Maps\PBKDF2params::MAP);
@ -537,7 +537,7 @@ abstract class PKCS8 extends PKCS
} else {
$params = [
'rc2ParametersVersion' => 58,
'iv' => $iv
'iv' => $iv,
];
$params = ASN1::encodeDER($params, Maps\RC2CBCParameter::MAP);
$params = new ASN1\Element($params);
@ -546,12 +546,12 @@ abstract class PKCS8 extends PKCS
$params = [
'keyDerivationFunc' => [
'algorithm' => 'id-PBKDF2',
'parameters' => new ASN1\Element($PBKDF2params)
'parameters' => new ASN1\Element($PBKDF2params),
],
'encryptionScheme' => [
'algorithm' => $encryptionScheme,
'parameters' => $params
]
'parameters' => $params,
],
];
$params = ASN1::encodeDER($params, Maps\PBES2params::MAP);
@ -563,7 +563,7 @@ abstract class PKCS8 extends PKCS
$params = [
'salt' => $salt,
'iterationCount' => $iterationCount
'iterationCount' => $iterationCount,
];
$params = ASN1::encodeDER($params, Maps\PBEParameter::MAP);
}
@ -573,9 +573,9 @@ abstract class PKCS8 extends PKCS
$key = [
'encryptionAlgorithm' => [
'algorithm' => $encryptionAlgorithm,
'parameters' => new ASN1\Element($params)
'parameters' => new ASN1\Element($params),
],
'encryptedData' => $key
'encryptedData' => $key,
];
$key = ASN1::encodeDER($key, Maps\EncryptedPrivateKeyInfo::MAP);
@ -599,9 +599,9 @@ abstract class PKCS8 extends PKCS
$key = [
'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') {

View File

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

View File

@ -142,7 +142,7 @@ abstract class SymmetricKey
'ofb' => self::MODE_OFB,
'ofb8' => self::MODE_OFB8,
'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_OPENSSL => 'OpenSSL',
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_OPENSSL_GCM,
self::ENGINE_OPENSSL,
self::ENGINE_EVAL
self::ENGINE_EVAL,
];
if (isset($this->preferredEngine)) {
$temp = [$this->preferredEngine];
@ -2778,16 +2778,16 @@ abstract class SymmetricKey
// @see https://github.com/phpseclib/phpseclib/pull/1143
/** @var \Closure $func */
$func = eval(<<<PHP
return function (string \$_action, string \$_text): string
{
{$init_crypt}
if (\$_action === 'encrypt') {
{$encrypt}
} else {
{$decrypt}
}
};
PHP
return function (string \$_action, string \$_text): string
{
{$init_crypt}
if (\$_action === 'encrypt') {
{$encrypt}
} else {
{$decrypt}
}
};
PHP
);
$bindedClosure = \Closure::bind($func, $this, static::class);

View File

@ -93,7 +93,7 @@ class DES extends BlockCipher
self::MODE_ECB => 'des-ecb',
self::MODE_CBC => 'des-cbc',
self::MODE_CFB => 'des-cfb',
self::MODE_OFB => 'des-ofb'
self::MODE_OFB => 'des-ofb',
// 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\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\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,
0x8E, 0x9E, 0x8F, 0x9F, 0xAE, 0xBE, 0xAF, 0xBF,
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,
0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
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,
0x00800002, 0x00000202, 0x00008202, 0x00808200,
0x00000202, 0x00800200, 0x00800200, 0x00000000,
0x00008002, 0x00008200, 0x00000000, 0x00808002
0x00008002, 0x00008200, 0x00000000, 0x00808002,
];
/**
@ -402,7 +402,7 @@ class DES extends BlockCipher
0x00004010, 0x40084000, 0x00080000, 0x40000010,
0x00080010, 0x40004010, 0x40000010, 0x00080010,
0x00084000, 0x00000000, 0x40004000, 0x00004010,
0x40000000, 0x40080010, 0x40084010, 0x00084000
0x40000000, 0x40080010, 0x40084010, 0x00084000,
];
/**
@ -426,7 +426,7 @@ class DES extends BlockCipher
0x04000104, 0x00010000, 0x04000000, 0x04010104,
0x00000004, 0x00010104, 0x00010100, 0x04000004,
0x04010000, 0x04000104, 0x00000104, 0x04010000,
0x00010104, 0x00000004, 0x04010004, 0x00010100
0x00010104, 0x00000004, 0x04010004, 0x00010100,
];
/**
@ -450,7 +450,7 @@ class DES extends BlockCipher
0x80401040, 0x80000040, 0x80000000, 0x00001000,
0x80400000, 0x80001000, 0x00401040, 0x80400040,
0x80001000, 0x00001040, 0x00400000, 0x80401000,
0x00000040, 0x00400000, 0x00001000, 0x00401040
0x00000040, 0x00400000, 0x00001000, 0x00401040,
];
/**
@ -474,7 +474,7 @@ class DES extends BlockCipher
0x21040080, 0x00040080, 0x21000000, 0x21040080,
0x01040000, 0x00000000, 0x20040000, 0x21000000,
0x00040080, 0x01000080, 0x20000080, 0x00040000,
0x00000000, 0x20040000, 0x01040080, 0x20000080
0x00000000, 0x20040000, 0x01040080, 0x20000080,
];
/**
@ -498,7 +498,7 @@ class DES extends BlockCipher
0x00202008, 0x10202000, 0x00000000, 0x10200008,
0x00000008, 0x00002000, 0x10200000, 0x00202008,
0x00002000, 0x00200008, 0x10002008, 0x00000000,
0x10202000, 0x10000000, 0x00200008, 0x10002008
0x10202000, 0x10000000, 0x00200008, 0x10002008,
];
/**
@ -522,7 +522,7 @@ class DES extends BlockCipher
0x00000401, 0x02000001, 0x02100401, 0x02100000,
0x00100400, 0x00000000, 0x00000001, 0x02100401,
0x00000000, 0x00100401, 0x02100000, 0x00000400,
0x02000001, 0x02000400, 0x00000400, 0x00100001
0x02000001, 0x02000400, 0x00000400, 0x00100001,
];
/**
@ -546,7 +546,7 @@ class DES extends BlockCipher
0x00000000, 0x08020820, 0x00020020, 0x08000020,
0x08020000, 0x08000800, 0x08000820, 0x00000000,
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];
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 = [
@ -760,7 +760,7 @@ class DES extends BlockCipher
0xE0, 0xE0, 0xE8, 0xE8, 0xE4, 0xE4, 0xEC, 0xEC,
0xE2, 0xE2, 0xEA, 0xEA, 0xE6, 0xE6, 0xEE, 0xEE,
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.
@ -768,7 +768,7 @@ class DES extends BlockCipher
0x00000000, 0x00000400, 0x00200000, 0x00200400,
0x00000001, 0x00000401, 0x00200001, 0x00200401,
0x02000000, 0x02000400, 0x02200000, 0x02200400,
0x02000001, 0x02000401, 0x02200001, 0x02200401
0x02000001, 0x02000401, 0x02200001, 0x02200401,
];
static $pc2mapc2 = [
0x00000000, 0x00000800, 0x08000000, 0x08000800,
@ -834,7 +834,7 @@ class DES extends BlockCipher
0x01040110, 0x01040910, 0x09040110, 0x09040910,
0x01050110, 0x01050910, 0x09050110, 0x09050910,
0x01040110, 0x01040910, 0x09040110, 0x09040910,
0x01050110, 0x01050910, 0x09050110, 0x09050910
0x01050110, 0x01050910, 0x09050110, 0x09050910,
];
static $pc2mapc3 = [
0x00000000, 0x00000004, 0x00001000, 0x00001004,
@ -900,7 +900,7 @@ class DES extends BlockCipher
0x20080022, 0x20080026, 0x20081022, 0x20081026,
0x20080022, 0x20080026, 0x20081022, 0x20081026,
0x30080022, 0x30080026, 0x30081022, 0x30081026,
0x30080022, 0x30080026, 0x30081022, 0x30081026
0x30080022, 0x30080026, 0x30081022, 0x30081026,
];
static $pc2mapc4 = [
0x00000000, 0x00100000, 0x00000008, 0x00100008,
@ -966,13 +966,13 @@ class DES extends BlockCipher
0x04022000, 0x04122000, 0x04022008, 0x04122008,
0x04022200, 0x04122200, 0x04022208, 0x04122208,
0x04022000, 0x04122000, 0x04022008, 0x04122008,
0x04022200, 0x04122200, 0x04022208, 0x04122208
0x04022200, 0x04122200, 0x04022208, 0x04122208,
];
static $pc2mapd1 = [
0x00000000, 0x00000001, 0x08000000, 0x08000001,
0x00200000, 0x00200001, 0x08200000, 0x08200001,
0x00000002, 0x00000003, 0x08000002, 0x08000003,
0x00200002, 0x00200003, 0x08200002, 0x08200003
0x00200002, 0x00200003, 0x08200002, 0x08200003,
];
static $pc2mapd2 = [
0x00000000, 0x00100000, 0x00000800, 0x00100800,
@ -1038,7 +1038,7 @@ class DES extends BlockCipher
0x00020204, 0x00120204, 0x00020A04, 0x00120A04,
0x00020204, 0x00120204, 0x00020A04, 0x00120A04,
0x04020204, 0x04120204, 0x04020A04, 0x04120A04,
0x04020204, 0x04120204, 0x04020A04, 0x04120A04
0x04020204, 0x04120204, 0x04020A04, 0x04120A04,
];
static $pc2mapd3 = [
0x00000000, 0x00010000, 0x02000000, 0x02010000,
@ -1104,7 +1104,7 @@ class DES extends BlockCipher
0x20002010, 0x20012010, 0x22002010, 0x22012010,
0x20002030, 0x20012030, 0x22002030, 0x22012030,
0x20042010, 0x20052010, 0x22042010, 0x22052010,
0x20042030, 0x20052030, 0x22042030, 0x22052030
0x20042030, 0x20052030, 0x22042030, 0x22052030,
];
static $pc2mapd4 = [
0x00000000, 0x00000400, 0x01000000, 0x01000400,
@ -1170,7 +1170,7 @@ class DES extends BlockCipher
0x10081008, 0x10081408, 0x11081008, 0x11081408,
0x10081008, 0x10081408, 0x11081008, 0x11081408,
0x10081108, 0x10081508, 0x11081108, 0x11081508,
0x10081108, 0x10081508, 0x11081108, 0x11081508
0x10081108, 0x10081508, 0x11081108, 0x11081508,
];
$keys = [];
@ -1195,7 +1195,7 @@ class DES extends BlockCipher
$keys[$des_round] = [
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) {
$c <<= $shifts[$i];
@ -1233,14 +1233,14 @@ class DES extends BlockCipher
$keys[2][self::DECRYPT],
$keys[1][self::ENCRYPT],
$keys[0][self::DECRYPT]
)
),
];
break;
// case 1: // DES keys
default:
$this->keys = [
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 = [
self::ENCRYPT => $this->keys[self::ENCRYPT],
self::DECRYPT => $this->keys[self::DECRYPT]
self::DECRYPT => $this->keys[self::DECRYPT],
];
$init_encrypt = '';
$init_decrypt = '';
@ -1352,7 +1352,7 @@ class DES extends BlockCipher
'init_encrypt' => $init_encrypt,
'init_decrypt' => $init_decrypt,
'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 = [
'prime' => $prime,
'base' => $base
'base' => $base,
];
$params = ASN1::encodeDER($params, Maps\DHParameter::MAP);

View File

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

View File

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

View File

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

View File

@ -47,7 +47,7 @@ abstract class SSH2
return [
'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 = [
$p[0],
$p[1]->negate()
$p[1]->negate(),
];
if (isset($p[2])) {
$temp[] = $p[2];

View File

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

View File

@ -139,7 +139,7 @@ class Montgomery extends Base
}
$this->p = [
$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 [
[$x4, $z4],
[$x5, $z5]
[$x5, $z5],
];
}

View File

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

View File

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

View File

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

View File

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

View File

@ -40,11 +40,11 @@ class secp256k1 extends KoblitzPrime
$this->basis = [];
$this->basis[] = [
'a' => new BigInteger('3086D221A7D46BCDE86C90E49284EB15', -16),
'b' => new BigInteger('FF1BBC8129FEF177D790AB8056F5401B3D', -16)
'b' => new BigInteger('FF1BBC8129FEF177D790AB8056F5401B3D', -16),
];
$this->basis[] = [
'a' => new BigInteger('114CA50F7A8E2F3F657C1108D9D44CFD8', -16),
'b' => new BigInteger('3086D221A7D46BCDE86C90E49284EB15', -16)
'b' => new BigInteger('3086D221A7D46BCDE86C90E49284EB15', -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',
'brainpoolP384t1' => '1.3.36.3.3.2.8.1.1.12',
'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([
'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"
'gnBasis' => '1.2.840.10045.1.2.3.1', // NULL
'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);
}
}
@ -316,7 +316,7 @@ trait Common
}
$point = [
$curve->convertInteger(new BigInteger($x, 256)),
$curve->convertInteger(new BigInteger($y, 256))
$curve->convertInteger(new BigInteger($y, 256)),
];
if (!$curve->verifyPoint($point)) {
@ -449,14 +449,14 @@ trait Common
'version' => 'ecdpVer1',
'fieldID' => [
'fieldType' => 'prime-field',
'parameters' => $curve->getModulo()
'parameters' => $curve->getModulo(),
],
'curve' => [
'a' => $curve->getA()->toBytes(),
'b' => $curve->getB()->toBytes()
'b' => $curve->getB()->toBytes(),
],
'base' => "\4" . $x . $y,
'order' => $order
'order' => $order,
];
return $returnArray ?
@ -480,7 +480,7 @@ trait Common
$modulo = [
'k1' => new BigInteger($modulo[2]),
'k2' => new BigInteger($modulo[1]),
'k3' => new BigInteger($modulo[0])
'k3' => new BigInteger($modulo[0]),
];
$modulo = ASN1::encodeDER($modulo, Maps\Pentanomial::MAP);
$modulo = new ASN1\Element($modulo);
@ -488,7 +488,7 @@ trait Common
$params = ASN1::encodeDER([
'm' => new BigInteger($m),
'basis' => $basis,
'parameters' => $modulo
'parameters' => $modulo,
], Maps\Characteristic_two::MAP);
$params = new ASN1\Element($params);
$a = ltrim($curve->getA()->toBytes(), "\0");
@ -503,14 +503,14 @@ trait Common
'version' => 'ecdpVer1',
'fieldID' => [
'fieldType' => 'characteristic-two-field',
'parameters' => $params
'parameters' => $params,
],
'curve' => [
'a' => $a,
'b' => $b
'b' => $b,
],
'base' => "\4" . $x . $y,
'order' => $order
'order' => $order,
];
return $returnArray ?

View File

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

View File

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

View File

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

View File

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

View File

@ -178,7 +178,7 @@ abstract class XML
}
$point = [
$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)) {
throw new \RuntimeException('Unable to verify that point exists on curve');
@ -225,7 +225,7 @@ abstract class XML
'gnb' => ['fieldid/gnb/m'],
'tnb' => ['fieldid/tnb/k'],
'pnb' => ['fieldid/pnb/k1', 'fieldid/pnb/k2', 'fieldid/pnb/k3'],
'unknown' => []
'unknown' => [],
];
foreach ($fieldTypes as $type => $queries) {
@ -275,7 +275,7 @@ abstract class XML
{
$fieldTypes = [
'prime-field' => ['primefieldparamstype/p'],
'unknown' => []
'unknown' => [],
];
foreach ($fieldTypes as $type => $queries) {

View File

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

View File

@ -389,7 +389,7 @@ class Hash
'capacity' => 1600 - $this->blockSize,
'rate' => $this->blockSize,
'length' => $this->length,
'padding' => $this->paddingType
'padding' => $this->paddingType,
];
$hash = ['phpseclib3\Crypt\Hash', PHP_INT_SIZE == 8 ? 'sha3_64' : 'sha3_32'];
}
@ -403,11 +403,11 @@ class Hash
$initial = $hash == 'sha512/256' ?
[
'22312194FC2BF72C', '9F555FA3C84C64C2', '2393B86B6F53B151', '963877195940EABD',
'96283EE2A88EFFE3', 'BE5E1E2553863992', '2B0199FC2C85B8AA', '0EB72DDC81C52CA2'
'96283EE2A88EFFE3', 'BE5E1E2553863992', '2B0199FC2C85B8AA', '0EB72DDC81C52CA2',
] :
[
'8C3D37C819544DA2', '73E1996689DCD4D6', '1DFAB7AE32FF9C82', '679DD514582F9FCF',
'0F6D2B697BD44DA8', '77E36F7304C48942', '3F9D85A86A1D36C8', '1112E6AD91D692A1'
'0F6D2B697BD44DA8', '77E36F7304C48942', '3F9D85A86A1D36C8', '1112E6AD91D692A1',
];
for ($i = 0; $i < 8; $i++) {
$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]],
];
$p = str_split($p, $block_size);
@ -982,7 +982,7 @@ class Hash
[36, 44, 6, 55, 20],
[ 3, 10, 43, 25, 39],
[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
@ -1012,7 +1012,7 @@ class Hash
[-2147483648, -2147450751],
[-2147483648, 32896],
[0, -2147483647],
[-2147483648, -2147450872]
[-2147483648, -2147450872],
];
for ($round = 0; $round < 24; $round++) {
@ -1021,7 +1021,7 @@ class Hash
for ($i = 0; $i < 5; $i++) {
$parity[] = [
$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);
}
@ -1031,7 +1031,7 @@ class Hash
[$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[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 ($j = 0; $j < 5; $j++) {
@ -1053,23 +1053,23 @@ class Hash
for ($i = 0; $i < 5; $i++) {
$s[$i][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] = [
$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] = [
$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] = [
$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] = [
$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 [
($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],
];
$p = str_split($p, $block_size);
@ -1160,7 +1160,7 @@ class Hash
[36, 44, 6, 55, 20],
[ 3, 10, 43, 25, 39],
[41, 45, 15, 21, 8],
[18, 2, 61, 56, 14]
[18, 2, 61, 56, 14],
];
static $roundConstants = [
@ -1187,7 +1187,7 @@ class Hash
-9223372034707259263,
-9223372036854742912,
2147483649,
-9223372034707259384
-9223372034707259384,
];
for ($round = 0; $round < 24; $round++) {
@ -1201,7 +1201,7 @@ class Hash
$parity[0] ^ static::rotateLeft64($parity[2], 1),
$parity[1] ^ static::rotateLeft64($parity[3], 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 ($j = 0; $j < 5; $j++) {
@ -1225,7 +1225,7 @@ class Hash
$st[$i][1] ^ (~$st[$i][2] & $st[$i][3]),
$st[$i][2] ^ (~$st[$i][3] & $st[$i][4]),
$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',
'06f067aa72176fba', '0a637dc5a2c898a6', '113f9804bef90dae', '1b710b35131c471b',
'28db77f523047d84', '32caab7b40c72493', '3c9ebe0a15c9bebc', '431d67c49c100d4c',
'4cc5d4becb3e42b6', '597f299cfc657e2a', '5fcb6fab3ad6faec', '6c44198c4a475817'
'4cc5d4becb3e42b6', '597f299cfc657e2a', '5fcb6fab3ad6faec', '6c44198c4a475817',
];
for ($i = 0; $i < 80; $i++) {
@ -1303,14 +1303,14 @@ class Hash
$temp = [
$w[$i - 15]->bitwise_rightRotate(1),
$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 = $s0->bitwise_xor($temp[2]);
$temp = [
$w[$i - 2]->bitwise_rightRotate(19),
$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 = $s1->bitwise_xor($temp[2]);
@ -1335,14 +1335,14 @@ class Hash
$temp = [
$a->bitwise_rightRotate(28),
$a->bitwise_rightRotate(34),
$a->bitwise_rightRotate(39)
$a->bitwise_rightRotate(39),
];
$s0 = $temp[0]->bitwise_xor($temp[1]);
$s0 = $s0->bitwise_xor($temp[2]);
$temp = [
$a->bitwise_and($b),
$a->bitwise_and($c),
$b->bitwise_and($c)
$b->bitwise_and($c),
];
$maj = $temp[0]->bitwise_xor($temp[1]);
$maj = $maj->bitwise_xor($temp[2]);
@ -1351,13 +1351,13 @@ class Hash
$temp = [
$e->bitwise_rightRotate(14),
$e->bitwise_rightRotate(18),
$e->bitwise_rightRotate(41)
$e->bitwise_rightRotate(41),
];
$s1 = $temp[0]->bitwise_xor($temp[1]);
$s1 = $s1->bitwise_xor($temp[2]);
$temp = [
$e->bitwise_and($f),
$g->bitwise_and($e->bitwise_not())
$g->bitwise_and($e->bitwise_not()),
];
$ch = $temp[0]->bitwise_xor($temp[1]);
$t1 = $h->add($s1);
@ -1384,7 +1384,7 @@ class Hash
$hash[4]->add($e),
$hash[5]->add($f),
$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,
0xBB, 0x48, 0x0C, 0x5F, 0xB9, 0xB1, 0xCD, 0x2E,
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,
0x81, 0x09, 0x82, 0x33, 0x9F, 0x07, 0x86, 0x75,
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,
'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] = [
0, // index $i
0, // index $j
$keyStream
$keyStream,
];
}

View File

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

View File

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

View File

@ -72,7 +72,7 @@ abstract class PKCS1 extends Progenitor
'privateExponent' => $key['privateExponent'],
'primes' => [1 => $key['prime1'], $key['prime2']],
'exponents' => [1 => $key['exponent1'], $key['exponent2']],
'coefficients' => [2 => $key['coefficient']]
'coefficients' => [2 => $key['coefficient']],
];
if ($key['version'] == 'multi') {
foreach ($key['otherPrimeInfos'] as $primeInfo) {
@ -118,13 +118,13 @@ abstract class PKCS1 extends Progenitor
'prime2' => $primes[2],
'exponent1' => $exponents[1],
'exponent2' => $exponents[2],
'coefficient' => $coefficients[2]
'coefficient' => $coefficients[2],
];
for ($i = 3; $i <= $num_primes; $i++) {
$key['otherPrimeInfos'][] = [
'prime' => $primes[$i],
'exponent' => $exponents[$i],
'coefficient' => $coefficients[$i]
'coefficient' => $coefficients[$i],
];
}
@ -140,7 +140,7 @@ abstract class PKCS1 extends Progenitor
{
$key = [
'modulus' => $n,
'publicExponent' => $e
'publicExponent' => $e,
];
$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/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;
}
@ -130,7 +130,7 @@ abstract class PSS extends Progenitor
} else {
$params['maskGenAlgorithm'] = [
'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
*/
$params = [
'trailerField' => new BigInteger(1)
'trailerField' => new BigInteger(1),
];
if (isset($options['hash'])) {
$params['hashAlgorithm']['algorithm'] = 'id-' . $options['hash'];
@ -212,7 +212,7 @@ abstract class PSS extends Progenitor
$temp = ASN1::encodeDER($temp, Maps\HashAlgorithm::MAP);
$params['maskGenAlgorithm'] = [
'algorithm' => 'id-mgf1',
'parameters' => new ASN1\Element($temp)
'parameters' => new ASN1\Element($temp),
];
}
if (isset($options['saltLength'])) {

View File

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

View File

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

View File

@ -100,7 +100,7 @@ class PrivateKey extends RSA implements Common\PrivateKey
if (!static::$enableBlinding) {
$m_i = [
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 = $h->multiply($this->coefficients[2]);
@ -131,7 +131,7 @@ class PrivateKey extends RSA implements Common\PrivateKey
$m_i = [
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 = $h->multiply($this->coefficients[2]);
@ -460,7 +460,7 @@ class PrivateKey extends RSA implements Common\PrivateKey
$options += [
'hash' => $this->hash->getHash(),
'MGFHash' => $this->mgfHash->getHash(),
'saltLength' => $this->getSaltLength()
'saltLength' => $this->getSaltLength(),
];
} else {
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 += [
'hash' => $this->hash->getHash(),
'MGFHash' => $this->mgfHash->getHash(),
'saltLength' => $this->getSaltLength()
'saltLength' => $this->getSaltLength(),
];
} else {
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,
0x2F000000, 0x5E000000, 0xBC000000, 0x63000000, 0xC6000000,
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']) {
@ -651,7 +651,7 @@ class Rijndael extends BlockCipher
0xE1E138D9, 0xF8F813EB, 0x9898B32B, 0x11113322, 0x6969BBD2, 0xD9D970A9, 0x8E8E8907, 0x9494A733,
0x9B9BB62D, 0x1E1E223C, 0x87879215, 0xE9E920C9, 0xCECE4987, 0x5555FFAA, 0x28287850, 0xDFDF7AA5,
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) {
@ -683,8 +683,8 @@ class Rijndael extends BlockCipher
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,
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;
@ -734,7 +734,7 @@ class Rijndael extends BlockCipher
0xD7618C9A, 0xA10C7A37, 0xF8148E59, 0x133C89EB, 0xA927EECE, 0x61C935B7, 0x1CE5EDE1, 0x47B13C7A,
0xD2DF599C, 0xF2733F55, 0x14CE7918, 0xC737BF73, 0xF7CDEA53, 0xFDAA5B5F, 0x3D6F14DF, 0x44DB8678,
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) {
@ -766,8 +766,8 @@ class Rijndael extends BlockCipher
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,
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;
@ -909,7 +909,7 @@ class Rijndael extends BlockCipher
'init_encrypt' => $init_encrypt,
'init_decrypt' => $init_decrypt,
'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,
0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4,
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,
0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9,
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,
0xABABA212, 0x6F6F3EA2, 0xE6E6540D, 0xDBDBF252, 0x92927BBB, 0xB7B7B602, 0x6969CA2F, 0x3939D9A9,
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,
0xC8FA9E9E, 0xA882D6D6, 0x2BCF6E6E, 0x40507070, 0xDCEB8585, 0xFE750A0A, 0x328A9393, 0xA48DDFDF,
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,
0xAB12ABA2, 0x6FA26F3E, 0xE60DE654, 0xDB52DBF2, 0x92BB927B, 0xB702B7B6, 0x692F69CA, 0x39A939D9,
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,
0xFA9EC8FA, 0x82D6A882, 0xCF6E2BCF, 0x50704050, 0xEB85DCEB, 0x750AFE75, 0x8A93328A, 0x8DDFA48D,
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 >> 16,
0xff & $B >> 8,
0xff & $B];
0xff & $B, ];
}
/**
@ -593,10 +593,13 @@ class Twofish extends BlockCipher
}
// @codingStandardsIgnoreStart
return pack("V4", $K[4] ^ $R2,
$K[5] ^ $R3,
$K[6] ^ $R0,
$K[7] ^ $R1);
return pack(
"V4",
$K[4] ^ $R2,
$K[5] ^ $R3,
$K[6] ^ $R0,
$K[7] ^ $R1
);
// @codingStandardsIgnoreEnd
}
@ -645,10 +648,13 @@ class Twofish extends BlockCipher
}
// @codingStandardsIgnoreStart
return pack("V4", $K[0] ^ $R2,
$K[1] ^ $R3,
$K[2] ^ $R0,
$K[3] ^ $R1);
return pack(
"V4",
$K[0] ^ $R2,
$K[1] ^ $R3,
$K[2] ^ $R0,
$K[3] ^ $R1
);
// @codingStandardsIgnoreEnd
}
@ -762,7 +768,7 @@ class Twofish extends BlockCipher
'init_encrypt' => '',
'init_decrypt' => '',
'encrypt_block' => $encrypt_block,
'decrypt_block' => $decrypt_block
'decrypt_block' => $decrypt_block,
]
);
}

View File

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

View File

@ -166,7 +166,7 @@ abstract class ASN1
self::TYPE_GENERAL_STRING => 'generalString',
self::TYPE_UNIVERSAL_STRING => 'universalString',
//self::TYPE_CHARACTER_STRING => 'characterString',
self::TYPE_BMP_STRING => 'bmpString'
self::TYPE_BMP_STRING => 'bmpString',
];
/**
@ -307,7 +307,7 @@ abstract class ASN1
'type' => $class,
'constant' => $tag,
'content' => $content,
'length' => $length + $start - $current['start']
'length' => $length + $start - $current['start'],
] + $current;
}
@ -340,7 +340,7 @@ abstract class ASN1
// 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.
// 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;
}

View File

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

View File

@ -32,7 +32,7 @@ abstract class AdministrationDomainName
'cast' => 2,
'children' => [
'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],
'parameters' => [
'type' => ASN1::TYPE_ANY,
'optional' => true
]
]
'optional' => true,
],
],
];
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,7 +28,7 @@ abstract class BuiltInDomainDefinedAttribute
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'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,
'min' => 1,
'max' => 4, // ub-domain-defined-attributes
'children' => BuiltInDomainDefinedAttribute::MAP
'children' => BuiltInDomainDefinedAttribute::MAP,
];
}

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@ abstract class Certificate
'children' => [
'tbsCertificate' => TBSCertificate::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' => [
'tbsCertList' => TBSCertList::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,
'min' => 1,
'max' => -1,
'children' => PolicyInformation::MAP
'children' => PolicyInformation::MAP,
];
}

View File

@ -29,7 +29,7 @@ abstract class CertificationRequest
'children' => [
'certificationRequestInfo' => CertificationRequestInfo::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' => [
'version' => [
'type' => ASN1::TYPE_INTEGER,
'mapping' => ['v1']
'mapping' => ['v1'],
],
'subject' => Name::MAP,
'subjectPKInfo' => SubjectPublicKeyInfo::MAP,
'attributes' => [
'constant' => 0,
'optional' => true,
'implicit' => true
'implicit' => true,
] + Attributes::MAP,
]
],
];
}

View File

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

View File

@ -32,7 +32,7 @@ abstract class CountryName
'cast' => 1,
'children' => [
'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,
'seed' => [
'type' => ASN1::TYPE_BIT_STRING,
'optional' => true
]
]
'optional' => true,
],
],
];
}

View File

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

View File

@ -29,7 +29,7 @@ abstract class DSAParams
'children' => [
'p' => ['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],
'g' => ['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,
'children' => [
'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],
'universalString' => ['type' => ASN1::TYPE_UNIVERSAL_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],
'visibleString' => ['type' => ASN1::TYPE_VISIBLE_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' => [
'constant' => 0,
'optional' => true,
'explicit' => true
'explicit' => true,
] + DistributionPointName::MAP,
'reasons' => [
'constant' => 1,
'optional' => true,
'implicit' => true
'implicit' => true,
] + ReasonFlags::MAP,
'cRLIssuer' => [
'constant' => 2,
'optional' => true,
'implicit' => true
] + GeneralNames::MAP
]
'implicit' => true,
] + GeneralNames::MAP,
],
];
}

View File

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

View File

@ -28,7 +28,7 @@ abstract class DssSigValue
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'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' => [
'namedCurve' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER],
'implicitCurve' => ['type' => ASN1::TYPE_NULL],
'specifiedCurve' => SpecifiedECDomain::MAP
]
'specifiedCurve' => SpecifiedECDomain::MAP,
],
];
}

View File

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

View File

@ -30,15 +30,15 @@ abstract class EDIPartyName
'nameAssigner' => [
'constant' => 0,
'optional' => true,
'implicit' => true
'implicit' => true,
] + DirectoryString::MAP,
// 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.
'partyName' => [
'constant' => 1,
'optional' => true,
'implicit' => true
] + DirectoryString::MAP
]
'implicit' => true,
] + DirectoryString::MAP,
],
];
}

View File

@ -28,7 +28,7 @@ abstract class EcdsaSigValue
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'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,
'children' => [
'encryptionAlgorithm' => AlgorithmIdentifier::MAP,
'encryptedData' => EncryptedData::MAP
]
'encryptedData' => EncryptedData::MAP,
],
];
}

View File

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

View File

@ -37,9 +37,9 @@ abstract class Extension
'critical' => [
'type' => ASN1::TYPE_BOOLEAN,
'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,
'constant' => 0,
'optional' => true,
'implicit' => true
'implicit' => true,
],
'extension-attribute-value' => [
'type' => ASN1::TYPE_ANY,
'constant' => 1,
'optional' => true,
'explicit' => true
]
]
'explicit' => true,
],
],
];
}

View File

@ -28,6 +28,6 @@ abstract class ExtensionAttributes
'type' => ASN1::TYPE_SET,
'min' => 1,
'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
'max' => -1,
// 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],
'parameters' => [
'type' => ASN1::TYPE_ANY,
'optional' => true
]
]
'optional' => true,
],
],
];
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@ abstract class ORAddress
'children' => [
'built-in-standard-attributes' => BuiltInStandardAttributes::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' => [
'version' => [
'type' => ASN1::TYPE_INTEGER,
'mapping' => ['v1', 'v2']
'mapping' => ['v1', 'v2'],
],
'privateKeyAlgorithm' => AlgorithmIdentifier::MAP,
'privateKey' => PrivateKey::MAP,
'attributes' => [
'constant' => 0,
'optional' => true,
'implicit' => true
'implicit' => true,
] + Attributes::MAP,
'publicKey' => [
'constant' => 1,
'optional' => true,
'implicit' => true
] + PublicKey::MAP
]
'implicit' => true,
] + PublicKey::MAP,
],
];
}

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