From e210166f43fef97202f900c47685f907c431c008 Mon Sep 17 00:00:00 2001 From: Jack Worman Date: Wed, 6 Jul 2022 20:43:09 -0500 Subject: [PATCH] Php 7.1 Upgrade --- build/php-cs-fixer.php | 6 +- build/php_codesniffer.xml | 1 + build/psalm_baseline.xml | 511 ++++++------------ composer.json | 2 +- phpseclib/Common/Functions/Strings.php | 2 +- phpseclib/Crypt/AES.php | 2 +- phpseclib/Crypt/Blowfish.php | 18 +- phpseclib/Crypt/Common/AsymmetricKey.php | 18 - .../Crypt/Common/Formats/Keys/OpenSSH.php | 4 +- phpseclib/Crypt/Common/Formats/Keys/PKCS.php | 6 +- phpseclib/Crypt/Common/Formats/Keys/PuTTY.php | 4 +- phpseclib/Crypt/Common/SymmetricKey.php | 376 ++----------- phpseclib/Crypt/DES.php | 22 +- phpseclib/Crypt/DH.php | 4 +- phpseclib/Crypt/DH/Formats/Keys/PKCS8.php | 4 +- phpseclib/Crypt/DSA.php | 4 +- phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php | 4 +- phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php | 2 +- phpseclib/Crypt/EC.php | 4 +- phpseclib/Crypt/EC/BaseCurves/Base.php | 14 - phpseclib/Crypt/EC/Curves/Ed25519.php | 4 +- phpseclib/Crypt/EC/Curves/Ed448.php | 4 +- .../EC/Formats/Keys/MontgomeryPrivate.php | 2 +- .../EC/Formats/Keys/MontgomeryPublic.php | 2 +- phpseclib/Crypt/EC/Formats/Keys/PKCS8.php | 4 +- phpseclib/Crypt/EC/Formats/Keys/PuTTY.php | 2 +- phpseclib/Crypt/EC/Formats/Keys/libsodium.php | 2 +- phpseclib/Crypt/Hash.php | 6 +- phpseclib/Crypt/RC2.php | 32 +- phpseclib/Crypt/RC4.php | 14 +- phpseclib/Crypt/RSA.php | 16 +- phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php | 14 +- phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php | 4 +- phpseclib/Crypt/RSA/Formats/Keys/PSS.php | 4 +- phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php | 2 +- phpseclib/Crypt/RSA/PublicKey.php | 2 +- phpseclib/Crypt/Rijndael.php | 33 +- phpseclib/Crypt/Salsa20.php | 4 +- phpseclib/Crypt/TripleDES.php | 29 +- phpseclib/Crypt/Twofish.php | 18 +- phpseclib/File/ANSI.php | 11 - phpseclib/File/ASN1.php | 66 +-- .../File/ASN1/Maps/AccessDescription.php | 2 +- .../ASN1/Maps/AdministrationDomainName.php | 2 +- .../File/ASN1/Maps/AlgorithmIdentifier.php | 2 +- phpseclib/File/ASN1/Maps/AnotherName.php | 2 +- phpseclib/File/ASN1/Maps/Attribute.php | 2 +- phpseclib/File/ASN1/Maps/AttributeType.php | 2 +- .../File/ASN1/Maps/AttributeTypeAndValue.php | 2 +- phpseclib/File/ASN1/Maps/AttributeValue.php | 2 +- phpseclib/File/ASN1/Maps/Attributes.php | 2 +- .../ASN1/Maps/AuthorityInfoAccessSyntax.php | 2 +- .../File/ASN1/Maps/AuthorityKeyIdentifier.php | 2 +- phpseclib/File/ASN1/Maps/BaseDistance.php | 2 +- phpseclib/File/ASN1/Maps/BasicConstraints.php | 2 +- .../Maps/BuiltInDomainDefinedAttribute.php | 2 +- .../Maps/BuiltInDomainDefinedAttributes.php | 2 +- .../ASN1/Maps/BuiltInStandardAttributes.php | 2 +- phpseclib/File/ASN1/Maps/CPSuri.php | 2 +- .../File/ASN1/Maps/CRLDistributionPoints.php | 2 +- phpseclib/File/ASN1/Maps/CRLNumber.php | 2 +- phpseclib/File/ASN1/Maps/CRLReason.php | 2 +- phpseclib/File/ASN1/Maps/CertPolicyId.php | 2 +- phpseclib/File/ASN1/Maps/Certificate.php | 2 +- .../File/ASN1/Maps/CertificateIssuer.php | 2 +- phpseclib/File/ASN1/Maps/CertificateList.php | 2 +- .../File/ASN1/Maps/CertificatePolicies.php | 2 +- .../ASN1/Maps/CertificateSerialNumber.php | 2 +- .../File/ASN1/Maps/CertificationRequest.php | 2 +- .../ASN1/Maps/CertificationRequestInfo.php | 2 +- .../File/ASN1/Maps/Characteristic_two.php | 2 +- phpseclib/File/ASN1/Maps/CountryName.php | 2 +- phpseclib/File/ASN1/Maps/Curve.php | 2 +- phpseclib/File/ASN1/Maps/DHParameter.php | 2 +- phpseclib/File/ASN1/Maps/DSAParams.php | 2 +- phpseclib/File/ASN1/Maps/DSAPrivateKey.php | 2 +- phpseclib/File/ASN1/Maps/DSAPublicKey.php | 2 +- phpseclib/File/ASN1/Maps/DigestInfo.php | 2 +- phpseclib/File/ASN1/Maps/DirectoryString.php | 2 +- phpseclib/File/ASN1/Maps/DisplayText.php | 2 +- .../File/ASN1/Maps/DistributionPoint.php | 2 +- .../File/ASN1/Maps/DistributionPointName.php | 2 +- phpseclib/File/ASN1/Maps/DssSigValue.php | 2 +- phpseclib/File/ASN1/Maps/ECParameters.php | 2 +- phpseclib/File/ASN1/Maps/ECPoint.php | 2 +- phpseclib/File/ASN1/Maps/ECPrivateKey.php | 2 +- phpseclib/File/ASN1/Maps/EDIPartyName.php | 2 +- phpseclib/File/ASN1/Maps/EcdsaSigValue.php | 2 +- phpseclib/File/ASN1/Maps/EncryptedData.php | 2 +- .../ASN1/Maps/EncryptedPrivateKeyInfo.php | 2 +- .../File/ASN1/Maps/ExtKeyUsageSyntax.php | 2 +- phpseclib/File/ASN1/Maps/Extension.php | 2 +- .../File/ASN1/Maps/ExtensionAttribute.php | 2 +- .../File/ASN1/Maps/ExtensionAttributes.php | 2 +- phpseclib/File/ASN1/Maps/Extensions.php | 2 +- phpseclib/File/ASN1/Maps/FieldElement.php | 2 +- phpseclib/File/ASN1/Maps/FieldID.php | 2 +- phpseclib/File/ASN1/Maps/GeneralName.php | 2 +- phpseclib/File/ASN1/Maps/GeneralNames.php | 2 +- phpseclib/File/ASN1/Maps/GeneralSubtree.php | 2 +- phpseclib/File/ASN1/Maps/GeneralSubtrees.php | 2 +- phpseclib/File/ASN1/Maps/HashAlgorithm.php | 2 +- .../File/ASN1/Maps/HoldInstructionCode.php | 2 +- phpseclib/File/ASN1/Maps/InvalidityDate.php | 2 +- phpseclib/File/ASN1/Maps/IssuerAltName.php | 2 +- .../ASN1/Maps/IssuingDistributionPoint.php | 2 +- phpseclib/File/ASN1/Maps/KeyIdentifier.php | 2 +- phpseclib/File/ASN1/Maps/KeyPurposeId.php | 2 +- phpseclib/File/ASN1/Maps/KeyUsage.php | 2 +- phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php | 2 +- phpseclib/File/ASN1/Maps/Name.php | 2 +- phpseclib/File/ASN1/Maps/NameConstraints.php | 2 +- phpseclib/File/ASN1/Maps/NetworkAddress.php | 2 +- phpseclib/File/ASN1/Maps/NoticeReference.php | 2 +- .../File/ASN1/Maps/NumericUserIdentifier.php | 2 +- phpseclib/File/ASN1/Maps/ORAddress.php | 2 +- phpseclib/File/ASN1/Maps/OneAsymmetricKey.php | 2 +- phpseclib/File/ASN1/Maps/OrganizationName.php | 2 +- .../ASN1/Maps/OrganizationalUnitNames.php | 2 +- phpseclib/File/ASN1/Maps/OtherPrimeInfo.php | 2 +- phpseclib/File/ASN1/Maps/OtherPrimeInfos.php | 2 +- phpseclib/File/ASN1/Maps/PBEParameter.php | 2 +- phpseclib/File/ASN1/Maps/PBES2params.php | 2 +- phpseclib/File/ASN1/Maps/PBKDF2params.php | 2 +- phpseclib/File/ASN1/Maps/PBMAC1params.php | 2 +- phpseclib/File/ASN1/Maps/PKCS9String.php | 2 +- phpseclib/File/ASN1/Maps/Pentanomial.php | 2 +- phpseclib/File/ASN1/Maps/PersonalName.php | 2 +- .../File/ASN1/Maps/PolicyInformation.php | 2 +- phpseclib/File/ASN1/Maps/PolicyMappings.php | 2 +- .../File/ASN1/Maps/PolicyQualifierId.php | 2 +- .../File/ASN1/Maps/PolicyQualifierInfo.php | 2 +- phpseclib/File/ASN1/Maps/PostalAddress.php | 2 +- phpseclib/File/ASN1/Maps/Prime_p.php | 2 +- .../File/ASN1/Maps/PrivateDomainName.php | 2 +- phpseclib/File/ASN1/Maps/PrivateKey.php | 2 +- phpseclib/File/ASN1/Maps/PrivateKeyInfo.php | 2 +- .../File/ASN1/Maps/PrivateKeyUsagePeriod.php | 2 +- phpseclib/File/ASN1/Maps/PublicKey.php | 2 +- .../File/ASN1/Maps/PublicKeyAndChallenge.php | 2 +- phpseclib/File/ASN1/Maps/PublicKeyInfo.php | 2 +- phpseclib/File/ASN1/Maps/RC2CBCParameter.php | 2 +- phpseclib/File/ASN1/Maps/RDNSequence.php | 2 +- phpseclib/File/ASN1/Maps/RSAPrivateKey.php | 2 +- phpseclib/File/ASN1/Maps/RSAPublicKey.php | 2 +- .../File/ASN1/Maps/RSASSA_PSS_params.php | 2 +- phpseclib/File/ASN1/Maps/ReasonFlags.php | 2 +- .../ASN1/Maps/RelativeDistinguishedName.php | 2 +- .../File/ASN1/Maps/RevokedCertificate.php | 2 +- .../ASN1/Maps/SignedPublicKeyAndChallenge.php | 2 +- .../File/ASN1/Maps/SpecifiedECDomain.php | 2 +- phpseclib/File/ASN1/Maps/SubjectAltName.php | 2 +- .../ASN1/Maps/SubjectDirectoryAttributes.php | 2 +- .../ASN1/Maps/SubjectInfoAccessSyntax.php | 2 +- .../File/ASN1/Maps/SubjectPublicKeyInfo.php | 2 +- phpseclib/File/ASN1/Maps/TBSCertList.php | 2 +- phpseclib/File/ASN1/Maps/TBSCertificate.php | 2 +- .../File/ASN1/Maps/TerminalIdentifier.php | 2 +- phpseclib/File/ASN1/Maps/Time.php | 2 +- phpseclib/File/ASN1/Maps/Trinomial.php | 2 +- phpseclib/File/ASN1/Maps/UniqueIdentifier.php | 2 +- phpseclib/File/ASN1/Maps/UserNotice.php | 2 +- phpseclib/File/ASN1/Maps/Validity.php | 2 +- .../File/ASN1/Maps/netscape_ca_policy_url.php | 2 +- .../File/ASN1/Maps/netscape_cert_type.php | 2 +- phpseclib/File/ASN1/Maps/netscape_comment.php | 2 +- phpseclib/File/X509.php | 36 +- phpseclib/Math/BigInteger/Engines/BCMath.php | 10 +- .../Math/BigInteger/Engines/BCMath/Base.php | 4 +- .../Engines/BCMath/Reductions/Barrett.php | 4 +- phpseclib/Math/BigInteger/Engines/Engine.php | 2 +- phpseclib/Math/BigInteger/Engines/GMP.php | 4 +- phpseclib/Math/BigInteger/Engines/PHP.php | 10 +- .../Math/BigInteger/Engines/PHP/Base.php | 4 +- phpseclib/Math/BigInteger/Engines/PHP32.php | 14 +- phpseclib/Math/BigInteger/Engines/PHP64.php | 14 +- phpseclib/Math/Common/FiniteField.php | 2 + phpseclib/Math/Common/FiniteField/Integer.php | 2 + phpseclib/Math/PrimeField/Integer.php | 2 + phpseclib/Net/SFTP.php | 14 +- phpseclib/Net/SFTP/Attribute.php | 34 +- phpseclib/Net/SFTP/FileType.php | 18 +- phpseclib/Net/SFTP/OpenFlag.php | 14 +- phpseclib/Net/SFTP/OpenFlag5.php | 36 +- phpseclib/Net/SFTP/PacketType.php | 52 +- phpseclib/Net/SFTP/StatusCode.php | 64 +-- phpseclib/Net/SFTP/Stream.php | 2 +- phpseclib/Net/SSH2.php | 51 +- .../SSH2/ChannelConnectionFailureReason.php | 8 +- phpseclib/Net/SSH2/DisconnectReason.php | 30 +- phpseclib/Net/SSH2/MessageType.php | 64 +-- phpseclib/Net/SSH2/MessageTypeExtra.php | 18 +- phpseclib/Net/SSH2/TerminalMode.php | 2 +- phpseclib/System/SSH/Agent.php | 23 +- phpseclib/System/SSH/Agent/Identity.php | 4 +- phpseclib/bootstrap.php | 2 + tests/Functional/Net/SFTPLargeFileTest.php | 4 +- tests/PsalmBaselineTest.php | 45 ++ tests/Unit/Crypt/AES/McryptTest.php | 19 - tests/Unit/Crypt/BlowfishTest.php | 8 - tests/Unit/Crypt/GCMTest.php | 2 - tests/Unit/Crypt/RC2Test.php | 9 - tests/Unit/Crypt/RC4Test.php | 8 - tests/Unit/Crypt/RSA/CreateKeyTest.php | 2 +- tests/Unit/Crypt/TripleDESTest.php | 2 - tests/Unit/Crypt/TwofishTest.php | 1 - tests/Unit/Math/BigInteger/TestCase.php | 8 +- tests/Unit/Net/SSH2UnitTest.php | 5 - 208 files changed, 746 insertions(+), 1442 deletions(-) create mode 100644 tests/PsalmBaselineTest.php delete mode 100644 tests/Unit/Crypt/AES/McryptTest.php diff --git a/build/php-cs-fixer.php b/build/php-cs-fixer.php index c445543a..cadfa567 100644 --- a/build/php-cs-fixer.php +++ b/build/php-cs-fixer.php @@ -26,11 +26,9 @@ return (new PhpCsFixer\Config()) 'phpdoc_trim_consecutive_blank_line_separation' => true, 'phpdoc_trim' => true, - // PHP 7.0 '@PHP70Migration' => true, '@PHP70Migration:risky' => true, - 'declare_strict_types' => false, - // PHP 7.1 - 'void_return' => true, + '@PHP71Migration' => true, + '@PHP71Migration:risky' => true, ] ); diff --git a/build/php_codesniffer.xml b/build/php_codesniffer.xml index eb7ecdc1..de09391e 100644 --- a/build/php_codesniffer.xml +++ b/build/php_codesniffer.xml @@ -15,5 +15,6 @@ + diff --git a/build/psalm_baseline.xml b/build/psalm_baseline.xml index 47a11ff7..e525188b 100644 --- a/build/psalm_baseline.xml +++ b/build/psalm_baseline.xml @@ -1685,8 +1685,7 @@ $x8 $x9 - - ChaCha20 + ChaCha20 ChaCha20 ChaCha20 @@ -1862,10 +1861,6 @@ $name - - $signatureFileFormats - $signatureFormats - @@ -1886,18 +1881,14 @@ $asciiType - - $parts[1] - $checkint $key - + $parts[0] - $parts[1] setBinaryOutput @@ -2444,8 +2435,7 @@ \phpseclib3\Crypt\Common\StreamCipher - - StreamCipher + StreamCipher StreamCipher StreamCipher @@ -2475,7 +2465,7 @@ openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING) openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING) - + $func_args[0] @@ -2498,13 +2488,10 @@ int - - string - setupKey - + $buffer['ciphertext'] $buffer['ciphertext'] $buffer['ciphertext'] @@ -2539,29 +2526,17 @@ $i $i $i - $i - $i - $i - $i $key $key $key $key $len $len - $len - $len - $len - $len % $block_size - $len - $len % $block_size - $mcrypt_modes[$this->mode] - $mcrypt_modes[$this->mode] $one $orig_pos $orig_pos $orig_pos $orig_pos - $orig_pos - $orig_pos $overflow $overflow $plaintext @@ -2575,23 +2550,24 @@ -$overflow -$overflow -$overflow - $this->block_size - MCRYPT_MODE_ECB - - $mcrypt_modes[$this->mode] - $mcrypt_modes[$this->mode] + $reverseMap[$engine] $this->buffer['pos'] - + + $bindedClosure $ciphertext + $decrypt_block $dkLen + $encrypt_block $i $i $i $i - $i - $i + $init_crypt + $init_decrypt + $init_encrypt $key_length $len $len @@ -2599,19 +2575,10 @@ $len $len $len - $len - $len - $len - $len - $len $max $max $max $max - $max - $max - $orig_pos - $orig_pos $orig_pos $orig_pos $orig_pos @@ -2630,22 +2597,15 @@ $pos $pos $pos - $pos - $pos - $pos - $pos - $pos - $pos $size $this->preferredEngine - + int string string - string - + $buffer['ciphertext'] $buffer['ciphertext'] $buffer['ciphertext'] @@ -2657,20 +2617,51 @@ $buffer['xor'] $buffer['xor'] $buffer['xor'] + $decrypt_block + $decrypt_block + $decrypt_block $dkLen $dkLen + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $encrypt_block + $init_decrypt + $init_decrypt + $init_decrypt + $init_encrypt + $init_encrypt + $init_encrypt + $init_encrypt + $init_encrypt + $init_encrypt + $init_encrypt + $init_encrypt + $init_encrypt + $init_encrypt + $init_encrypt + $init_encrypt + $init_encrypt $key_length $len $len $len $len - $len - $len - $len - $len - $len - $max - $max $max $max $max @@ -2685,10 +2676,6 @@ $pos $pos $pos - $pos - $pos - $pos - $pos $this->key_length $xor[0] $xor[0] @@ -2701,7 +2688,7 @@ $this->key_length << 3 $this->paddable ? $this->unpad($plaintext) : $plaintext - + $ciphertext $ciphertext $ciphertext @@ -2711,7 +2698,6 @@ $encrypted $iv $result - $this->ecb openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv) @@ -2722,7 +2708,7 @@ pack('N', $i++) pack('N', 8 * strlen($str)) - + false false false @@ -2732,9 +2718,6 @@ false false false - mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], '') - mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], '') - mcrypt_module_open($this->cipher_name_mcrypt, '', MCRYPT_MODE_ECB, '') $count @@ -2758,13 +2741,10 @@ $salt $salt - - null - null - null + null - + $buffer['ciphertext'] $buffer['ciphertext'] $buffer['ciphertext'] @@ -2797,10 +2777,8 @@ $buffer['xor'] $buffer['xor'] $buffer['xor'] - $this->debuffer['pos'] - $this->enbuffer['enmcrypt_init'] - $this->enbuffer['enmcrypt_init'] - $this->enbuffer['pos'] + $cipher_code['decrypt_block'] + $cipher_code['encrypt_block'] $this->enbuffer['pos'] @@ -2822,35 +2800,26 @@ bool - - $cipher_name_mcrypt + $cipher_name_openssl $cipher_name_openssl_ecb $debuffer $decryptIV - $demcrypt - $ecb $enbuffer $encryptIV $engine - $enmcrypt $h $inline_crypt $poly1305Key $preferredEngine - - $this->ecb - $this->ecb - $this->engine != self::ENGINE_MCRYPT && $this->enmcrypt - $this->enmcrypt + is_string($this->key) strlen($password) - + $this->usePoly1305 && !isset($this->poly1305Key) $this->usePoly1305 && !isset($this->poly1305Key) - isset($this->enmcrypt) isset($this->poly1305Key) isset($this->poly1305Key) isset($this->preferredEngine) @@ -2860,15 +2829,6 @@ return $ciphertext; - - MCRYPT_MODE_CBC - MCRYPT_MODE_CFB - MCRYPT_MODE_ECB - MCRYPT_MODE_ECB - MCRYPT_MODE_NOFB - MCRYPT_MODE_OFB - MCRYPT_MODE_STREAM - Callback @@ -2899,9 +2859,6 @@ new static('ctr') new static('ecb') - - $skip_key_adjustment - $ciphertext $ciphertext @@ -3242,12 +3199,6 @@ string - - $new - - - bool - $args @@ -3431,12 +3382,6 @@ is_int($args[0]) is_int($args[1]) - - $new - - - bool - getParameters @@ -3839,15 +3784,9 @@ - + $decoded - $new - $new - $new->withHash($components['curve']::HASH) - - bool - $privatekey $privatekey->withHash($curve::HASH) @@ -3984,12 +3923,7 @@ int[] object - - $doubles - $doubles - $doubles - $doubles - $doubles + $factory $order @@ -4052,9 +3986,6 @@ randomInteger setReduction - - $doubles - isset($this->order) @@ -4071,9 +4002,6 @@ addPoint doublePoint - - $naf - @@ -4761,8 +4689,7 @@ newInteger newInteger - - Curve25519 + Curve25519 Curve25519 Curve25519 @@ -4783,8 +4710,7 @@ newInteger newInteger - - Curve448 + Curve448 Curve448 Curve448 @@ -4881,8 +4807,7 @@ doublePoint recoverX - - Ed25519 + Ed25519 Ed25519 Ed25519 @@ -4960,8 +4885,7 @@ encodePoint recoverX - - Ed448 + Ed448 Ed448 Ed448 @@ -4982,8 +4906,7 @@ - - brainpoolP160r1 + brainpoolP160r1 brainpoolP160r1 brainpoolP160r1 @@ -5001,8 +4924,7 @@ - - brainpoolP160t1 + brainpoolP160t1 brainpoolP160t1 brainpoolP160t1 @@ -5020,8 +4942,7 @@ - - brainpoolP192r1 + brainpoolP192r1 brainpoolP192r1 brainpoolP192r1 @@ -5039,8 +4960,7 @@ - - brainpoolP192t1 + brainpoolP192t1 brainpoolP192t1 brainpoolP192t1 @@ -5058,8 +4978,7 @@ - - brainpoolP224r1 + brainpoolP224r1 brainpoolP224r1 brainpoolP224r1 @@ -5077,8 +4996,7 @@ - - brainpoolP224t1 + brainpoolP224t1 brainpoolP224t1 brainpoolP224t1 @@ -5096,8 +5014,7 @@ - - brainpoolP256r1 + brainpoolP256r1 brainpoolP256r1 brainpoolP256r1 @@ -5115,8 +5032,7 @@ - - brainpoolP256t1 + brainpoolP256t1 brainpoolP256t1 brainpoolP256t1 @@ -5134,8 +5050,7 @@ - - brainpoolP320r1 + brainpoolP320r1 brainpoolP320r1 brainpoolP320r1 @@ -5153,8 +5068,7 @@ - - brainpoolP320t1 + brainpoolP320t1 brainpoolP320t1 brainpoolP320t1 @@ -5172,8 +5086,7 @@ - - brainpoolP384r1 + brainpoolP384r1 brainpoolP384r1 brainpoolP384r1 @@ -5191,8 +5104,7 @@ - - brainpoolP384t1 + brainpoolP384t1 brainpoolP384t1 brainpoolP384t1 @@ -5210,8 +5122,7 @@ - - brainpoolP512r1 + brainpoolP512r1 brainpoolP512r1 brainpoolP512r1 @@ -5229,8 +5140,7 @@ - - brainpoolP512t1 + brainpoolP512t1 brainpoolP512t1 brainpoolP512t1 @@ -5248,112 +5158,72 @@ - - nistb233 - nistb233 - - nistb409 - nistb409 - - nistk163 - nistk163 - - nistk233 - nistk233 - - nistk283 - nistk283 - - nistk409 - nistk409 - - nistp192 - nistp192 - - nistp224 - nistp224 - - nistp256 - nistp256 - - nistp384 - nistp384 - - nistp521 - nistp521 - - nistt571 - nistt571 - - prime192v1 - prime192v1 - - prime192v2 + prime192v2 prime192v2 prime192v2 @@ -5371,8 +5241,7 @@ - - prime192v3 + prime192v3 prime192v3 prime192v3 @@ -5390,8 +5259,7 @@ - - prime239v1 + prime239v1 prime239v1 prime239v1 @@ -5409,8 +5277,7 @@ - - prime239v2 + prime239v2 prime239v2 prime239v2 @@ -5428,8 +5295,7 @@ - - prime239v3 + prime239v3 prime239v3 prime239v3 @@ -5447,16 +5313,12 @@ - - prime256v1 - prime256v1 - - secp112r1 + secp112r1 secp112r1 secp112r1 @@ -5474,8 +5336,7 @@ - - secp112r2 + secp112r2 secp112r2 secp112r2 @@ -5493,8 +5354,7 @@ - - secp128r1 + secp128r1 secp128r1 secp128r1 @@ -5512,8 +5372,7 @@ - - secp128r2 + secp128r2 secp128r2 secp128r2 @@ -5534,8 +5393,7 @@ newInteger - - secp160k1 + secp160k1 secp160k1 secp160k1 @@ -5565,8 +5423,7 @@ - - secp160r1 + secp160r1 secp160r1 secp160r1 @@ -5584,8 +5441,7 @@ - - secp160r2 + secp160r2 secp160r2 secp160r2 @@ -5606,8 +5462,7 @@ newInteger - - secp192k1 + secp192k1 secp192k1 secp192k1 @@ -5637,8 +5492,7 @@ - - secp192r1 + secp192r1 secp192r1 secp192r1 @@ -5656,8 +5510,7 @@ newInteger - - secp224k1 + secp224k1 secp224k1 secp224k1 @@ -5687,8 +5540,7 @@ - - secp224r1 + secp224r1 secp224r1 secp224r1 @@ -5706,8 +5558,7 @@ newInteger - - secp256k1 + secp256k1 secp256k1 secp256k1 @@ -5737,8 +5588,7 @@ - - secp256r1 + secp256r1 secp256r1 secp256r1 @@ -5753,8 +5603,7 @@ - - secp384r1 + secp384r1 secp384r1 secp384r1 @@ -5769,8 +5618,7 @@ - - secp521r1 + secp521r1 secp521r1 secp521r1 @@ -5785,8 +5633,7 @@ - - sect113r1 + sect113r1 sect113r1 sect113r1 @@ -5800,8 +5647,7 @@ - - sect113r2 + sect113r2 sect113r2 sect113r2 @@ -5815,8 +5661,7 @@ - - sect131r1 + sect131r1 sect131r1 sect131r1 @@ -5830,8 +5675,7 @@ - - sect131r2 + sect131r2 sect131r2 sect131r2 @@ -5845,8 +5689,7 @@ - - sect163k1 + sect163k1 sect163k1 sect163k1 @@ -5857,8 +5700,7 @@ - - sect163r1 + sect163r1 sect163r1 sect163r1 @@ -5872,8 +5714,7 @@ - - sect163r2 + sect163r2 sect163r2 sect163r2 @@ -5887,8 +5728,7 @@ - - sect193r1 + sect193r1 sect193r1 sect193r1 @@ -5902,8 +5742,7 @@ - - sect193r2 + sect193r2 sect193r2 sect193r2 @@ -5917,8 +5756,7 @@ - - sect233k1 + sect233k1 sect233k1 sect233k1 @@ -5929,8 +5767,7 @@ - - sect233r1 + sect233r1 sect233r1 sect233r1 @@ -5941,8 +5778,7 @@ - - sect239k1 + sect239k1 sect239k1 sect239k1 @@ -5956,8 +5792,7 @@ - - sect283k1 + sect283k1 sect283k1 sect283k1 @@ -5968,8 +5803,7 @@ - - sect283r1 + sect283r1 sect283r1 sect283r1 @@ -5983,8 +5817,7 @@ - - sect409k1 + sect409k1 sect409k1 sect409k1 @@ -5995,8 +5828,7 @@ - - sect409r1 + sect409r1 sect409r1 sect409r1 @@ -6007,8 +5839,7 @@ - - sect571k1 + sect571k1 sect571k1 sect571k1 @@ -6019,8 +5850,7 @@ - - sect571r1 + sect571r1 sect571r1 sect571r1 @@ -7833,9 +7663,6 @@ $limit === 64 $limit === 64 - - $skip_key_adjustment - @@ -7901,12 +7728,6 @@ - - $key - - - bool - RSA::load($privatekeystr) @@ -9255,7 +9076,7 @@ $buffer['counter'] $buffer['counter'] - + $debuffer $enbuffer Salsa20 @@ -9265,7 +9086,6 @@ Salsa20 Salsa20 Salsa20 - Salsa20 $this->usePoly1305 && !isset($this->poly1305Key) @@ -9353,9 +9173,6 @@ TripleDES TripleDES - - BadModeException - @@ -10134,14 +9951,10 @@ $this->x $this->x + 1 - + $match[2] - 1 $this->x $this->x - $this->x - $this->x - $this->x - $this->x $this->x += $match[1] $this->x -= $match[1] @@ -10160,7 +9973,7 @@ \phpseclib3\File\ANSI - + $ansi $attr_row $attrs @@ -10169,7 +9982,6 @@ $max_history $max_x $max_y - $old_x $old_y $screen $tokenization @@ -10183,9 +9995,6 @@ $this->screen $this->screen - - $old_x - @@ -11515,14 +11324,13 @@ bool bool - + $CAs $challenge $currentCert $currentKeyIdentifier $dn $endDate - $oids $privateKey $publicKey $serialNumber @@ -11628,9 +11436,6 @@ $extension $extension - - $oids - $count $key @@ -11914,9 +11719,9 @@ BCMath - $r_value[strlen($r_value) - 1] - $this->value[strlen($this->value) - 1] - $this->value[strlen($this->value) - 1] + $r_value[-1] + $this->value[-1] + $this->value[-1] $x @@ -11933,9 +11738,8 @@ array{gcd: static, x: static, y: static} array{static, static} - + $current - $r_value $temp >> 16 $temp >> 8 $temp->value @@ -11947,19 +11751,17 @@ $this->value $this->value $this->value - $this->value - $this->value $x $y->value $current[0] - $r_value[strlen($r_value) - 1] + $r_value[-1] $temp->value[0] + $this->value[-1] + $this->value[-1] $this->value[0] $this->value[0] - $this->value[strlen($this->value) - 1] - $this->value[strlen($this->value) - 1] $y->value[0] @@ -12015,9 +11817,12 @@ bcmod($result->value, $result->bitmask->value) bcmod($this->value, $y->value) - + $current[0] + $r_value[-1] $temp->value[0] + $this->value[-1] + $this->value[-1] $this->value[0] $this->value[0] $y->value[0] @@ -15076,12 +14881,11 @@ _dir_readdir _stream_read - + $host $host $host $orig - $orig $pass $pass $port @@ -15090,11 +14894,12 @@ $user $user - + $context[$scheme] $context[$scheme] $context[$scheme] $context[$scheme] + $orig[-1] $var[0] $var[1] self::$instances[$host][$port] @@ -15940,12 +15745,6 @@ \phpseclib3\System\SSH\Agent - - $request_channel - - - $request_channel - $comment @@ -16489,6 +16288,18 @@ null + + + $baseline + + + PsalmBaselineTest + PsalmBaselineTest + + + PsalmBaselineTest + + EvalTest @@ -16498,15 +16309,6 @@ EvalTest - - - McryptTest - McryptTest - - - McryptTest - - OpenSSLTest @@ -17294,8 +17096,7 @@ RC4Test RC4Test - - new RC4(RC4::MODE_CTR) + new RC4(RC4::MODE_CTR) new RC4(RC4::MODE_CTR) @@ -17324,7 +17125,7 @@ $plaintext $prime $signature - list($publickey, $privatekey) + [$publickey, $privatekey] decrypt @@ -18280,10 +18081,10 @@ $z $z $z - list($q, $r) - list($q, $r) - list($q, $r) - list($q, $r) + [$q, $r] + [$q, $r] + [$q, $r] + [$q, $r] clone $a diff --git a/composer.json b/composer.json index 96c10082..eecba608 100644 --- a/composer.json +++ b/composer.json @@ -55,12 +55,12 @@ "paragonie/constant_time_encoding": "^2" }, "require-dev": { + "ext-xml": "*", "phpunit/phpunit": "*" }, "suggest": { "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations.", - "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations." }, "autoload": { diff --git a/phpseclib/Common/Functions/Strings.php b/phpseclib/Common/Functions/Strings.php index bfaa1907..039631c7 100644 --- a/phpseclib/Common/Functions/Strings.php +++ b/phpseclib/Common/Functions/Strings.php @@ -220,7 +220,7 @@ abstract class Strings $parts = preg_split('#(\d+)#', $format, -1, PREG_SPLIT_DELIM_CAPTURE); $format = ''; for ($i = 1; $i < count($parts); $i += 2) { - $format .= substr($parts[$i - 1], 0, -1) . str_repeat(substr($parts[$i - 1], -1), (int) $parts[$i]); + $format .= substr($parts[$i - 1], 0, -1) . str_repeat($parts[$i - 1][-1], (int) $parts[$i]); } $format .= $parts[$i - 1]; diff --git a/phpseclib/Crypt/AES.php b/phpseclib/Crypt/AES.php index eae4c76b..37abb30e 100644 --- a/phpseclib/Crypt/AES.php +++ b/phpseclib/Crypt/AES.php @@ -3,7 +3,7 @@ /** * Pure-PHP implementation of AES. * - * Uses mcrypt, if available/possible, and an internal implementation, otherwise. + * Uses an internal implementation. * * PHP version 5 * diff --git a/phpseclib/Crypt/Blowfish.php b/phpseclib/Crypt/Blowfish.php index a5732b2b..04f5e5c5 100644 --- a/phpseclib/Crypt/Blowfish.php +++ b/phpseclib/Crypt/Blowfish.php @@ -3,7 +3,7 @@ /** * Pure-PHP implementation of Blowfish. * - * Uses mcrypt, if available, and an internal implementation, otherwise. + * Uses an internal implementation. * * PHP version 5 * @@ -55,22 +55,6 @@ class Blowfish extends BlockCipher */ protected $block_size = 8; - /** - * The mcrypt specific name of the cipher - * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt - * @var string - */ - protected $cipher_name_mcrypt = 'blowfish'; - - /** - * Optimizing value while CFB-encrypting - * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len - * @var int - */ - protected $cfb_init_len = 500; - /** * The fixed subkeys boxes ($sbox0 - $sbox3) with 256 entries each * diff --git a/phpseclib/Crypt/Common/AsymmetricKey.php b/phpseclib/Crypt/Common/AsymmetricKey.php index 28ced301..745ff4bd 100644 --- a/phpseclib/Crypt/Common/AsymmetricKey.php +++ b/phpseclib/Crypt/Common/AsymmetricKey.php @@ -80,22 +80,6 @@ abstract class AsymmetricKey */ private static $invisiblePlugins = []; - /** - * Supported signature formats (lower case) - * - * @see self::initialize_static_variables() - * @var array - */ - private static $signatureFormats = []; - - /** - * Supported signature formats (original case) - * - * @see self::initialize_static_variables() - * @var array - */ - private static $signatureFileFormats = []; - /** * Available Engines * @@ -110,8 +94,6 @@ abstract class AsymmetricKey */ private $comment; - /** - */ abstract public function toString(string $type, array $options = []): string; /** diff --git a/phpseclib/Crypt/Common/Formats/Keys/OpenSSH.php b/phpseclib/Crypt/Common/Formats/Keys/OpenSSH.php index 7711cf39..c238f46a 100644 --- a/phpseclib/Crypt/Common/Formats/Keys/OpenSSH.php +++ b/phpseclib/Crypt/Common/Formats/Keys/OpenSSH.php @@ -90,7 +90,7 @@ abstract class OpenSSH bcrypt is basically Blowfish with an altered key expansion. whereas Blowfish just runs the key through the key expansion bcrypt interleaves the key expansion with the salt and - password. this renders openssl / mcrypt unusuable. this forces us to use a pure-PHP implementation + password. this renders openssl unusable. this forces us to use a pure-PHP implementation of bcrypt. the problem with that is that pure-PHP is too slow to be practically useful. in addition to encrypting a different string 64 times the OpenSSH implementation also performs bcrypt @@ -129,7 +129,7 @@ abstract class OpenSSH if (!isset($parts[1])) { $key = base64_decode($parts[0]); - $comment = $parts[1] ?? false; + $comment = false; } else { $asciiType = $parts[0]; self::checkType($parts[0]); diff --git a/phpseclib/Crypt/Common/Formats/Keys/PKCS.php b/phpseclib/Crypt/Common/Formats/Keys/PKCS.php index 5ebb2034..17077934 100644 --- a/phpseclib/Crypt/Common/Formats/Keys/PKCS.php +++ b/phpseclib/Crypt/Common/Formats/Keys/PKCS.php @@ -25,15 +25,15 @@ abstract class PKCS /** * Auto-detect the format */ - const MODE_ANY = 0; + public const MODE_ANY = 0; /** * Require base64-encoded PEM's be supplied */ - const MODE_PEM = 1; + public const MODE_PEM = 1; /** * Require raw DER's be supplied */ - const MODE_DER = 2; + public const MODE_DER = 2; /**#@-*/ /** diff --git a/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php b/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php index 8d86e9d9..6b9e4344 100644 --- a/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php +++ b/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php @@ -140,12 +140,12 @@ abstract class PuTTY foreach ($lines as $line) { switch (true) { case preg_match('#^(.*?): (.*)#', $line, $match): - $in_value = $line[strlen($line) - 1] == '\\'; + $in_value = $line[-1] == '\\'; $current = strtolower($match[1]); $values[$current] = $in_value ? substr($match[2], 0, -1) : $match[2]; break; case $in_value: - $in_value = $line[strlen($line) - 1] == '\\'; + $in_value = $line[-1] == '\\'; $values[$current] .= $in_value ? substr($line, 0, -1) : $line; break; default: diff --git a/phpseclib/Crypt/Common/SymmetricKey.php b/phpseclib/Crypt/Common/SymmetricKey.php index 773079f8..f58b5553 100644 --- a/phpseclib/Crypt/Common/SymmetricKey.php +++ b/phpseclib/Crypt/Common/SymmetricKey.php @@ -64,7 +64,7 @@ abstract class SymmetricKey * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() */ - const MODE_CTR = -1; + public const MODE_CTR = -1; /** * Encrypt / decrypt using the Electronic Code Book mode. * @@ -72,7 +72,7 @@ abstract class SymmetricKey * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() */ - const MODE_ECB = 1; + public const MODE_ECB = 1; /** * Encrypt / decrypt using the Code Book Chaining mode. * @@ -80,7 +80,7 @@ abstract class SymmetricKey * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() */ - const MODE_CBC = 2; + public const MODE_CBC = 2; /** * Encrypt / decrypt using the Cipher Feedback mode. * @@ -88,21 +88,21 @@ abstract class SymmetricKey * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() */ - const MODE_CFB = 3; + public const MODE_CFB = 3; /** * Encrypt / decrypt using the Cipher Feedback mode (8bit) * * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() */ - const MODE_CFB8 = 7; + public const MODE_CFB8 = 7; /** * Encrypt / decrypt using the Output Feedback mode (8bit) * * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() */ - const MODE_OFB8 = 8; + public const MODE_OFB8 = 8; /** * Encrypt / decrypt using the Output Feedback mode. * @@ -110,7 +110,7 @@ abstract class SymmetricKey * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() */ - const MODE_OFB = 4; + public const MODE_OFB = 4; /** * Encrypt / decrypt using Galois/Counter mode. * @@ -118,21 +118,21 @@ abstract class SymmetricKey * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() */ - const MODE_GCM = 5; + public const MODE_GCM = 5; /** * Encrypt / decrypt using streaming mode. * * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() */ - const MODE_STREAM = 6; + public const MODE_STREAM = 6; /** * Mode Map * * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() */ - const MODE_MAP = [ + public const MODE_MAP = [ 'ctr' => self::MODE_CTR, 'ecb' => self::MODE_ECB, 'cbc' => self::MODE_CBC, @@ -149,47 +149,40 @@ abstract class SymmetricKey * * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() */ - const ENGINE_INTERNAL = 1; + public const ENGINE_INTERNAL = 1; /** * Base value for the eval() implementation $engine switch * * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() */ - const ENGINE_EVAL = 2; - /** - * Base value for the mcrypt implementation $engine switch - * - * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() - */ - const ENGINE_MCRYPT = 3; + public const ENGINE_EVAL = 2; /** * Base value for the openssl implementation $engine switch * * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() */ - const ENGINE_OPENSSL = 4; + public const ENGINE_OPENSSL = 4; /** * Base value for the libsodium implementation $engine switch * * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() */ - const ENGINE_LIBSODIUM = 5; + public const ENGINE_LIBSODIUM = 5; /** * Base value for the openssl / gcm implementation $engine switch * * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() */ - const ENGINE_OPENSSL_GCM = 6; + public const ENGINE_OPENSSL_GCM = 6; /** * Engine Reverse Map * * @see \phpseclib3\Crypt\Common\SymmetricKey::getEngine() */ - const ENGINE_MAP = [ + public const ENGINE_MAP = [ self::ENGINE_INTERNAL => 'PHP', self::ENGINE_EVAL => 'Eval', - self::ENGINE_MCRYPT => 'mcrypt', self::ENGINE_OPENSSL => 'OpenSSL', self::ENGINE_LIBSODIUM => 'libsodium', self::ENGINE_OPENSSL_GCM => 'OpenSSL (GCM)' @@ -270,85 +263,6 @@ abstract class SymmetricKey */ protected $debuffer; - /** - * mcrypt resource for encryption - * - * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. - * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. - * - * @see self::encrypt() - * @var resource - */ - private $enmcrypt; - - /** - * mcrypt resource for decryption - * - * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. - * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. - * - * @see self::decrypt() - * @var resource - */ - private $demcrypt; - - /** - * Does the enmcrypt resource need to be (re)initialized? - * - * @see \phpseclib3\Crypt\Twofish::setKey() - * @see \phpseclib3\Crypt\Twofish::setIV() - * @var bool - */ - private $enchanged = true; - - /** - * Does the demcrypt resource need to be (re)initialized? - * - * @see \phpseclib3\Crypt\Twofish::setKey() - * @see \phpseclib3\Crypt\Twofish::setIV() - * @var bool - */ - private $dechanged = true; - - /** - * mcrypt resource for CFB mode - * - * mcrypt's CFB mode, in (and only in) buffered context, - * is broken, so phpseclib implements the CFB mode by it self, - * even when the mcrypt php extension is available. - * - * In order to do the CFB-mode work (fast) phpseclib - * use a separate ECB-mode mcrypt resource. - * - * @link http://phpseclib.sourceforge.net/cfb-demo.phps - * @see self::encrypt() - * @see self::decrypt() - * @see self::setupMcrypt() - * @var resource - */ - private $ecb; - - /** - * Optimizing value while CFB-encrypting - * - * Only relevant if $continuousBuffer enabled - * and $engine == self::ENGINE_MCRYPT - * - * It's faster to re-init $enmcrypt if - * $buffer bytes > $cfb_init_len than - * using the $ecb resource furthermore. - * - * This value depends of the chosen cipher - * and the time it would be needed for it's - * initialization [by mcrypt_generic_init()] - * which, typically, depends on the complexity - * on its internaly Key-expanding algorithm. - * - * @see self::encrypt() - * @var int - */ - protected $cfb_init_len = 600; - /** * Does internal cipher state need to be (re)initialized? * @@ -391,7 +305,6 @@ abstract class SymmetricKey * - self::ENGINE_LIBSODIUM (very fast, php-extension: libsodium, extension_loaded('libsodium') required) * - self::ENGINE_OPENSSL_GCM (very fast, php-extension: openssl, extension_loaded('openssl') required) * - self::ENGINE_OPENSSL (very fast, php-extension: openssl, extension_loaded('openssl') required) - * - self::ENGINE_MCRYPT (fast, php-extension: mcrypt, extension_loaded('mcrypt') required) * - self::ENGINE_EVAL (medium, pure php-engine, no php-extension required) * - self::ENGINE_INTERNAL (slower, pure php-engine, no php-extension required) * @@ -411,18 +324,6 @@ abstract class SymmetricKey */ private $preferredEngine; - /** - * The mcrypt specific name of the cipher - * - * Only used if $engine == self::ENGINE_MCRYPT - * - * @link http://www.php.net/mcrypt_module_open - * @link http://www.php.net/mcrypt_list_algorithms - * @see self::setupMcrypt() - * @var string - */ - protected $cipher_name_mcrypt; - /** * The openssl specific name of the cipher * @@ -473,14 +374,6 @@ abstract class SymmetricKey */ private $openssl_emulate_ctr = false; - /** - * Don't truncate / null pad key - * - * @see self::clearBuffers() - * @var bool - */ - private $skip_key_adjustment = false; - /** * Has the key length explicitly been set or should it be derived from the key, itself? * @@ -1169,83 +1062,6 @@ abstract class SymmetricKey } } - if ($this->engine === self::ENGINE_MCRYPT) { - set_error_handler(function (): void { - }); - if ($this->enchanged) { - mcrypt_generic_init($this->enmcrypt, $this->key, $this->getIV($this->encryptIV)); - $this->enchanged = false; - } - - // re: {@link http://phpseclib.sourceforge.net/cfb-demo.phps} - // using mcrypt's default handing of CFB the above would output two different things. using phpseclib's - // rewritten CFB implementation the above outputs the same thing twice. - if ($this->mode == self::MODE_CFB && $this->continuousBuffer) { - $block_size = $this->block_size; - $iv = &$this->encryptIV; - $pos = &$this->enbuffer['pos']; - $len = strlen($plaintext); - $ciphertext = ''; - $i = 0; - if ($pos) { - $orig_pos = $pos; - $max = $block_size - $pos; - if ($len >= $max) { - $i = $max; - $len -= $max; - $pos = 0; - } else { - $i = $len; - $pos += $len; - $len = 0; - } - $ciphertext = substr($iv, $orig_pos) ^ $plaintext; - $iv = substr_replace($iv, $ciphertext, $orig_pos, $i); - $this->enbuffer['enmcrypt_init'] = true; - } - if ($len >= $block_size) { - if ($this->enbuffer['enmcrypt_init'] === false || $len > $this->cfb_init_len) { - if ($this->enbuffer['enmcrypt_init'] === true) { - mcrypt_generic_init($this->enmcrypt, $this->key, $iv); - $this->enbuffer['enmcrypt_init'] = false; - } - $ciphertext .= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % $block_size)); - $iv = substr($ciphertext, -$block_size); - $len %= $block_size; - } else { - while ($len >= $block_size) { - $iv = mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, $block_size); - $ciphertext .= $iv; - $len -= $block_size; - $i += $block_size; - } - } - } - - if ($len) { - $iv = mcrypt_generic($this->ecb, $iv); - $block = $iv ^ substr($plaintext, -$len); - $iv = substr_replace($iv, $block, 0, $len); - $ciphertext .= $block; - $pos = $len; - } - - restore_error_handler(); - - return $ciphertext; - } - - $ciphertext = mcrypt_generic($this->enmcrypt, $plaintext); - - if (!$this->continuousBuffer) { - mcrypt_generic_init($this->enmcrypt, $this->key, $this->getIV($this->encryptIV)); - } - - restore_error_handler(); - - return $ciphertext; - } - if ($this->engine === self::ENGINE_EVAL) { $inline = $this->inline_crypt; return $inline('encrypt', $plaintext); @@ -1558,66 +1374,6 @@ abstract class SymmetricKey return $this->paddable ? $this->unpad($plaintext) : $plaintext; } - if ($this->engine === self::ENGINE_MCRYPT) { - set_error_handler(function (): void { - }); - $block_size = $this->block_size; - if ($this->dechanged) { - mcrypt_generic_init($this->demcrypt, $this->key, $this->getIV($this->decryptIV)); - $this->dechanged = false; - } - - if ($this->mode == self::MODE_CFB && $this->continuousBuffer) { - $iv = &$this->decryptIV; - $pos = &$this->debuffer['pos']; - $len = strlen($ciphertext); - $plaintext = ''; - $i = 0; - if ($pos) { - $orig_pos = $pos; - $max = $block_size - $pos; - if ($len >= $max) { - $i = $max; - $len -= $max; - $pos = 0; - } else { - $i = $len; - $pos += $len; - $len = 0; - } - // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize - $plaintext = substr($iv, $orig_pos) ^ $ciphertext; - $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i); - } - if ($len >= $block_size) { - $cb = substr($ciphertext, $i, $len - $len % $block_size); - $plaintext .= mcrypt_generic($this->ecb, $iv . $cb) ^ $cb; - $iv = substr($cb, -$block_size); - $len %= $block_size; - } - if ($len) { - $iv = mcrypt_generic($this->ecb, $iv); - $plaintext .= $iv ^ substr($ciphertext, -$len); - $iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len); - $pos = $len; - } - - restore_error_handler(); - - return $plaintext; - } - - $plaintext = mdecrypt_generic($this->demcrypt, $ciphertext); - - if (!$this->continuousBuffer) { - mcrypt_generic_init($this->demcrypt, $this->key, $this->getIV($this->decryptIV)); - } - - restore_error_handler(); - - return $this->paddable ? $this->unpad($plaintext) : $plaintext; - } - if ($this->engine === self::ENGINE_EVAL) { $inline = $this->inline_crypt; return $inline('decrypt', $ciphertext); @@ -1839,19 +1595,6 @@ abstract class SymmetricKey $this->oldtag = $tag; } - /** - * Get the IV - * - * mcrypt requires an IV even if ECB is used - * - * @see self::encrypt() - * @see self::decrypt() - */ - protected function getIV(string $iv): string - { - return $this->mode == self::MODE_ECB ? str_repeat("\0", $this->block_size) : $iv; - } - /** * OpenSSL CTR Processor * @@ -2144,14 +1887,6 @@ abstract class SymmetricKey } } return false; - case self::ENGINE_MCRYPT: - set_error_handler(function (): void { - }); - $result = $this->cipher_name_mcrypt && - extension_loaded('mcrypt') && - in_array($this->cipher_name_mcrypt, mcrypt_list_algorithms()); - restore_error_handler(); - return $result; case self::ENGINE_EVAL: return method_exists($this, 'setupInlineCrypt'); case self::ENGINE_INTERNAL: @@ -2190,8 +1925,6 @@ abstract class SymmetricKey * * - OpenSSL [very fast] * - * - mcrypt [fast] - * * - Eval [slow] * * - PHP [slowest] @@ -2236,7 +1969,6 @@ abstract class SymmetricKey self::ENGINE_LIBSODIUM, self::ENGINE_OPENSSL_GCM, self::ENGINE_OPENSSL, - self::ENGINE_MCRYPT, self::ENGINE_EVAL ]; if (isset($this->preferredEngine)) { @@ -2256,23 +1988,6 @@ abstract class SymmetricKey $this->engine = self::ENGINE_INTERNAL; } - if ($this->engine != self::ENGINE_MCRYPT && $this->enmcrypt) { - set_error_handler(function (): void { - }); - // Closing the current mcrypt resource(s). _mcryptSetup() will, if needed, - // (re)open them with the module named in $this->cipher_name_mcrypt - mcrypt_module_close($this->enmcrypt); - mcrypt_module_close($this->demcrypt); - $this->enmcrypt = null; - $this->demcrypt = null; - - if ($this->ecb) { - mcrypt_module_close($this->ecb); - $this->ecb = null; - } - restore_error_handler(); - } - $this->changed = $this->nonIVChanged = true; } @@ -2365,42 +2080,6 @@ abstract class SymmetricKey $this->encryptIV = $this->decryptIV = $this->iv; switch ($this->engine) { - case self::ENGINE_MCRYPT: - $this->enchanged = $this->dechanged = true; - - set_error_handler(function (): void { - }); - - if (!isset($this->enmcrypt)) { - static $mcrypt_modes = [ - self::MODE_CTR => 'ctr', - self::MODE_ECB => MCRYPT_MODE_ECB, - self::MODE_CBC => MCRYPT_MODE_CBC, - self::MODE_CFB => 'ncfb', - self::MODE_CFB8 => MCRYPT_MODE_CFB, - self::MODE_OFB => MCRYPT_MODE_NOFB, - self::MODE_OFB8 => MCRYPT_MODE_OFB, - self::MODE_STREAM => MCRYPT_MODE_STREAM, - ]; - - $this->demcrypt = mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], ''); - $this->enmcrypt = mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], ''); - - // we need the $ecb mcrypt resource (only) in MODE_CFB with enableContinuousBuffer() - // to workaround mcrypt's broken ncfb implementation in buffered mode - // see: {@link http://phpseclib.sourceforge.net/cfb-demo.phps} - if ($this->mode == self::MODE_CFB) { - $this->ecb = mcrypt_module_open($this->cipher_name_mcrypt, '', MCRYPT_MODE_ECB, ''); - } - } // else should mcrypt_generic_deinit be called? - - if ($this->mode == self::MODE_CFB) { - mcrypt_generic_init($this->ecb, $this->key, str_repeat("\0", $this->block_size)); - } - - restore_error_handler(); - - break; case self::ENGINE_INTERNAL: $this->setupKey(); break; @@ -2459,7 +2138,7 @@ abstract class SymmetricKey return $text; } - $length = ord($text[strlen($text) - 1]); + $length = ord($text[-1]); if (!$length || $length > $this->block_size) { throw new BadDecryptionException("The ciphertext has an invalid padding length ($length) compared to the block size ({$this->block_size})"); @@ -2631,7 +2310,6 @@ abstract class SymmetricKey * ]; * * - * @return string (the name of the created callback function) * @see self::decrypt() * @see self::setupInlineCrypt() * @see self::encrypt() @@ -3071,9 +2749,25 @@ abstract class SymmetricKey // Before discrediting this, please read the following: // @see https://github.com/phpseclib/phpseclib/issues/1293 // @see https://github.com/phpseclib/phpseclib/pull/1143 - eval('$func = function ($_action, $_text) { ' . $init_crypt . 'if ($_action == "encrypt") { ' . $encrypt . ' } else { ' . $decrypt . ' }};'); + /** @var \Closure $func */ + $func = eval(<<> 3; diff --git a/phpseclib/Crypt/RC4.php b/phpseclib/Crypt/RC4.php index 306d729d..86b360e0 100644 --- a/phpseclib/Crypt/RC4.php +++ b/phpseclib/Crypt/RC4.php @@ -3,7 +3,7 @@ /** * Pure-PHP implementation of RC4. * - * Uses mcrypt, if available, and an internal implementation, otherwise. + * Uses an internal implementation. * * PHP version 5 * @@ -56,12 +56,12 @@ class RC4 extends StreamCipher /** * @see \phpseclib3\Crypt\RC4::_crypt() */ - const ENCRYPT = 0; + public const ENCRYPT = 0; /** * @see \phpseclib3\Crypt\RC4::_crypt() */ - const DECRYPT = 1; + public const DECRYPT = 1; /** * Key Length (in bytes) @@ -71,14 +71,6 @@ class RC4 extends StreamCipher */ protected $key_length = 128; // = 1024 bits - /** - * The mcrypt specific name of the cipher - * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt - * @var string - */ - protected $cipher_name_mcrypt = 'arcfour'; - /** * The Key * diff --git a/phpseclib/Crypt/RSA.php b/phpseclib/Crypt/RSA.php index b8095045..75996236 100644 --- a/phpseclib/Crypt/RSA.php +++ b/phpseclib/Crypt/RSA.php @@ -75,7 +75,7 @@ abstract class RSA extends AsymmetricKey * * @var string */ - const ALGORITHM = 'RSA'; + public const ALGORITHM = 'RSA'; /** * Use {@link http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding Optimal Asymmetric Encryption Padding} @@ -88,7 +88,7 @@ abstract class RSA extends AsymmetricKey * @see self::encrypt() * @see self::decrypt() */ - const ENCRYPTION_OAEP = 1; + public const ENCRYPTION_OAEP = 1; /** * Use PKCS#1 padding. @@ -99,7 +99,7 @@ abstract class RSA extends AsymmetricKey * @see self::encrypt() * @see self::decrypt() */ - const ENCRYPTION_PKCS1 = 2; + public const ENCRYPTION_PKCS1 = 2; /** * Do not use any padding @@ -110,7 +110,7 @@ abstract class RSA extends AsymmetricKey * @see self::encrypt() * @see self::decrypt() */ - const ENCRYPTION_NONE = 4; + public const ENCRYPTION_NONE = 4; /** * Use the Probabilistic Signature Scheme for signing @@ -124,7 +124,7 @@ abstract class RSA extends AsymmetricKey * @see self::verify() * @see self::setHash() */ - const SIGNATURE_PSS = 16; + public const SIGNATURE_PSS = 16; /** * Use a relaxed version of PKCS#1 padding for signature verification @@ -133,7 +133,7 @@ abstract class RSA extends AsymmetricKey * @see self::verify() * @see self::setHash() */ - const SIGNATURE_RELAXED_PKCS1 = 32; + public const SIGNATURE_RELAXED_PKCS1 = 32; /** * Use PKCS#1 padding for signature verification @@ -142,7 +142,7 @@ abstract class RSA extends AsymmetricKey * @see self::verify() * @see self::setHash() */ - const SIGNATURE_PKCS1 = 64; + public const SIGNATURE_PKCS1 = 64; /** * Encryption padding mode @@ -416,7 +416,7 @@ abstract class RSA extends AsymmetricKey /** * OnLoad Handler * - * @return bool + * @return PrivateKey|PublicKey|RSA */ protected static function onLoad(array $components) { diff --git a/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php b/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php index 853a5f16..517e64da 100644 --- a/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php +++ b/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php @@ -34,31 +34,31 @@ abstract class MSBLOB /** * Public/Private Key Pair */ - const PRIVATEKEYBLOB = 0x7; + public const PRIVATEKEYBLOB = 0x7; /** * Public Key */ - const PUBLICKEYBLOB = 0x6; + public const PUBLICKEYBLOB = 0x6; /** * Public Key */ - const PUBLICKEYBLOBEX = 0xA; + public const PUBLICKEYBLOBEX = 0xA; /** * RSA public key exchange algorithm */ - const CALG_RSA_KEYX = 0x0000A400; + public const CALG_RSA_KEYX = 0x0000A400; /** * RSA public key exchange algorithm */ - const CALG_RSA_SIGN = 0x00002400; + public const CALG_RSA_SIGN = 0x00002400; /** * Public Key */ - const RSA1 = 0x31415352; + public const RSA1 = 0x31415352; /** * Private Key */ - const RSA2 = 0x32415352; + public const RSA2 = 0x32415352; /** * Break a public or private key down into its constituent components diff --git a/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php b/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php index 569ce086..b37f5b25 100644 --- a/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php +++ b/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php @@ -44,14 +44,14 @@ abstract class PKCS8 extends Progenitor * * @var string */ - const OID_NAME = 'rsaEncryption'; + public const OID_NAME = 'rsaEncryption'; /** * OID Value * * @var string */ - const OID_VALUE = '1.2.840.113549.1.1.1'; + public const OID_VALUE = '1.2.840.113549.1.1.1'; /** * Child OIDs loaded diff --git a/phpseclib/Crypt/RSA/Formats/Keys/PSS.php b/phpseclib/Crypt/RSA/Formats/Keys/PSS.php index 5465cfc1..bc1802b7 100644 --- a/phpseclib/Crypt/RSA/Formats/Keys/PSS.php +++ b/phpseclib/Crypt/RSA/Formats/Keys/PSS.php @@ -43,14 +43,14 @@ abstract class PSS extends Progenitor * * @var string */ - const OID_NAME = 'id-RSASSA-PSS'; + public const OID_NAME = 'id-RSASSA-PSS'; /** * OID Value * * @var string */ - const OID_VALUE = '1.2.840.113549.1.1.10'; + public const OID_VALUE = '1.2.840.113549.1.1.10'; /** * OIDs loaded diff --git a/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php b/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php index 9504184c..14e76c03 100644 --- a/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php +++ b/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php @@ -31,7 +31,7 @@ abstract class PuTTY extends Progenitor * * @var string */ - const PUBLIC_HANDLER = 'phpseclib3\Crypt\RSA\Formats\Keys\OpenSSH'; + public const PUBLIC_HANDLER = 'phpseclib3\Crypt\RSA\Formats\Keys\OpenSSH'; /** * Algorithm Identifier diff --git a/phpseclib/Crypt/RSA/PublicKey.php b/phpseclib/Crypt/RSA/PublicKey.php index f50d5a12..c20f08fd 100644 --- a/phpseclib/Crypt/RSA/PublicKey.php +++ b/phpseclib/Crypt/RSA/PublicKey.php @@ -223,7 +223,7 @@ class PublicKey extends RSA implements Common\PublicKey return false; } - if ($em[strlen($em) - 1] != chr(0xBC)) { + if ($em[-1] != chr(0xBC)) { return false; } diff --git a/phpseclib/Crypt/Rijndael.php b/phpseclib/Crypt/Rijndael.php index f17e2b61..8739588a 100644 --- a/phpseclib/Crypt/Rijndael.php +++ b/phpseclib/Crypt/Rijndael.php @@ -3,7 +3,7 @@ /** * Pure-PHP implementation of Rijndael. * - * Uses mcrypt, if available/possible, and an internal implementation, otherwise. + * Uses an internal implementation. * * PHP version 5 * @@ -13,8 +13,8 @@ * 136-bits it'll be null-padded to 192-bits and 192 bits will be the key length until * {@link self::setKey() setKey()} is called, again, at which point, it'll be recalculated. * - * Not all Rijndael implementations may support 160-bits or 224-bits as the block length / key length. mcrypt, for example, - * does not. AES, itself, only supports block lengths of 128 and key lengths of 128, 192, and 256. + * Not all Rijndael implementations may support 160-bits or 224-bits as the block length / key length. AES, itself, only + * supports block lengths of 128 and key lengths of 128, 192, and 256. * {@link http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=10 Rijndael-ammended.pdf#page=10} defines the * algorithm for block lengths of 192 and 256 but not for block lengths / key lengths of 160 and 224. Indeed, 160 and 224 * are first defined as valid key / block lengths in @@ -68,21 +68,6 @@ use phpseclib3\Exception\InsufficientSetupException; */ class Rijndael extends BlockCipher { - /** - * The mcrypt specific name of the cipher - * - * Mcrypt is useable for 128/192/256-bit $block_size/$key_length. For 160/224 not. - * \phpseclib3\Crypt\Rijndael determines automatically whether mcrypt is useable - * or not for the current $block_size/$key_length. - * In case of, $cipher_name_mcrypt will be set dynamically at run time accordingly. - * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt - * @see \phpseclib3\Crypt\Common\SymmetricKey::engine - * @see self::isValidEngine() - * @var string - */ - protected $cipher_name_mcrypt = 'rijndael-128'; - /** * The Key Schedule * @@ -178,15 +163,11 @@ class Rijndael extends BlockCipher * * Note: phpseclib extends Rijndael (and AES) for using 160- and 224-bit keys but they are officially not defined * and the most (if not all) implementations are not able using 160/224-bit keys but round/pad them up to - * 192/256 bits as, for example, mcrypt will do. + * 192/256 bits as. * * That said, if you want be compatible with other Rijndael and AES implementations, * you should not setKeyLength(160) or setKeyLength(224). * - * Additional: In case of 160- and 224-bit keys, phpseclib will/can, for that reason, not use - * the mcrypt php extension, even if available. - * This results then in slower encryption. - * * @throws \LengthException if the key length is invalid */ public function setKeyLength(int $length): void @@ -287,12 +268,6 @@ class Rijndael extends BlockCipher $this->cipher_name_openssl_ecb = 'aes-' . ($this->key_length << 3) . '-ecb'; $this->cipher_name_openssl = 'aes-' . ($this->key_length << 3) . '-' . $this->openssl_translate_mode(); break; - case self::ENGINE_MCRYPT: - $this->cipher_name_mcrypt = 'rijndael-' . ($this->block_size << 3); - if ($this->key_length % 8) { // is it a 160/224-bit key? - // mcrypt is not usable for them, only for 128/192/256-bit keys - return false; - } } return parent::isValidEngineHelper($engine); diff --git a/phpseclib/Crypt/Salsa20.php b/phpseclib/Crypt/Salsa20.php index 9612678c..e528e286 100644 --- a/phpseclib/Crypt/Salsa20.php +++ b/phpseclib/Crypt/Salsa20.php @@ -51,12 +51,12 @@ class Salsa20 extends StreamCipher /** * @see \phpseclib3\Crypt\Salsa20::crypt() */ - const ENCRYPT = 0; + public const ENCRYPT = 0; /** * @see \phpseclib3\Crypt\Salsa20::crypt() */ - const DECRYPT = 1; + public const DECRYPT = 1; /** * Encryption buffer for continuous mode diff --git a/phpseclib/Crypt/TripleDES.php b/phpseclib/Crypt/TripleDES.php index 6505df17..be743288 100644 --- a/phpseclib/Crypt/TripleDES.php +++ b/phpseclib/Crypt/TripleDES.php @@ -3,7 +3,7 @@ /** * Pure-PHP implementation of Triple DES. * - * Uses mcrypt, if available, and an internal implementation, otherwise. Operates in the EDE3 mode (encrypt-decrypt-encrypt). + * Uses an internal implementation. Operates in the EDE3 mode (encrypt-decrypt-encrypt). * * PHP version 5 * @@ -36,6 +36,8 @@ declare(strict_types=1); namespace phpseclib3\Crypt; +use phpseclib3\Exception\BadModeException; + /** * Pure-PHP implementation of Triple DES. * @@ -48,14 +50,14 @@ class TripleDES extends DES * * Inner chaining is used by SSH-1 and is generally considered to be less secure then outer chaining (self::MODE_CBC3). */ - const MODE_3CBC = -2; + public const MODE_3CBC = -2; /** * Encrypt / decrypt using outer chaining * * Outer chaining is used by SSH-2 and when the mode is set to \phpseclib3\Crypt\Common\BlockCipher::MODE_CBC. */ - const MODE_CBC3 = self::MODE_CBC; + public const MODE_CBC3 = self::MODE_CBC; /** * Key Length (in bytes) @@ -65,23 +67,6 @@ class TripleDES extends DES */ protected $key_length = 24; - /** - * The mcrypt specific name of the cipher - * - * @see \phpseclib3\Crypt\DES::cipher_name_mcrypt - * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt - * @var string - */ - protected $cipher_name_mcrypt = 'tripledes'; - - /** - * Optimizing value while CFB-encrypting - * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len - * @var int - */ - protected $cfb_init_len = 750; - /** * max possible size of $key * @@ -110,8 +95,6 @@ class TripleDES extends DES /** * Default Constructor. * - * Determines whether or not the mcrypt or OpenSSL extensions should be used. - * * $mode could be: * * - ecb @@ -386,7 +369,7 @@ class TripleDES extends DES { switch (true) { // if $key <= 64bits we configure our internal pure-php cipher engine - // to act as regular [1]DES, not as 3DES. mcrypt.so::tripledes does the same. + // to act as regular [1]DES, not as 3DES. case strlen($this->key) <= 8: $this->des_rounds = 1; break; diff --git a/phpseclib/Crypt/Twofish.php b/phpseclib/Crypt/Twofish.php index 6ad04142..9a9b71f6 100644 --- a/phpseclib/Crypt/Twofish.php +++ b/phpseclib/Crypt/Twofish.php @@ -3,7 +3,7 @@ /** * Pure-PHP implementation of Twofish. * - * Uses mcrypt, if available, and an internal implementation, otherwise. + * Uses an internal implementation. * * PHP version 5 * @@ -48,22 +48,6 @@ use phpseclib3\Exception\BadModeException; */ class Twofish extends BlockCipher { - /** - * The mcrypt specific name of the cipher - * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt - * @var string - */ - protected $cipher_name_mcrypt = 'twofish'; - - /** - * Optimizing value while CFB-encrypting - * - * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len - * @var int - */ - protected $cfb_init_len = 800; - /** * Q-Table * diff --git a/phpseclib/File/ANSI.php b/phpseclib/File/ANSI.php index 78327fac..9ca32810 100644 --- a/phpseclib/File/ANSI.php +++ b/phpseclib/File/ANSI.php @@ -76,13 +76,6 @@ class ANSI */ private $y; - /** - * Old Column - * - * @var int - */ - private $old_x; - /** * Old Row * @@ -221,7 +214,6 @@ 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; @@ -261,17 +253,14 @@ 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; diff --git a/phpseclib/File/ASN1.php b/phpseclib/File/ASN1.php index 20c0ae63..f6180627 100644 --- a/phpseclib/File/ASN1.php +++ b/phpseclib/File/ASN1.php @@ -38,49 +38,49 @@ abstract class ASN1 { // Tag Classes // http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=12 - const CLASS_UNIVERSAL = 0; - const CLASS_APPLICATION = 1; - const CLASS_CONTEXT_SPECIFIC = 2; - const CLASS_PRIVATE = 3; + public const CLASS_UNIVERSAL = 0; + public const CLASS_APPLICATION = 1; + public const CLASS_CONTEXT_SPECIFIC = 2; + public const CLASS_PRIVATE = 3; // Tag Classes // http://www.obj-sys.com/asn1tutorial/node124.html - const TYPE_BOOLEAN = 1; - const TYPE_INTEGER = 2; - const TYPE_BIT_STRING = 3; - const TYPE_OCTET_STRING = 4; - const TYPE_NULL = 5; - const TYPE_OBJECT_IDENTIFIER = 6; + public const TYPE_BOOLEAN = 1; + public const TYPE_INTEGER = 2; + public const TYPE_BIT_STRING = 3; + public const TYPE_OCTET_STRING = 4; + public const TYPE_NULL = 5; + public const TYPE_OBJECT_IDENTIFIER = 6; //const TYPE_OBJECT_DESCRIPTOR = 7; //const TYPE_INSTANCE_OF = 8; // EXTERNAL - const TYPE_REAL = 9; - const TYPE_ENUMERATED = 10; + public const TYPE_REAL = 9; + public const TYPE_ENUMERATED = 10; //const TYPE_EMBEDDED = 11; - const TYPE_UTF8_STRING = 12; + public const TYPE_UTF8_STRING = 12; //const TYPE_RELATIVE_OID = 13; - const TYPE_SEQUENCE = 16; // SEQUENCE OF - const TYPE_SET = 17; // SET OF + public const TYPE_SEQUENCE = 16; // SEQUENCE OF + public const TYPE_SET = 17; // SET OF // More Tag Classes // http://www.obj-sys.com/asn1tutorial/node10.html - const TYPE_NUMERIC_STRING = 18; - const TYPE_PRINTABLE_STRING = 19; - const TYPE_TELETEX_STRING = 20; // T61String - const TYPE_VIDEOTEX_STRING = 21; - const TYPE_IA5_STRING = 22; - const TYPE_UTC_TIME = 23; - const TYPE_GENERALIZED_TIME = 24; - const TYPE_GRAPHIC_STRING = 25; - const TYPE_VISIBLE_STRING = 26; // ISO646String - const TYPE_GENERAL_STRING = 27; - const TYPE_UNIVERSAL_STRING = 28; + public const TYPE_NUMERIC_STRING = 18; + public const TYPE_PRINTABLE_STRING = 19; + public const TYPE_TELETEX_STRING = 20; // T61String + public const TYPE_VIDEOTEX_STRING = 21; + public const TYPE_IA5_STRING = 22; + public const TYPE_UTC_TIME = 23; + public const TYPE_GENERALIZED_TIME = 24; + public const TYPE_GRAPHIC_STRING = 25; + public const TYPE_VISIBLE_STRING = 26; // ISO646String + public const TYPE_GENERAL_STRING = 27; + public const TYPE_UNIVERSAL_STRING = 28; //const TYPE_CHARACTER_STRING = 29; - const TYPE_BMP_STRING = 30; + public const TYPE_BMP_STRING = 30; // Tag Aliases // These tags are kinda place holders for other tags. - const TYPE_CHOICE = -1; - const TYPE_ANY = -2; + public const TYPE_CHOICE = -1; + public const TYPE_ANY = -2; /** * ASN.1 object identifiers @@ -144,7 +144,7 @@ abstract class ASN1 * * @var array */ - const ANY_MAP = [ + public const ANY_MAP = [ self::TYPE_BOOLEAN => true, self::TYPE_INTEGER => true, self::TYPE_BIT_STRING => 'bitString', @@ -177,7 +177,7 @@ abstract class ASN1 * * @var array */ - const STRING_TYPE_SIZE = [ + public const STRING_TYPE_SIZE = [ self::TYPE_UTF8_STRING => 0, self::TYPE_BMP_STRING => 2, self::TYPE_UNIVERSAL_STRING => 4, @@ -1217,7 +1217,7 @@ abstract class ASN1 $temp = (chr(0x80) | $submask->toBytes()) . $temp; $part = $part->bitwise_rightShift(7); } - $temp[strlen($temp) - 1] = $temp[strlen($temp) - 1] & chr(0x7F); + $temp[-1] = $temp[-1] & chr(0x7F); } $value .= $temp; } @@ -1257,7 +1257,7 @@ abstract class ASN1 $format .= '.u'; } - if ($content[strlen($content) - 1] == 'Z') { + if ($content[-1] == 'Z') { $content = substr($content, 0, -1) . '+0000'; } diff --git a/phpseclib/File/ASN1/Maps/AccessDescription.php b/phpseclib/File/ASN1/Maps/AccessDescription.php index 63f1cce7..8ee077c2 100644 --- a/phpseclib/File/ASN1/Maps/AccessDescription.php +++ b/phpseclib/File/ASN1/Maps/AccessDescription.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class AccessDescription { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'accessMethod' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], diff --git a/phpseclib/File/ASN1/Maps/AdministrationDomainName.php b/phpseclib/File/ASN1/Maps/AdministrationDomainName.php index 7a8613bd..1f17f504 100644 --- a/phpseclib/File/ASN1/Maps/AdministrationDomainName.php +++ b/phpseclib/File/ASN1/Maps/AdministrationDomainName.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class AdministrationDomainName { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_CHOICE, // if class isn't present it's assumed to be \phpseclib3\File\ASN1::CLASS_UNIVERSAL or // (if constant is present) \phpseclib3\File\ASN1::CLASS_CONTEXT_SPECIFIC diff --git a/phpseclib/File/ASN1/Maps/AlgorithmIdentifier.php b/phpseclib/File/ASN1/Maps/AlgorithmIdentifier.php index ebaf29ce..6603a7a8 100644 --- a/phpseclib/File/ASN1/Maps/AlgorithmIdentifier.php +++ b/phpseclib/File/ASN1/Maps/AlgorithmIdentifier.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class AlgorithmIdentifier { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'algorithm' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], diff --git a/phpseclib/File/ASN1/Maps/AnotherName.php b/phpseclib/File/ASN1/Maps/AnotherName.php index 8a7050e6..eee3e3ce 100644 --- a/phpseclib/File/ASN1/Maps/AnotherName.php +++ b/phpseclib/File/ASN1/Maps/AnotherName.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class AnotherName { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'type-id' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], diff --git a/phpseclib/File/ASN1/Maps/Attribute.php b/phpseclib/File/ASN1/Maps/Attribute.php index a5f53378..adf39e26 100644 --- a/phpseclib/File/ASN1/Maps/Attribute.php +++ b/phpseclib/File/ASN1/Maps/Attribute.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class Attribute { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'type' => AttributeType::MAP, diff --git a/phpseclib/File/ASN1/Maps/AttributeType.php b/phpseclib/File/ASN1/Maps/AttributeType.php index 1377d128..190d425e 100644 --- a/phpseclib/File/ASN1/Maps/AttributeType.php +++ b/phpseclib/File/ASN1/Maps/AttributeType.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class AttributeType { - const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; + public const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; } diff --git a/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php b/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php index efd69634..f86b01ba 100644 --- a/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php +++ b/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class AttributeTypeAndValue { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'type' => AttributeType::MAP, diff --git a/phpseclib/File/ASN1/Maps/AttributeValue.php b/phpseclib/File/ASN1/Maps/AttributeValue.php index a6eb5e26..aa267f95 100644 --- a/phpseclib/File/ASN1/Maps/AttributeValue.php +++ b/phpseclib/File/ASN1/Maps/AttributeValue.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class AttributeValue { - const MAP = ['type' => ASN1::TYPE_ANY]; + public const MAP = ['type' => ASN1::TYPE_ANY]; } diff --git a/phpseclib/File/ASN1/Maps/Attributes.php b/phpseclib/File/ASN1/Maps/Attributes.php index c593ca94..a20919e4 100644 --- a/phpseclib/File/ASN1/Maps/Attributes.php +++ b/phpseclib/File/ASN1/Maps/Attributes.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class Attributes { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SET, 'min' => 1, 'max' => -1, diff --git a/phpseclib/File/ASN1/Maps/AuthorityInfoAccessSyntax.php b/phpseclib/File/ASN1/Maps/AuthorityInfoAccessSyntax.php index ade5fc8e..c08818b9 100644 --- a/phpseclib/File/ASN1/Maps/AuthorityInfoAccessSyntax.php +++ b/phpseclib/File/ASN1/Maps/AuthorityInfoAccessSyntax.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class AuthorityInfoAccessSyntax { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, diff --git a/phpseclib/File/ASN1/Maps/AuthorityKeyIdentifier.php b/phpseclib/File/ASN1/Maps/AuthorityKeyIdentifier.php index 7e0b3fd2..6fdf13e3 100644 --- a/phpseclib/File/ASN1/Maps/AuthorityKeyIdentifier.php +++ b/phpseclib/File/ASN1/Maps/AuthorityKeyIdentifier.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class AuthorityKeyIdentifier { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'keyIdentifier' => [ diff --git a/phpseclib/File/ASN1/Maps/BaseDistance.php b/phpseclib/File/ASN1/Maps/BaseDistance.php index 8839183a..a19d04e7 100644 --- a/phpseclib/File/ASN1/Maps/BaseDistance.php +++ b/phpseclib/File/ASN1/Maps/BaseDistance.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class BaseDistance { - const MAP = ['type' => ASN1::TYPE_INTEGER]; + public const MAP = ['type' => ASN1::TYPE_INTEGER]; } diff --git a/phpseclib/File/ASN1/Maps/BasicConstraints.php b/phpseclib/File/ASN1/Maps/BasicConstraints.php index 059b7c18..c42d7569 100644 --- a/phpseclib/File/ASN1/Maps/BasicConstraints.php +++ b/phpseclib/File/ASN1/Maps/BasicConstraints.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class BasicConstraints { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'cA' => [ diff --git a/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttribute.php b/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttribute.php index dd2012ba..0336d4b4 100644 --- a/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttribute.php +++ b/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttribute.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class BuiltInDomainDefinedAttribute { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'type' => ['type' => ASN1::TYPE_PRINTABLE_STRING], diff --git a/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttributes.php b/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttributes.php index 937491cb..8e54fead 100644 --- a/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttributes.php +++ b/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttributes.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class BuiltInDomainDefinedAttributes { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => 4, // ub-domain-defined-attributes diff --git a/phpseclib/File/ASN1/Maps/BuiltInStandardAttributes.php b/phpseclib/File/ASN1/Maps/BuiltInStandardAttributes.php index 69317cc3..542329ab 100644 --- a/phpseclib/File/ASN1/Maps/BuiltInStandardAttributes.php +++ b/phpseclib/File/ASN1/Maps/BuiltInStandardAttributes.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class BuiltInStandardAttributes { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'country-name' => ['optional' => true] + CountryName::MAP, diff --git a/phpseclib/File/ASN1/Maps/CPSuri.php b/phpseclib/File/ASN1/Maps/CPSuri.php index 72dc78fb..3da7a0cb 100644 --- a/phpseclib/File/ASN1/Maps/CPSuri.php +++ b/phpseclib/File/ASN1/Maps/CPSuri.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class CPSuri { - const MAP = ['type' => ASN1::TYPE_IA5_STRING]; + public const MAP = ['type' => ASN1::TYPE_IA5_STRING]; } diff --git a/phpseclib/File/ASN1/Maps/CRLDistributionPoints.php b/phpseclib/File/ASN1/Maps/CRLDistributionPoints.php index ddc71bae..46f8d803 100644 --- a/phpseclib/File/ASN1/Maps/CRLDistributionPoints.php +++ b/phpseclib/File/ASN1/Maps/CRLDistributionPoints.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class CRLDistributionPoints { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, diff --git a/phpseclib/File/ASN1/Maps/CRLNumber.php b/phpseclib/File/ASN1/Maps/CRLNumber.php index 95481b8a..d9284879 100644 --- a/phpseclib/File/ASN1/Maps/CRLNumber.php +++ b/phpseclib/File/ASN1/Maps/CRLNumber.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class CRLNumber { - const MAP = ['type' => ASN1::TYPE_INTEGER]; + public const MAP = ['type' => ASN1::TYPE_INTEGER]; } diff --git a/phpseclib/File/ASN1/Maps/CRLReason.php b/phpseclib/File/ASN1/Maps/CRLReason.php index 423cf6cd..6ad5f7ab 100644 --- a/phpseclib/File/ASN1/Maps/CRLReason.php +++ b/phpseclib/File/ASN1/Maps/CRLReason.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class CRLReason { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_ENUMERATED, 'mapping' => [ 'unspecified', diff --git a/phpseclib/File/ASN1/Maps/CertPolicyId.php b/phpseclib/File/ASN1/Maps/CertPolicyId.php index 9e4ee036..326467e8 100644 --- a/phpseclib/File/ASN1/Maps/CertPolicyId.php +++ b/phpseclib/File/ASN1/Maps/CertPolicyId.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class CertPolicyId { - const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; + public const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; } diff --git a/phpseclib/File/ASN1/Maps/Certificate.php b/phpseclib/File/ASN1/Maps/Certificate.php index 11fca6da..042cd471 100644 --- a/phpseclib/File/ASN1/Maps/Certificate.php +++ b/phpseclib/File/ASN1/Maps/Certificate.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class Certificate { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'tbsCertificate' => TBSCertificate::MAP, diff --git a/phpseclib/File/ASN1/Maps/CertificateIssuer.php b/phpseclib/File/ASN1/Maps/CertificateIssuer.php index cfceb653..e1df76a4 100644 --- a/phpseclib/File/ASN1/Maps/CertificateIssuer.php +++ b/phpseclib/File/ASN1/Maps/CertificateIssuer.php @@ -22,5 +22,5 @@ namespace phpseclib3\File\ASN1\Maps; */ abstract class CertificateIssuer { - const MAP = GeneralNames::MAP; + public const MAP = GeneralNames::MAP; } diff --git a/phpseclib/File/ASN1/Maps/CertificateList.php b/phpseclib/File/ASN1/Maps/CertificateList.php index 536f5489..7386178b 100644 --- a/phpseclib/File/ASN1/Maps/CertificateList.php +++ b/phpseclib/File/ASN1/Maps/CertificateList.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class CertificateList { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'tbsCertList' => TBSCertList::MAP, diff --git a/phpseclib/File/ASN1/Maps/CertificatePolicies.php b/phpseclib/File/ASN1/Maps/CertificatePolicies.php index 251d1cc5..5f312206 100644 --- a/phpseclib/File/ASN1/Maps/CertificatePolicies.php +++ b/phpseclib/File/ASN1/Maps/CertificatePolicies.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class CertificatePolicies { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, diff --git a/phpseclib/File/ASN1/Maps/CertificateSerialNumber.php b/phpseclib/File/ASN1/Maps/CertificateSerialNumber.php index 4efcb491..cffb0599 100644 --- a/phpseclib/File/ASN1/Maps/CertificateSerialNumber.php +++ b/phpseclib/File/ASN1/Maps/CertificateSerialNumber.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class CertificateSerialNumber { - const MAP = ['type' => ASN1::TYPE_INTEGER]; + public const MAP = ['type' => ASN1::TYPE_INTEGER]; } diff --git a/phpseclib/File/ASN1/Maps/CertificationRequest.php b/phpseclib/File/ASN1/Maps/CertificationRequest.php index 0102b1cf..87cc9506 100644 --- a/phpseclib/File/ASN1/Maps/CertificationRequest.php +++ b/phpseclib/File/ASN1/Maps/CertificationRequest.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class CertificationRequest { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'certificationRequestInfo' => CertificationRequestInfo::MAP, diff --git a/phpseclib/File/ASN1/Maps/CertificationRequestInfo.php b/phpseclib/File/ASN1/Maps/CertificationRequestInfo.php index 52434a62..8c98b248 100644 --- a/phpseclib/File/ASN1/Maps/CertificationRequestInfo.php +++ b/phpseclib/File/ASN1/Maps/CertificationRequestInfo.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class CertificationRequestInfo { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'version' => [ diff --git a/phpseclib/File/ASN1/Maps/Characteristic_two.php b/phpseclib/File/ASN1/Maps/Characteristic_two.php index 9f57cb6a..a95c6804 100644 --- a/phpseclib/File/ASN1/Maps/Characteristic_two.php +++ b/phpseclib/File/ASN1/Maps/Characteristic_two.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class Characteristic_two { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'm' => ['type' => ASN1::TYPE_INTEGER], // field size 2**m diff --git a/phpseclib/File/ASN1/Maps/CountryName.php b/phpseclib/File/ASN1/Maps/CountryName.php index 7be8515c..f4f18659 100644 --- a/phpseclib/File/ASN1/Maps/CountryName.php +++ b/phpseclib/File/ASN1/Maps/CountryName.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class CountryName { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_CHOICE, // if class isn't present it's assumed to be \phpseclib3\File\ASN1::CLASS_UNIVERSAL or // (if constant is present) \phpseclib3\File\ASN1::CLASS_CONTEXT_SPECIFIC diff --git a/phpseclib/File/ASN1/Maps/Curve.php b/phpseclib/File/ASN1/Maps/Curve.php index 8fcc985f..fe921357 100644 --- a/phpseclib/File/ASN1/Maps/Curve.php +++ b/phpseclib/File/ASN1/Maps/Curve.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class Curve { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'a' => FieldElement::MAP, diff --git a/phpseclib/File/ASN1/Maps/DHParameter.php b/phpseclib/File/ASN1/Maps/DHParameter.php index d1e13e00..e9cd1ffb 100644 --- a/phpseclib/File/ASN1/Maps/DHParameter.php +++ b/phpseclib/File/ASN1/Maps/DHParameter.php @@ -26,7 +26,7 @@ use phpseclib3\File\ASN1; */ abstract class DHParameter { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'prime' => ['type' => ASN1::TYPE_INTEGER], diff --git a/phpseclib/File/ASN1/Maps/DSAParams.php b/phpseclib/File/ASN1/Maps/DSAParams.php index 136e409f..eb9f125f 100644 --- a/phpseclib/File/ASN1/Maps/DSAParams.php +++ b/phpseclib/File/ASN1/Maps/DSAParams.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class DSAParams { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'p' => ['type' => ASN1::TYPE_INTEGER], diff --git a/phpseclib/File/ASN1/Maps/DSAPrivateKey.php b/phpseclib/File/ASN1/Maps/DSAPrivateKey.php index 07e1c5f4..cb277c6b 100644 --- a/phpseclib/File/ASN1/Maps/DSAPrivateKey.php +++ b/phpseclib/File/ASN1/Maps/DSAPrivateKey.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class DSAPrivateKey { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'version' => ['type' => ASN1::TYPE_INTEGER], diff --git a/phpseclib/File/ASN1/Maps/DSAPublicKey.php b/phpseclib/File/ASN1/Maps/DSAPublicKey.php index b7eb1637..3842c390 100644 --- a/phpseclib/File/ASN1/Maps/DSAPublicKey.php +++ b/phpseclib/File/ASN1/Maps/DSAPublicKey.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class DSAPublicKey { - const MAP = ['type' => ASN1::TYPE_INTEGER]; + public const MAP = ['type' => ASN1::TYPE_INTEGER]; } diff --git a/phpseclib/File/ASN1/Maps/DigestInfo.php b/phpseclib/File/ASN1/Maps/DigestInfo.php index fb056c09..a25d8b0f 100644 --- a/phpseclib/File/ASN1/Maps/DigestInfo.php +++ b/phpseclib/File/ASN1/Maps/DigestInfo.php @@ -26,7 +26,7 @@ use phpseclib3\File\ASN1; */ abstract class DigestInfo { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'digestAlgorithm' => AlgorithmIdentifier::MAP, diff --git a/phpseclib/File/ASN1/Maps/DirectoryString.php b/phpseclib/File/ASN1/Maps/DirectoryString.php index 9a6f1af2..c9e3cf51 100644 --- a/phpseclib/File/ASN1/Maps/DirectoryString.php +++ b/phpseclib/File/ASN1/Maps/DirectoryString.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class DirectoryString { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'teletexString' => ['type' => ASN1::TYPE_TELETEX_STRING], diff --git a/phpseclib/File/ASN1/Maps/DisplayText.php b/phpseclib/File/ASN1/Maps/DisplayText.php index 5c43b662..7f0fa88f 100644 --- a/phpseclib/File/ASN1/Maps/DisplayText.php +++ b/phpseclib/File/ASN1/Maps/DisplayText.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class DisplayText { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'ia5String' => ['type' => ASN1::TYPE_IA5_STRING], diff --git a/phpseclib/File/ASN1/Maps/DistributionPoint.php b/phpseclib/File/ASN1/Maps/DistributionPoint.php index 818fbe82..76a5d249 100644 --- a/phpseclib/File/ASN1/Maps/DistributionPoint.php +++ b/phpseclib/File/ASN1/Maps/DistributionPoint.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class DistributionPoint { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'distributionPoint' => [ diff --git a/phpseclib/File/ASN1/Maps/DistributionPointName.php b/phpseclib/File/ASN1/Maps/DistributionPointName.php index ef7dfb14..a3ab8b26 100644 --- a/phpseclib/File/ASN1/Maps/DistributionPointName.php +++ b/phpseclib/File/ASN1/Maps/DistributionPointName.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class DistributionPointName { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'fullName' => [ diff --git a/phpseclib/File/ASN1/Maps/DssSigValue.php b/phpseclib/File/ASN1/Maps/DssSigValue.php index 47defa5c..cb5e3eef 100644 --- a/phpseclib/File/ASN1/Maps/DssSigValue.php +++ b/phpseclib/File/ASN1/Maps/DssSigValue.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class DssSigValue { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'r' => ['type' => ASN1::TYPE_INTEGER], diff --git a/phpseclib/File/ASN1/Maps/ECParameters.php b/phpseclib/File/ASN1/Maps/ECParameters.php index e39bfcb2..a527aa53 100644 --- a/phpseclib/File/ASN1/Maps/ECParameters.php +++ b/phpseclib/File/ASN1/Maps/ECParameters.php @@ -36,7 +36,7 @@ use phpseclib3\File\ASN1; */ abstract class ECParameters { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'namedCurve' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], diff --git a/phpseclib/File/ASN1/Maps/ECPoint.php b/phpseclib/File/ASN1/Maps/ECPoint.php index 95de42e9..530ebcf7 100644 --- a/phpseclib/File/ASN1/Maps/ECPoint.php +++ b/phpseclib/File/ASN1/Maps/ECPoint.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class ECPoint { - const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; + public const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; } diff --git a/phpseclib/File/ASN1/Maps/ECPrivateKey.php b/phpseclib/File/ASN1/Maps/ECPrivateKey.php index cd924985..90f9f540 100644 --- a/phpseclib/File/ASN1/Maps/ECPrivateKey.php +++ b/phpseclib/File/ASN1/Maps/ECPrivateKey.php @@ -26,7 +26,7 @@ use phpseclib3\File\ASN1; */ abstract class ECPrivateKey { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'version' => [ diff --git a/phpseclib/File/ASN1/Maps/EDIPartyName.php b/phpseclib/File/ASN1/Maps/EDIPartyName.php index eedbaba1..08961444 100644 --- a/phpseclib/File/ASN1/Maps/EDIPartyName.php +++ b/phpseclib/File/ASN1/Maps/EDIPartyName.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class EDIPartyName { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'nameAssigner' => [ diff --git a/phpseclib/File/ASN1/Maps/EcdsaSigValue.php b/phpseclib/File/ASN1/Maps/EcdsaSigValue.php index 9a2a3b9e..c1423078 100644 --- a/phpseclib/File/ASN1/Maps/EcdsaSigValue.php +++ b/phpseclib/File/ASN1/Maps/EcdsaSigValue.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class EcdsaSigValue { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'r' => ['type' => ASN1::TYPE_INTEGER], diff --git a/phpseclib/File/ASN1/Maps/EncryptedData.php b/phpseclib/File/ASN1/Maps/EncryptedData.php index 0d23ca4f..45835ce8 100644 --- a/phpseclib/File/ASN1/Maps/EncryptedData.php +++ b/phpseclib/File/ASN1/Maps/EncryptedData.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class EncryptedData { - const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; + public const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; } diff --git a/phpseclib/File/ASN1/Maps/EncryptedPrivateKeyInfo.php b/phpseclib/File/ASN1/Maps/EncryptedPrivateKeyInfo.php index 6e7db22e..375774b5 100644 --- a/phpseclib/File/ASN1/Maps/EncryptedPrivateKeyInfo.php +++ b/phpseclib/File/ASN1/Maps/EncryptedPrivateKeyInfo.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class EncryptedPrivateKeyInfo { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'encryptionAlgorithm' => AlgorithmIdentifier::MAP, diff --git a/phpseclib/File/ASN1/Maps/ExtKeyUsageSyntax.php b/phpseclib/File/ASN1/Maps/ExtKeyUsageSyntax.php index a765e3c8..a0c01945 100644 --- a/phpseclib/File/ASN1/Maps/ExtKeyUsageSyntax.php +++ b/phpseclib/File/ASN1/Maps/ExtKeyUsageSyntax.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class ExtKeyUsageSyntax { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, diff --git a/phpseclib/File/ASN1/Maps/Extension.php b/phpseclib/File/ASN1/Maps/Extension.php index f4a0d1c3..d129ce87 100644 --- a/phpseclib/File/ASN1/Maps/Extension.php +++ b/phpseclib/File/ASN1/Maps/Extension.php @@ -30,7 +30,7 @@ use phpseclib3\File\ASN1; */ abstract class Extension { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'extnId' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], diff --git a/phpseclib/File/ASN1/Maps/ExtensionAttribute.php b/phpseclib/File/ASN1/Maps/ExtensionAttribute.php index b2600101..48712e6d 100644 --- a/phpseclib/File/ASN1/Maps/ExtensionAttribute.php +++ b/phpseclib/File/ASN1/Maps/ExtensionAttribute.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class ExtensionAttribute { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'extension-attribute-type' => [ diff --git a/phpseclib/File/ASN1/Maps/ExtensionAttributes.php b/phpseclib/File/ASN1/Maps/ExtensionAttributes.php index c36878a0..1ac15fe6 100644 --- a/phpseclib/File/ASN1/Maps/ExtensionAttributes.php +++ b/phpseclib/File/ASN1/Maps/ExtensionAttributes.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class ExtensionAttributes { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SET, 'min' => 1, 'max' => 256, // ub-extension-attributes diff --git a/phpseclib/File/ASN1/Maps/Extensions.php b/phpseclib/File/ASN1/Maps/Extensions.php index 16293cde..0b6ff731 100644 --- a/phpseclib/File/ASN1/Maps/Extensions.php +++ b/phpseclib/File/ASN1/Maps/Extensions.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class Extensions { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, // technically, it's MAX, but we'll assume anything < 0 is MAX diff --git a/phpseclib/File/ASN1/Maps/FieldElement.php b/phpseclib/File/ASN1/Maps/FieldElement.php index 3e9b3ed1..0c755b3e 100644 --- a/phpseclib/File/ASN1/Maps/FieldElement.php +++ b/phpseclib/File/ASN1/Maps/FieldElement.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class FieldElement { - const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; + public const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; } diff --git a/phpseclib/File/ASN1/Maps/FieldID.php b/phpseclib/File/ASN1/Maps/FieldID.php index 6461f800..f7191190 100644 --- a/phpseclib/File/ASN1/Maps/FieldID.php +++ b/phpseclib/File/ASN1/Maps/FieldID.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class FieldID { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'fieldType' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], diff --git a/phpseclib/File/ASN1/Maps/GeneralName.php b/phpseclib/File/ASN1/Maps/GeneralName.php index 9ef08dc0..de4a133e 100644 --- a/phpseclib/File/ASN1/Maps/GeneralName.php +++ b/phpseclib/File/ASN1/Maps/GeneralName.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class GeneralName { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'otherName' => [ diff --git a/phpseclib/File/ASN1/Maps/GeneralNames.php b/phpseclib/File/ASN1/Maps/GeneralNames.php index 1a56e03a..a3d980d4 100644 --- a/phpseclib/File/ASN1/Maps/GeneralNames.php +++ b/phpseclib/File/ASN1/Maps/GeneralNames.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class GeneralNames { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, diff --git a/phpseclib/File/ASN1/Maps/GeneralSubtree.php b/phpseclib/File/ASN1/Maps/GeneralSubtree.php index 5f51ec61..da9dfd4e 100644 --- a/phpseclib/File/ASN1/Maps/GeneralSubtree.php +++ b/phpseclib/File/ASN1/Maps/GeneralSubtree.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class GeneralSubtree { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'base' => GeneralName::MAP, diff --git a/phpseclib/File/ASN1/Maps/GeneralSubtrees.php b/phpseclib/File/ASN1/Maps/GeneralSubtrees.php index 58301e7e..3c8e92eb 100644 --- a/phpseclib/File/ASN1/Maps/GeneralSubtrees.php +++ b/phpseclib/File/ASN1/Maps/GeneralSubtrees.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class GeneralSubtrees { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, diff --git a/phpseclib/File/ASN1/Maps/HashAlgorithm.php b/phpseclib/File/ASN1/Maps/HashAlgorithm.php index b7aa799d..dd65c70a 100644 --- a/phpseclib/File/ASN1/Maps/HashAlgorithm.php +++ b/phpseclib/File/ASN1/Maps/HashAlgorithm.php @@ -22,5 +22,5 @@ namespace phpseclib3\File\ASN1\Maps; */ abstract class HashAlgorithm { - const MAP = AlgorithmIdentifier::MAP; + public const MAP = AlgorithmIdentifier::MAP; } diff --git a/phpseclib/File/ASN1/Maps/HoldInstructionCode.php b/phpseclib/File/ASN1/Maps/HoldInstructionCode.php index 6b392fe4..8f499142 100644 --- a/phpseclib/File/ASN1/Maps/HoldInstructionCode.php +++ b/phpseclib/File/ASN1/Maps/HoldInstructionCode.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class HoldInstructionCode { - const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; + public const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; } diff --git a/phpseclib/File/ASN1/Maps/InvalidityDate.php b/phpseclib/File/ASN1/Maps/InvalidityDate.php index 2c89dfeb..6d7af458 100644 --- a/phpseclib/File/ASN1/Maps/InvalidityDate.php +++ b/phpseclib/File/ASN1/Maps/InvalidityDate.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class InvalidityDate { - const MAP = ['type' => ASN1::TYPE_GENERALIZED_TIME]; + public const MAP = ['type' => ASN1::TYPE_GENERALIZED_TIME]; } diff --git a/phpseclib/File/ASN1/Maps/IssuerAltName.php b/phpseclib/File/ASN1/Maps/IssuerAltName.php index 7c895b10..d4c69dd7 100644 --- a/phpseclib/File/ASN1/Maps/IssuerAltName.php +++ b/phpseclib/File/ASN1/Maps/IssuerAltName.php @@ -22,5 +22,5 @@ namespace phpseclib3\File\ASN1\Maps; */ abstract class IssuerAltName { - const MAP = GeneralNames::MAP; + public const MAP = GeneralNames::MAP; } diff --git a/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php b/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php index 79ce51e4..ec7e4eac 100644 --- a/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php +++ b/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class IssuingDistributionPoint { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'distributionPoint' => [ diff --git a/phpseclib/File/ASN1/Maps/KeyIdentifier.php b/phpseclib/File/ASN1/Maps/KeyIdentifier.php index ff62ccaa..753050e9 100644 --- a/phpseclib/File/ASN1/Maps/KeyIdentifier.php +++ b/phpseclib/File/ASN1/Maps/KeyIdentifier.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class KeyIdentifier { - const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; + public const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; } diff --git a/phpseclib/File/ASN1/Maps/KeyPurposeId.php b/phpseclib/File/ASN1/Maps/KeyPurposeId.php index c28a7707..f82705c6 100644 --- a/phpseclib/File/ASN1/Maps/KeyPurposeId.php +++ b/phpseclib/File/ASN1/Maps/KeyPurposeId.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class KeyPurposeId { - const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; + public const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; } diff --git a/phpseclib/File/ASN1/Maps/KeyUsage.php b/phpseclib/File/ASN1/Maps/KeyUsage.php index f252de3c..cbd70f7b 100644 --- a/phpseclib/File/ASN1/Maps/KeyUsage.php +++ b/phpseclib/File/ASN1/Maps/KeyUsage.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class KeyUsage { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_BIT_STRING, 'mapping' => [ 'digitalSignature', diff --git a/phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php b/phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php index 35bee865..097a35dd 100644 --- a/phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php +++ b/phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php @@ -22,5 +22,5 @@ namespace phpseclib3\File\ASN1\Maps; */ abstract class MaskGenAlgorithm { - const MAP = AlgorithmIdentifier::MAP; + public const MAP = AlgorithmIdentifier::MAP; } diff --git a/phpseclib/File/ASN1/Maps/Name.php b/phpseclib/File/ASN1/Maps/Name.php index c11c2891..3b190ea2 100644 --- a/phpseclib/File/ASN1/Maps/Name.php +++ b/phpseclib/File/ASN1/Maps/Name.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class Name { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'rdnSequence' => RDNSequence::MAP diff --git a/phpseclib/File/ASN1/Maps/NameConstraints.php b/phpseclib/File/ASN1/Maps/NameConstraints.php index 7c6725cf..c52188a7 100644 --- a/phpseclib/File/ASN1/Maps/NameConstraints.php +++ b/phpseclib/File/ASN1/Maps/NameConstraints.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class NameConstraints { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'permittedSubtrees' => [ diff --git a/phpseclib/File/ASN1/Maps/NetworkAddress.php b/phpseclib/File/ASN1/Maps/NetworkAddress.php index ce2f2f72..582820fb 100644 --- a/phpseclib/File/ASN1/Maps/NetworkAddress.php +++ b/phpseclib/File/ASN1/Maps/NetworkAddress.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class NetworkAddress { - const MAP = ['type' => ASN1::TYPE_NUMERIC_STRING]; + public const MAP = ['type' => ASN1::TYPE_NUMERIC_STRING]; } diff --git a/phpseclib/File/ASN1/Maps/NoticeReference.php b/phpseclib/File/ASN1/Maps/NoticeReference.php index dbaa9122..e29473d6 100644 --- a/phpseclib/File/ASN1/Maps/NoticeReference.php +++ b/phpseclib/File/ASN1/Maps/NoticeReference.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class NoticeReference { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'organization' => DisplayText::MAP, diff --git a/phpseclib/File/ASN1/Maps/NumericUserIdentifier.php b/phpseclib/File/ASN1/Maps/NumericUserIdentifier.php index 35a79df2..caaae979 100644 --- a/phpseclib/File/ASN1/Maps/NumericUserIdentifier.php +++ b/phpseclib/File/ASN1/Maps/NumericUserIdentifier.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class NumericUserIdentifier { - const MAP = ['type' => ASN1::TYPE_NUMERIC_STRING]; + public const MAP = ['type' => ASN1::TYPE_NUMERIC_STRING]; } diff --git a/phpseclib/File/ASN1/Maps/ORAddress.php b/phpseclib/File/ASN1/Maps/ORAddress.php index 686b1049..47f781bc 100644 --- a/phpseclib/File/ASN1/Maps/ORAddress.php +++ b/phpseclib/File/ASN1/Maps/ORAddress.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class ORAddress { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'built-in-standard-attributes' => BuiltInStandardAttributes::MAP, diff --git a/phpseclib/File/ASN1/Maps/OneAsymmetricKey.php b/phpseclib/File/ASN1/Maps/OneAsymmetricKey.php index 18113988..6cfb62e6 100644 --- a/phpseclib/File/ASN1/Maps/OneAsymmetricKey.php +++ b/phpseclib/File/ASN1/Maps/OneAsymmetricKey.php @@ -26,7 +26,7 @@ use phpseclib3\File\ASN1; */ abstract class OneAsymmetricKey { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'version' => [ diff --git a/phpseclib/File/ASN1/Maps/OrganizationName.php b/phpseclib/File/ASN1/Maps/OrganizationName.php index 154ee882..2f87c3b4 100644 --- a/phpseclib/File/ASN1/Maps/OrganizationName.php +++ b/phpseclib/File/ASN1/Maps/OrganizationName.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class OrganizationName { - const MAP = ['type' => ASN1::TYPE_PRINTABLE_STRING]; + public const MAP = ['type' => ASN1::TYPE_PRINTABLE_STRING]; } diff --git a/phpseclib/File/ASN1/Maps/OrganizationalUnitNames.php b/phpseclib/File/ASN1/Maps/OrganizationalUnitNames.php index 8c6eec8d..1e62ba0e 100644 --- a/phpseclib/File/ASN1/Maps/OrganizationalUnitNames.php +++ b/phpseclib/File/ASN1/Maps/OrganizationalUnitNames.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class OrganizationalUnitNames { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => 4, // ub-organizational-units diff --git a/phpseclib/File/ASN1/Maps/OtherPrimeInfo.php b/phpseclib/File/ASN1/Maps/OtherPrimeInfo.php index ae9e223c..b8136f13 100644 --- a/phpseclib/File/ASN1/Maps/OtherPrimeInfo.php +++ b/phpseclib/File/ASN1/Maps/OtherPrimeInfo.php @@ -25,7 +25,7 @@ use phpseclib3\File\ASN1; abstract class OtherPrimeInfo { // version must be multi if otherPrimeInfos present - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'prime' => ['type' => ASN1::TYPE_INTEGER], // ri diff --git a/phpseclib/File/ASN1/Maps/OtherPrimeInfos.php b/phpseclib/File/ASN1/Maps/OtherPrimeInfos.php index 364858c6..49d5bf4f 100644 --- a/phpseclib/File/ASN1/Maps/OtherPrimeInfos.php +++ b/phpseclib/File/ASN1/Maps/OtherPrimeInfos.php @@ -25,7 +25,7 @@ use phpseclib3\File\ASN1; abstract class OtherPrimeInfos { // version must be multi if otherPrimeInfos present - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, diff --git a/phpseclib/File/ASN1/Maps/PBEParameter.php b/phpseclib/File/ASN1/Maps/PBEParameter.php index be928486..35bb7fb8 100644 --- a/phpseclib/File/ASN1/Maps/PBEParameter.php +++ b/phpseclib/File/ASN1/Maps/PBEParameter.php @@ -26,7 +26,7 @@ use phpseclib3\File\ASN1; */ abstract class PBEParameter { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'salt' => ['type' => ASN1::TYPE_OCTET_STRING], diff --git a/phpseclib/File/ASN1/Maps/PBES2params.php b/phpseclib/File/ASN1/Maps/PBES2params.php index 873afb78..7f2e5c43 100644 --- a/phpseclib/File/ASN1/Maps/PBES2params.php +++ b/phpseclib/File/ASN1/Maps/PBES2params.php @@ -26,7 +26,7 @@ use phpseclib3\File\ASN1; */ abstract class PBES2params { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'keyDerivationFunc' => AlgorithmIdentifier::MAP, diff --git a/phpseclib/File/ASN1/Maps/PBKDF2params.php b/phpseclib/File/ASN1/Maps/PBKDF2params.php index f124d616..3a1acc7e 100644 --- a/phpseclib/File/ASN1/Maps/PBKDF2params.php +++ b/phpseclib/File/ASN1/Maps/PBKDF2params.php @@ -26,7 +26,7 @@ use phpseclib3\File\ASN1; */ abstract class PBKDF2params { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ // technically, this is a CHOICE in RFC2898 but the other "choice" is, currently, more of a placeholder diff --git a/phpseclib/File/ASN1/Maps/PBMAC1params.php b/phpseclib/File/ASN1/Maps/PBMAC1params.php index f30df5e9..3bd927e8 100644 --- a/phpseclib/File/ASN1/Maps/PBMAC1params.php +++ b/phpseclib/File/ASN1/Maps/PBMAC1params.php @@ -26,7 +26,7 @@ use phpseclib3\File\ASN1; */ abstract class PBMAC1params { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'keyDerivationFunc' => AlgorithmIdentifier::MAP, diff --git a/phpseclib/File/ASN1/Maps/PKCS9String.php b/phpseclib/File/ASN1/Maps/PKCS9String.php index cb166751..dfd9f6bf 100644 --- a/phpseclib/File/ASN1/Maps/PKCS9String.php +++ b/phpseclib/File/ASN1/Maps/PKCS9String.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class PKCS9String { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'ia5String' => ['type' => ASN1::TYPE_IA5_STRING], diff --git a/phpseclib/File/ASN1/Maps/Pentanomial.php b/phpseclib/File/ASN1/Maps/Pentanomial.php index e93d320a..8fb3698c 100644 --- a/phpseclib/File/ASN1/Maps/Pentanomial.php +++ b/phpseclib/File/ASN1/Maps/Pentanomial.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class Pentanomial { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'k1' => ['type' => ASN1::TYPE_INTEGER], // k1 > 0 diff --git a/phpseclib/File/ASN1/Maps/PersonalName.php b/phpseclib/File/ASN1/Maps/PersonalName.php index 5b6443ea..89dc73ba 100644 --- a/phpseclib/File/ASN1/Maps/PersonalName.php +++ b/phpseclib/File/ASN1/Maps/PersonalName.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class PersonalName { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SET, 'children' => [ 'surname' => [ diff --git a/phpseclib/File/ASN1/Maps/PolicyInformation.php b/phpseclib/File/ASN1/Maps/PolicyInformation.php index aebe9b4b..dd0d5a64 100644 --- a/phpseclib/File/ASN1/Maps/PolicyInformation.php +++ b/phpseclib/File/ASN1/Maps/PolicyInformation.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class PolicyInformation { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'policyIdentifier' => CertPolicyId::MAP, diff --git a/phpseclib/File/ASN1/Maps/PolicyMappings.php b/phpseclib/File/ASN1/Maps/PolicyMappings.php index df46ec94..c8cd4e5c 100644 --- a/phpseclib/File/ASN1/Maps/PolicyMappings.php +++ b/phpseclib/File/ASN1/Maps/PolicyMappings.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class PolicyMappings { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, diff --git a/phpseclib/File/ASN1/Maps/PolicyQualifierId.php b/phpseclib/File/ASN1/Maps/PolicyQualifierId.php index 51d9dc9d..5557505e 100644 --- a/phpseclib/File/ASN1/Maps/PolicyQualifierId.php +++ b/phpseclib/File/ASN1/Maps/PolicyQualifierId.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class PolicyQualifierId { - const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; + public const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; } diff --git a/phpseclib/File/ASN1/Maps/PolicyQualifierInfo.php b/phpseclib/File/ASN1/Maps/PolicyQualifierInfo.php index 8f9b30f0..5d24c758 100644 --- a/phpseclib/File/ASN1/Maps/PolicyQualifierInfo.php +++ b/phpseclib/File/ASN1/Maps/PolicyQualifierInfo.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class PolicyQualifierInfo { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'policyQualifierId' => PolicyQualifierId::MAP, diff --git a/phpseclib/File/ASN1/Maps/PostalAddress.php b/phpseclib/File/ASN1/Maps/PostalAddress.php index d84ab3cc..66a9f774 100644 --- a/phpseclib/File/ASN1/Maps/PostalAddress.php +++ b/phpseclib/File/ASN1/Maps/PostalAddress.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class PostalAddress { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'optional' => true, 'min' => 1, diff --git a/phpseclib/File/ASN1/Maps/Prime_p.php b/phpseclib/File/ASN1/Maps/Prime_p.php index aa0e48d3..4209140c 100644 --- a/phpseclib/File/ASN1/Maps/Prime_p.php +++ b/phpseclib/File/ASN1/Maps/Prime_p.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class Prime_p { - const MAP = ['type' => ASN1::TYPE_INTEGER]; + public const MAP = ['type' => ASN1::TYPE_INTEGER]; } diff --git a/phpseclib/File/ASN1/Maps/PrivateDomainName.php b/phpseclib/File/ASN1/Maps/PrivateDomainName.php index 37e8a1c4..53a8770c 100644 --- a/phpseclib/File/ASN1/Maps/PrivateDomainName.php +++ b/phpseclib/File/ASN1/Maps/PrivateDomainName.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class PrivateDomainName { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'numeric' => ['type' => ASN1::TYPE_NUMERIC_STRING], diff --git a/phpseclib/File/ASN1/Maps/PrivateKey.php b/phpseclib/File/ASN1/Maps/PrivateKey.php index fd6bc11d..c7f8f92f 100644 --- a/phpseclib/File/ASN1/Maps/PrivateKey.php +++ b/phpseclib/File/ASN1/Maps/PrivateKey.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class PrivateKey { - const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; + public const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; } diff --git a/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php b/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php index 255df725..eaccade8 100644 --- a/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php +++ b/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class PrivateKeyInfo { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'version' => [ diff --git a/phpseclib/File/ASN1/Maps/PrivateKeyUsagePeriod.php b/phpseclib/File/ASN1/Maps/PrivateKeyUsagePeriod.php index a5459990..530e1e00 100644 --- a/phpseclib/File/ASN1/Maps/PrivateKeyUsagePeriod.php +++ b/phpseclib/File/ASN1/Maps/PrivateKeyUsagePeriod.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class PrivateKeyUsagePeriod { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'notBefore' => [ diff --git a/phpseclib/File/ASN1/Maps/PublicKey.php b/phpseclib/File/ASN1/Maps/PublicKey.php index 3a99940b..576f1e65 100644 --- a/phpseclib/File/ASN1/Maps/PublicKey.php +++ b/phpseclib/File/ASN1/Maps/PublicKey.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class PublicKey { - const MAP = ['type' => ASN1::TYPE_BIT_STRING]; + public const MAP = ['type' => ASN1::TYPE_BIT_STRING]; } diff --git a/phpseclib/File/ASN1/Maps/PublicKeyAndChallenge.php b/phpseclib/File/ASN1/Maps/PublicKeyAndChallenge.php index c91f010e..a47761e7 100644 --- a/phpseclib/File/ASN1/Maps/PublicKeyAndChallenge.php +++ b/phpseclib/File/ASN1/Maps/PublicKeyAndChallenge.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class PublicKeyAndChallenge { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'spki' => SubjectPublicKeyInfo::MAP, diff --git a/phpseclib/File/ASN1/Maps/PublicKeyInfo.php b/phpseclib/File/ASN1/Maps/PublicKeyInfo.php index 6a612f31..d36b2e3c 100644 --- a/phpseclib/File/ASN1/Maps/PublicKeyInfo.php +++ b/phpseclib/File/ASN1/Maps/PublicKeyInfo.php @@ -27,7 +27,7 @@ use phpseclib3\File\ASN1; */ abstract class PublicKeyInfo { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'publicKeyAlgorithm' => AlgorithmIdentifier::MAP, diff --git a/phpseclib/File/ASN1/Maps/RC2CBCParameter.php b/phpseclib/File/ASN1/Maps/RC2CBCParameter.php index 66dce2c1..158f70b5 100644 --- a/phpseclib/File/ASN1/Maps/RC2CBCParameter.php +++ b/phpseclib/File/ASN1/Maps/RC2CBCParameter.php @@ -26,7 +26,7 @@ use phpseclib3\File\ASN1; */ abstract class RC2CBCParameter { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'rc2ParametersVersion' => [ diff --git a/phpseclib/File/ASN1/Maps/RDNSequence.php b/phpseclib/File/ASN1/Maps/RDNSequence.php index cc3a795b..e62a1d17 100644 --- a/phpseclib/File/ASN1/Maps/RDNSequence.php +++ b/phpseclib/File/ASN1/Maps/RDNSequence.php @@ -30,7 +30,7 @@ use phpseclib3\File\ASN1; */ abstract class RDNSequence { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, // RDNSequence does not define a min or a max, which means it doesn't have one 'min' => 0, diff --git a/phpseclib/File/ASN1/Maps/RSAPrivateKey.php b/phpseclib/File/ASN1/Maps/RSAPrivateKey.php index 735b71a3..75916879 100644 --- a/phpseclib/File/ASN1/Maps/RSAPrivateKey.php +++ b/phpseclib/File/ASN1/Maps/RSAPrivateKey.php @@ -25,7 +25,7 @@ use phpseclib3\File\ASN1; abstract class RSAPrivateKey { // version must be multi if otherPrimeInfos present - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'version' => [ diff --git a/phpseclib/File/ASN1/Maps/RSAPublicKey.php b/phpseclib/File/ASN1/Maps/RSAPublicKey.php index 84272c61..19e964fe 100644 --- a/phpseclib/File/ASN1/Maps/RSAPublicKey.php +++ b/phpseclib/File/ASN1/Maps/RSAPublicKey.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class RSAPublicKey { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'modulus' => ['type' => ASN1::TYPE_INTEGER], diff --git a/phpseclib/File/ASN1/Maps/RSASSA_PSS_params.php b/phpseclib/File/ASN1/Maps/RSASSA_PSS_params.php index 67e55a03..51e7d504 100644 --- a/phpseclib/File/ASN1/Maps/RSASSA_PSS_params.php +++ b/phpseclib/File/ASN1/Maps/RSASSA_PSS_params.php @@ -26,7 +26,7 @@ use phpseclib3\File\ASN1; */ abstract class RSASSA_PSS_params { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'hashAlgorithm' => [ diff --git a/phpseclib/File/ASN1/Maps/ReasonFlags.php b/phpseclib/File/ASN1/Maps/ReasonFlags.php index 218ec19f..9d6e7c43 100644 --- a/phpseclib/File/ASN1/Maps/ReasonFlags.php +++ b/phpseclib/File/ASN1/Maps/ReasonFlags.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class ReasonFlags { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_BIT_STRING, 'mapping' => [ 'unused', diff --git a/phpseclib/File/ASN1/Maps/RelativeDistinguishedName.php b/phpseclib/File/ASN1/Maps/RelativeDistinguishedName.php index ce3ef28d..254f5618 100644 --- a/phpseclib/File/ASN1/Maps/RelativeDistinguishedName.php +++ b/phpseclib/File/ASN1/Maps/RelativeDistinguishedName.php @@ -30,7 +30,7 @@ use phpseclib3\File\ASN1; */ abstract class RelativeDistinguishedName { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SET, 'min' => 1, 'max' => -1, diff --git a/phpseclib/File/ASN1/Maps/RevokedCertificate.php b/phpseclib/File/ASN1/Maps/RevokedCertificate.php index 714e8900..dc535b15 100644 --- a/phpseclib/File/ASN1/Maps/RevokedCertificate.php +++ b/phpseclib/File/ASN1/Maps/RevokedCertificate.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class RevokedCertificate { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'userCertificate' => CertificateSerialNumber::MAP, diff --git a/phpseclib/File/ASN1/Maps/SignedPublicKeyAndChallenge.php b/phpseclib/File/ASN1/Maps/SignedPublicKeyAndChallenge.php index 2f84a907..68ff3be2 100644 --- a/phpseclib/File/ASN1/Maps/SignedPublicKeyAndChallenge.php +++ b/phpseclib/File/ASN1/Maps/SignedPublicKeyAndChallenge.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class SignedPublicKeyAndChallenge { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'publicKeyAndChallenge' => PublicKeyAndChallenge::MAP, diff --git a/phpseclib/File/ASN1/Maps/SpecifiedECDomain.php b/phpseclib/File/ASN1/Maps/SpecifiedECDomain.php index 6699e296..5244c4d9 100644 --- a/phpseclib/File/ASN1/Maps/SpecifiedECDomain.php +++ b/phpseclib/File/ASN1/Maps/SpecifiedECDomain.php @@ -26,7 +26,7 @@ use phpseclib3\File\ASN1; */ abstract class SpecifiedECDomain { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'version' => [ diff --git a/phpseclib/File/ASN1/Maps/SubjectAltName.php b/phpseclib/File/ASN1/Maps/SubjectAltName.php index de3f68d1..7fa74c21 100644 --- a/phpseclib/File/ASN1/Maps/SubjectAltName.php +++ b/phpseclib/File/ASN1/Maps/SubjectAltName.php @@ -22,5 +22,5 @@ namespace phpseclib3\File\ASN1\Maps; */ abstract class SubjectAltName { - const MAP = GeneralNames::MAP; + public const MAP = GeneralNames::MAP; } diff --git a/phpseclib/File/ASN1/Maps/SubjectDirectoryAttributes.php b/phpseclib/File/ASN1/Maps/SubjectDirectoryAttributes.php index 2b32bfe2..91a3319f 100644 --- a/phpseclib/File/ASN1/Maps/SubjectDirectoryAttributes.php +++ b/phpseclib/File/ASN1/Maps/SubjectDirectoryAttributes.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class SubjectDirectoryAttributes { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, diff --git a/phpseclib/File/ASN1/Maps/SubjectInfoAccessSyntax.php b/phpseclib/File/ASN1/Maps/SubjectInfoAccessSyntax.php index 0fce9d43..5d11ea12 100644 --- a/phpseclib/File/ASN1/Maps/SubjectInfoAccessSyntax.php +++ b/phpseclib/File/ASN1/Maps/SubjectInfoAccessSyntax.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class SubjectInfoAccessSyntax { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, diff --git a/phpseclib/File/ASN1/Maps/SubjectPublicKeyInfo.php b/phpseclib/File/ASN1/Maps/SubjectPublicKeyInfo.php index d33fbc31..53006daf 100644 --- a/phpseclib/File/ASN1/Maps/SubjectPublicKeyInfo.php +++ b/phpseclib/File/ASN1/Maps/SubjectPublicKeyInfo.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class SubjectPublicKeyInfo { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'algorithm' => AlgorithmIdentifier::MAP, diff --git a/phpseclib/File/ASN1/Maps/TBSCertList.php b/phpseclib/File/ASN1/Maps/TBSCertList.php index 456750ce..5e7f1658 100644 --- a/phpseclib/File/ASN1/Maps/TBSCertList.php +++ b/phpseclib/File/ASN1/Maps/TBSCertList.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class TBSCertList { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'version' => [ diff --git a/phpseclib/File/ASN1/Maps/TBSCertificate.php b/phpseclib/File/ASN1/Maps/TBSCertificate.php index 852d0e26..907026ad 100644 --- a/phpseclib/File/ASN1/Maps/TBSCertificate.php +++ b/phpseclib/File/ASN1/Maps/TBSCertificate.php @@ -25,7 +25,7 @@ use phpseclib3\File\ASN1; abstract class TBSCertificate { // assert($TBSCertificate['children']['signature'] == $Certificate['children']['signatureAlgorithm']) - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ // technically, default implies optional, but we'll define it as being optional, none-the-less, just to diff --git a/phpseclib/File/ASN1/Maps/TerminalIdentifier.php b/phpseclib/File/ASN1/Maps/TerminalIdentifier.php index d1ea57f4..3153a99c 100644 --- a/phpseclib/File/ASN1/Maps/TerminalIdentifier.php +++ b/phpseclib/File/ASN1/Maps/TerminalIdentifier.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class TerminalIdentifier { - const MAP = ['type' => ASN1::TYPE_PRINTABLE_STRING]; + public const MAP = ['type' => ASN1::TYPE_PRINTABLE_STRING]; } diff --git a/phpseclib/File/ASN1/Maps/Time.php b/phpseclib/File/ASN1/Maps/Time.php index 231a4934..28f102a5 100644 --- a/phpseclib/File/ASN1/Maps/Time.php +++ b/phpseclib/File/ASN1/Maps/Time.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class Time { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_CHOICE, 'children' => [ 'utcTime' => ['type' => ASN1::TYPE_UTC_TIME], diff --git a/phpseclib/File/ASN1/Maps/Trinomial.php b/phpseclib/File/ASN1/Maps/Trinomial.php index c759bbf3..46c525db 100644 --- a/phpseclib/File/ASN1/Maps/Trinomial.php +++ b/phpseclib/File/ASN1/Maps/Trinomial.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class Trinomial { - const MAP = ['type' => ASN1::TYPE_INTEGER]; + public const MAP = ['type' => ASN1::TYPE_INTEGER]; } diff --git a/phpseclib/File/ASN1/Maps/UniqueIdentifier.php b/phpseclib/File/ASN1/Maps/UniqueIdentifier.php index 278b1a6c..37e4be73 100644 --- a/phpseclib/File/ASN1/Maps/UniqueIdentifier.php +++ b/phpseclib/File/ASN1/Maps/UniqueIdentifier.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class UniqueIdentifier { - const MAP = ['type' => ASN1::TYPE_BIT_STRING]; + public const MAP = ['type' => ASN1::TYPE_BIT_STRING]; } diff --git a/phpseclib/File/ASN1/Maps/UserNotice.php b/phpseclib/File/ASN1/Maps/UserNotice.php index 75ccf210..ffbab9cd 100644 --- a/phpseclib/File/ASN1/Maps/UserNotice.php +++ b/phpseclib/File/ASN1/Maps/UserNotice.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class UserNotice { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'noticeRef' => [ diff --git a/phpseclib/File/ASN1/Maps/Validity.php b/phpseclib/File/ASN1/Maps/Validity.php index b04338af..3f10ab9d 100644 --- a/phpseclib/File/ASN1/Maps/Validity.php +++ b/phpseclib/File/ASN1/Maps/Validity.php @@ -24,7 +24,7 @@ use phpseclib3\File\ASN1; */ abstract class Validity { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_SEQUENCE, 'children' => [ 'notBefore' => Time::MAP, diff --git a/phpseclib/File/ASN1/Maps/netscape_ca_policy_url.php b/phpseclib/File/ASN1/Maps/netscape_ca_policy_url.php index e000ec17..8ee94ac3 100644 --- a/phpseclib/File/ASN1/Maps/netscape_ca_policy_url.php +++ b/phpseclib/File/ASN1/Maps/netscape_ca_policy_url.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class netscape_ca_policy_url { - const MAP = ['type' => ASN1::TYPE_IA5_STRING]; + public const MAP = ['type' => ASN1::TYPE_IA5_STRING]; } diff --git a/phpseclib/File/ASN1/Maps/netscape_cert_type.php b/phpseclib/File/ASN1/Maps/netscape_cert_type.php index d64431bc..c2f062ee 100644 --- a/phpseclib/File/ASN1/Maps/netscape_cert_type.php +++ b/phpseclib/File/ASN1/Maps/netscape_cert_type.php @@ -26,7 +26,7 @@ use phpseclib3\File\ASN1; */ abstract class netscape_cert_type { - const MAP = [ + public const MAP = [ 'type' => ASN1::TYPE_BIT_STRING, 'mapping' => [ 'SSLClient', diff --git a/phpseclib/File/ASN1/Maps/netscape_comment.php b/phpseclib/File/ASN1/Maps/netscape_comment.php index b0f4d046..fd7f0ca3 100644 --- a/phpseclib/File/ASN1/Maps/netscape_comment.php +++ b/phpseclib/File/ASN1/Maps/netscape_comment.php @@ -24,5 +24,5 @@ use phpseclib3\File\ASN1; */ abstract class netscape_comment { - const MAP = ['type' => ASN1::TYPE_IA5_STRING]; + public const MAP = ['type' => ASN1::TYPE_IA5_STRING]; } diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index b9346a7c..7059e5a4 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -54,44 +54,44 @@ class X509 * * Not really used anymore but retained all the same to suppress E_NOTICEs from old installs */ - const VALIDATE_SIGNATURE_BY_CA = 1; + public const VALIDATE_SIGNATURE_BY_CA = 1; /** * Return internal array representation * * @see \phpseclib3\File\X509::getDN() */ - const DN_ARRAY = 0; + public const DN_ARRAY = 0; /** * Return string * * @see \phpseclib3\File\X509::getDN() */ - const DN_STRING = 1; + public const DN_STRING = 1; /** * Return ASN.1 name string * * @see \phpseclib3\File\X509::getDN() */ - const DN_ASN1 = 2; + public const DN_ASN1 = 2; /** * Return OpenSSL compatible array * * @see \phpseclib3\File\X509::getDN() */ - const DN_OPENSSL = 3; + public const DN_OPENSSL = 3; /** * Return canonical ASN.1 RDNs string * * @see \phpseclib3\File\X509::getDN() */ - const DN_CANON = 4; + public const DN_CANON = 4; /** * Return name hash for file indexing * * @see \phpseclib3\File\X509::getDN() */ - const DN_HASH = 5; + public const DN_HASH = 5; /** * Save as PEM @@ -102,7 +102,7 @@ class X509 * @see \phpseclib3\File\X509::saveCSR() * @see \phpseclib3\File\X509::saveCRL() */ - const FORMAT_PEM = 0; + public const FORMAT_PEM = 0; /** * Save as DER * @@ -110,7 +110,7 @@ class X509 * @see \phpseclib3\File\X509::saveCSR() * @see \phpseclib3\File\X509::saveCRL() */ - const FORMAT_DER = 1; + public const FORMAT_DER = 1; /** * Save as a SPKAC * @@ -120,7 +120,7 @@ class X509 * * Only works on CSRs. Not currently supported. */ - const FORMAT_SPKAC = 2; + public const FORMAT_SPKAC = 2; /** * Auto-detect the format * @@ -130,15 +130,15 @@ class X509 * @see \phpseclib3\File\X509::saveCSR() * @see \phpseclib3\File\X509::saveCRL() */ - const FORMAT_AUTO_DETECT = 3; + public const FORMAT_AUTO_DETECT = 3; /** * Attribute value disposition. * If disposition is >= 0, this is the index of the target value. */ - const ATTR_ALL = -1; // All attribute values (array). - const ATTR_APPEND = -2; // Add a value. - const ATTR_REPLACE = -3; // Clear first, then add a value. + public const ATTR_ALL = -1; // All attribute values (array). + public const ATTR_APPEND = -2; // Add a value. + public const ATTR_REPLACE = -3; // Clear first, then add a value. /** * Distinguished Name @@ -161,14 +161,6 @@ class X509 */ private $privateKey; - /** - * Object identifiers for X.509 certificates - * - * @var array - * @link http://en.wikipedia.org/wiki/Object_identifier - */ - private $oids; - /** * The certificate authorities * diff --git a/phpseclib/Math/BigInteger/Engines/BCMath.php b/phpseclib/Math/BigInteger/Engines/BCMath.php index e6fbf5ae..dc0b99d8 100644 --- a/phpseclib/Math/BigInteger/Engines/BCMath.php +++ b/phpseclib/Math/BigInteger/Engines/BCMath.php @@ -31,14 +31,14 @@ class BCMath extends Engine * @see parent::bitwise_leftRotate() * @see parent::bitwise_rightRotate() */ - const FAST_BITWISE = false; + public const FAST_BITWISE = false; /** * Engine Directory * * @see parent::setModExpEngine */ - const ENGINE_DIR = 'BCMath'; + public const ENGINE_DIR = 'BCMath'; /** * Test for engine validity @@ -475,7 +475,7 @@ class BCMath extends Engine if ($this->value === '2') { return true; } - if ($this->value[strlen($this->value) - 1] % 2 == 0) { + if ($this->value[-1] % 2 == 0) { return false; } @@ -503,7 +503,7 @@ class BCMath extends Engine $r_value = &$r->value; $s = 0; // if $n was 1, $r would be 0 and this would be an infinite loop, hence our $this->equals(static::$one[static::class]) check earlier - while ($r_value[strlen($r_value) - 1] % 2 == 0) { + while ($r_value[-1] % 2 == 0) { $r_value = bcdiv($r_value, '2', 0); ++$s; } @@ -562,7 +562,7 @@ class BCMath extends Engine */ public function isOdd(): bool { - return $this->value[strlen($this->value) - 1] % 2 == 1; + return $this->value[-1] % 2 == 1; } /** diff --git a/phpseclib/Math/BigInteger/Engines/BCMath/Base.php b/phpseclib/Math/BigInteger/Engines/BCMath/Base.php index 3ad9c8cd..7bca0b29 100644 --- a/phpseclib/Math/BigInteger/Engines/BCMath/Base.php +++ b/phpseclib/Math/BigInteger/Engines/BCMath/Base.php @@ -29,11 +29,11 @@ abstract class Base extends BCMath * * $cache[self::VARIABLE] tells us whether or not the cached data is still valid. */ - const VARIABLE = 0; + public const VARIABLE = 0; /** * $cache[self::DATA] contains the cached data. */ - const DATA = 1; + public const DATA = 1; /** * Test for engine validity diff --git a/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php b/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php index d3a77eff..511a613e 100644 --- a/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php +++ b/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php @@ -29,11 +29,11 @@ abstract class Barrett extends Base * * $cache[self::VARIABLE] tells us whether or not the cached data is still valid. */ - const VARIABLE = 0; + public const VARIABLE = 0; /** * $cache[self::DATA] contains the cached data. */ - const DATA = 1; + public const DATA = 1; /** * Barrett Modular Reduction diff --git a/phpseclib/Math/BigInteger/Engines/Engine.php b/phpseclib/Math/BigInteger/Engines/Engine.php index 10c10f8b..0a798de2 100644 --- a/phpseclib/Math/BigInteger/Engines/Engine.php +++ b/phpseclib/Math/BigInteger/Engines/Engine.php @@ -28,7 +28,7 @@ use phpseclib3\Math\BigInteger; */ abstract class Engine implements \JsonSerializable { - /* final protected */ const PRIMES = [ + /* final */ protected const PRIMES = [ 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, diff --git a/phpseclib/Math/BigInteger/Engines/GMP.php b/phpseclib/Math/BigInteger/Engines/GMP.php index 842e3227..c6bb0b88 100644 --- a/phpseclib/Math/BigInteger/Engines/GMP.php +++ b/phpseclib/Math/BigInteger/Engines/GMP.php @@ -30,14 +30,14 @@ class GMP extends Engine * @see parent::bitwise_leftRotate() * @see parent::bitwise_rightRotate() */ - const FAST_BITWISE = true; + public const FAST_BITWISE = true; /** * Engine Directory * * @see parent::setModExpEngine */ - const ENGINE_DIR = 'GMP'; + public const ENGINE_DIR = 'GMP'; /** * Test for engine validity diff --git a/phpseclib/Math/BigInteger/Engines/PHP.php b/phpseclib/Math/BigInteger/Engines/PHP.php index a8ea96bc..7016b799 100644 --- a/phpseclib/Math/BigInteger/Engines/PHP.php +++ b/phpseclib/Math/BigInteger/Engines/PHP.php @@ -35,11 +35,11 @@ abstract class PHP extends Engine /** * $result[self::VALUE] contains the value. */ - const VALUE = 0; + public const VALUE = 0; /** * $result[self::SIGN] contains the sign. */ - const SIGN = 1; + public const SIGN = 1; /**#@-*/ /** @@ -47,7 +47,7 @@ abstract class PHP extends Engine * * At what point do we switch between Karatsuba multiplication and schoolbook long multiplication? */ - const KARATSUBA_CUTOFF = 25; + public const KARATSUBA_CUTOFF = 25; /** * Can Bitwise operations be done fast? @@ -55,14 +55,14 @@ abstract class PHP extends Engine * @see parent::bitwise_leftRotate() * @see parent::bitwise_rightRotate() */ - const FAST_BITWISE = true; + public const FAST_BITWISE = true; /** * Engine Directory * * @see parent::setModExpEngine */ - const ENGINE_DIR = 'PHP'; + public const ENGINE_DIR = 'PHP'; /** * Default constructor diff --git a/phpseclib/Math/BigInteger/Engines/PHP/Base.php b/phpseclib/Math/BigInteger/Engines/PHP/Base.php index 60ff9d14..cc4da2a1 100644 --- a/phpseclib/Math/BigInteger/Engines/PHP/Base.php +++ b/phpseclib/Math/BigInteger/Engines/PHP/Base.php @@ -29,11 +29,11 @@ abstract class Base extends PHP * * $cache[self::VARIABLE] tells us whether or not the cached data is still valid. */ - const VARIABLE = 0; + public const VARIABLE = 0; /** * $cache[self::DATA] contains the cached data. */ - const DATA = 1; + public const DATA = 1; /** * Test for engine validity diff --git a/phpseclib/Math/BigInteger/Engines/PHP32.php b/phpseclib/Math/BigInteger/Engines/PHP32.php index 321cfd80..d4987329 100644 --- a/phpseclib/Math/BigInteger/Engines/PHP32.php +++ b/phpseclib/Math/BigInteger/Engines/PHP32.php @@ -25,23 +25,23 @@ namespace phpseclib3\Math\BigInteger\Engines; class PHP32 extends PHP { // Constants used by PHP.php - const BASE = 26; - const BASE_FULL = 0x4000000; - const MAX_DIGIT = 0x3FFFFFF; - const MSB = 0x2000000; + public const BASE = 26; + public const BASE_FULL = 0x4000000; + public const MAX_DIGIT = 0x3FFFFFF; + public const MSB = 0x2000000; /** * MAX10 in greatest MAX10LEN satisfying * MAX10 = 10**MAX10LEN <= 2**BASE. */ - const MAX10 = 10000000; + public const MAX10 = 10000000; /** * MAX10LEN in greatest MAX10LEN satisfying * MAX10 = 10**MAX10LEN <= 2**BASE. */ - const MAX10LEN = 7; - const MAX_DIGIT2 = 4503599627370496; + public const MAX10LEN = 7; + public const MAX_DIGIT2 = 4503599627370496; /** * Initialize a PHP32 BigInteger Engine instance diff --git a/phpseclib/Math/BigInteger/Engines/PHP64.php b/phpseclib/Math/BigInteger/Engines/PHP64.php index 1fd52cd8..43f6f0b5 100644 --- a/phpseclib/Math/BigInteger/Engines/PHP64.php +++ b/phpseclib/Math/BigInteger/Engines/PHP64.php @@ -25,23 +25,23 @@ namespace phpseclib3\Math\BigInteger\Engines; class PHP64 extends PHP { // Constants used by PHP.php - const BASE = 31; - const BASE_FULL = 0x80000000; - const MAX_DIGIT = 0x7FFFFFFF; - const MSB = 0x40000000; + public const BASE = 31; + public const BASE_FULL = 0x80000000; + public const MAX_DIGIT = 0x7FFFFFFF; + public const MSB = 0x40000000; /** * MAX10 in greatest MAX10LEN satisfying * MAX10 = 10**MAX10LEN <= 2**BASE. */ - const MAX10 = 1000000000; + public const MAX10 = 1000000000; /** * MAX10LEN in greatest MAX10LEN satisfying * MAX10 = 10**MAX10LEN <= 2**BASE. */ - const MAX10LEN = 9; - const MAX_DIGIT2 = 4611686018427387904; + public const MAX10LEN = 9; + public const MAX_DIGIT2 = 4611686018427387904; /** * Initialize a PHP64 BigInteger Engine instance diff --git a/phpseclib/Math/Common/FiniteField.php b/phpseclib/Math/Common/FiniteField.php index 2ea5f485..6e097c8d 100644 --- a/phpseclib/Math/Common/FiniteField.php +++ b/phpseclib/Math/Common/FiniteField.php @@ -1,5 +1,7 @@ getBaselineErrorCounts(); + foreach ($errorTypes as $errorType) { + $this->assertArrayNotHasKey(strtoupper($errorType), $baselineErrorCounts); + } + } + + /** + * @return array + */ + private function getBaselineErrorCounts(): array + { + $xmlParser = xml_parser_create('UTF-8'); + $baseline = file_get_contents(__DIR__ . '/../build/psalm_baseline.xml'); + xml_parse_into_struct($xmlParser, $baseline, $values); + + $errorCounts = []; + /** @var array{level: int, type: string, tag: string, attributes: array{OCCURRENCES?: int}} $element */ + foreach ($values as $element) { + if ($element['level'] === 3 && ($element['type'] === 'open' || $element['type'] === 'complete')) { + $errorCounts[$element['tag']] = $errorCounts[$element['tag']] ?? 0; + $occurrences = $element['attributes']['OCCURRENCES'] ?? 1; + $errorCounts[$element['tag']] += $occurrences; + } + } + asort($errorCounts); + return $errorCounts; + } +} diff --git a/tests/Unit/Crypt/AES/McryptTest.php b/tests/Unit/Crypt/AES/McryptTest.php deleted file mode 100644 index e4d74eca..00000000 --- a/tests/Unit/Crypt/AES/McryptTest.php +++ /dev/null @@ -1,19 +0,0 @@ - - * @copyright 2013 Andreas Fischer - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -declare(strict_types=1); - -namespace phpseclib3\Tests\Unit\Crypt\AES; - -class McryptTest extends TestCase -{ - protected function setUp(): void - { - $this->engine = 'mcrypt'; - } -} diff --git a/tests/Unit/Crypt/BlowfishTest.php b/tests/Unit/Crypt/BlowfishTest.php index b9cb7534..903cc99e 100644 --- a/tests/Unit/Crypt/BlowfishTest.php +++ b/tests/Unit/Crypt/BlowfishTest.php @@ -21,7 +21,6 @@ class BlowfishTest extends PhpseclibTestCase $engines = [ 'PHP', 'Eval', - 'mcrypt', 'OpenSSL', ]; @@ -102,13 +101,6 @@ class BlowfishTest extends PhpseclibTestCase $objects[] = $temp; $engines[] = 'internal'; - if ($temp->isValidEngine('mcrypt')) { - $temp = new Blowfish('ctr'); - $temp->setPreferredEngine('mcrypt'); - $objects[] = $temp; - $engines[] = 'mcrypt'; - } - if ($temp->isValidEngine('OpenSSL')) { $temp = new Blowfish('ctr'); $temp->setPreferredEngine('OpenSSL'); diff --git a/tests/Unit/Crypt/GCMTest.php b/tests/Unit/Crypt/GCMTest.php index 8fa43530..de2c688f 100644 --- a/tests/Unit/Crypt/GCMTest.php +++ b/tests/Unit/Crypt/GCMTest.php @@ -23,7 +23,6 @@ class GCMTest extends PhpseclibTestCase $engines = [ 'PHP', 'Eval', - 'mcrypt', 'OpenSSL', 'OpenSSL (GCM)' ]; @@ -134,7 +133,6 @@ class GCMTest extends PhpseclibTestCase $engines = [ 'PHP', 'Eval', - 'mcrypt', 'OpenSSL', 'OpenSSL (GCM)', 'libsodium' diff --git a/tests/Unit/Crypt/RC2Test.php b/tests/Unit/Crypt/RC2Test.php index 3b7ed4ff..18adabaa 100644 --- a/tests/Unit/Crypt/RC2Test.php +++ b/tests/Unit/Crypt/RC2Test.php @@ -18,7 +18,6 @@ class RC2Test extends PhpseclibTestCase public $engines = [ 'PHP', 'Eval', - 'mcrypt', 'OpenSSL', ]; @@ -94,14 +93,6 @@ class RC2Test extends PhpseclibTestCase $result = pack('H*', 'e3b36057f4821346'); $this->assertEquals($result, $internal, 'Failed asserting that the internal engine produced the correct result'); - $rc2->setPreferredEngine('mcrypt'); - if ($rc2->getEngine() == 'mcrypt') { - $mcrypt = $rc2->encrypt('d'); - $this->assertEquals($result, $mcrypt, 'Failed asserting that the mcrypt engine produced the correct result'); - } else { - self::markTestSkipped('Unable to initialize mcrypt engine'); - } - $rc2->setPreferredEngine('OpenSSL'); if ($rc2->getEngine() == 'OpenSSL') { $openssl = $rc2->encrypt('d'); diff --git a/tests/Unit/Crypt/RC4Test.php b/tests/Unit/Crypt/RC4Test.php index 193f59d2..9a52a19f 100644 --- a/tests/Unit/Crypt/RC4Test.php +++ b/tests/Unit/Crypt/RC4Test.php @@ -21,7 +21,6 @@ class RC4Test extends PhpseclibTestCase $engines = [ 'PHP', 'Eval', - 'mcrypt', 'OpenSSL', ]; // tests from https://tools.ietf.org/html/rfc6229 @@ -225,13 +224,6 @@ class RC4Test extends PhpseclibTestCase $objects[] = $temp; $engines[] = 'internal'; - if ($temp->isValidEngine('mcrypt')) { - $temp = new RC4(RC4::MODE_CTR); - $temp->setPreferredEngine('mcrypt'); - $objects[] = $temp; - $engines[] = 'mcrypt'; - } - if ($temp->isValidEngine('openssl')) { $temp = new RC4(RC4::MODE_CTR); $temp->setPreferredEngine('openssl'); diff --git a/tests/Unit/Crypt/RSA/CreateKeyTest.php b/tests/Unit/Crypt/RSA/CreateKeyTest.php index 0de159ad..9cdae7ae 100644 --- a/tests/Unit/Crypt/RSA/CreateKeyTest.php +++ b/tests/Unit/Crypt/RSA/CreateKeyTest.php @@ -38,7 +38,7 @@ class CreateKeyTest extends PhpseclibTestCase */ public function testEncryptDecrypt($args): void { - list($publickey, $privatekey) = $args; + [$publickey, $privatekey] = $args; $ciphertext = $publickey->encrypt('zzz'); $this->assertIsString($ciphertext); $plaintext = $privatekey->decrypt($ciphertext); diff --git a/tests/Unit/Crypt/TripleDESTest.php b/tests/Unit/Crypt/TripleDESTest.php index f9f98848..ed4ccf1d 100644 --- a/tests/Unit/Crypt/TripleDESTest.php +++ b/tests/Unit/Crypt/TripleDESTest.php @@ -18,7 +18,6 @@ class TripleDESTest extends PhpseclibTestCase public $engines = [ 'PHP', 'Eval', - 'mcrypt', 'OpenSSL', ]; @@ -128,7 +127,6 @@ class TripleDESTest extends PhpseclibTestCase $engines = [ 'PHP', 'Eval', - 'mcrypt', 'OpenSSL', ]; diff --git a/tests/Unit/Crypt/TwofishTest.php b/tests/Unit/Crypt/TwofishTest.php index a8645d20..b3cf62df 100644 --- a/tests/Unit/Crypt/TwofishTest.php +++ b/tests/Unit/Crypt/TwofishTest.php @@ -20,7 +20,6 @@ class TwofishTest extends PhpseclibTestCase $engines = [ 'PHP', 'Eval', - 'mcrypt', 'OpenSSL', ]; diff --git a/tests/Unit/Math/BigInteger/TestCase.php b/tests/Unit/Math/BigInteger/TestCase.php index bf27adfe..8ae79d1b 100644 --- a/tests/Unit/Math/BigInteger/TestCase.php +++ b/tests/Unit/Math/BigInteger/TestCase.php @@ -102,7 +102,7 @@ abstract class TestCase extends PhpseclibTestCase $x = $this->getInstance('1180591620717411303425'); // 2**70 + 1 $y = $this->getInstance('12345678910'); - list($q, $r) = $x->divide($y); + [$q, $r] = $x->divide($y); $this->assertSame('95627922070', (string) $q); $this->assertSame('10688759725', (string) $r); @@ -110,7 +110,7 @@ abstract class TestCase extends PhpseclibTestCase $x = $this->getInstance('3369993333393829974333376885877453834204643052817571560137951281152'); $y = $this->getInstance('4294967296'); - list($q, $r) = $x->divide($y); + [$q, $r] = $x->divide($y); $this->assertSame('784637716923335095479473677900958302012794430558004314112', (string) $q); $this->assertSame('0', (string) $r); @@ -118,7 +118,7 @@ abstract class TestCase extends PhpseclibTestCase $x = $this->getInstance('3369993333393829974333376885877453834204643052817571560137951281153'); $y = $this->getInstance('4294967296'); - list($q, $r) = $x->divide($y); + [$q, $r] = $x->divide($y); $this->assertSame('784637716923335095479473677900958302012794430558004314112', (string) $q); $this->assertSame('1', (string) $r); @@ -143,7 +143,7 @@ abstract class TestCase extends PhpseclibTestCase $this->assertSame('4', (string) $c); $d = $a->multiply($c); - list($q, $r) = $d->divide($b); + [$q, $r] = $d->divide($b); $this->assertSame('1', (string) $r); } diff --git a/tests/Unit/Net/SSH2UnitTest.php b/tests/Unit/Net/SSH2UnitTest.php index e94a2f0d..5565cc34 100644 --- a/tests/Unit/Net/SSH2UnitTest.php +++ b/tests/Unit/Net/SSH2UnitTest.php @@ -53,13 +53,8 @@ class SSH2UnitTest extends PhpseclibTestCase if (extension_loaded('openssl')) { $this->assertStringContainsString('openssl', $identifier); - $this->assertStringNotContainsString('mcrypt', $identifier); - } elseif (extension_loaded('mcrypt')) { - $this->assertStringNotContainsString('openssl', $identifier); - $this->assertStringContainsString('mcrypt', $identifier); } else { $this->assertStringNotContainsString('openssl', $identifier); - $this->assertStringNotContainsString('mcrypt', $identifier); } if (extension_loaded('gmp')) {