Merge branch '3.0'

This commit is contained in:
terrafrost 2020-12-30 09:08:16 -06:00
commit bef6b2159c
18 changed files with 226 additions and 145 deletions

View File

@ -56,58 +56,78 @@ use phpseclib3\Exception\UnsupportedAlgorithmException;
*/ */
abstract class SymmetricKey abstract class SymmetricKey
{ {
/**#@+
* @access public
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
*/
/** /**
* Encrypt / decrypt using the Counter mode. * Encrypt / decrypt using the Counter mode.
* *
* Set to -1 since that's what Crypt/Random.php uses to index the CTR mode. * Set to -1 since that's what Crypt/Random.php uses to index the CTR mode.
* *
* @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29 * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29
* @access public
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
*/ */
const MODE_CTR = -1; const MODE_CTR = -1;
/** /**
* Encrypt / decrypt using the Electronic Code Book mode. * Encrypt / decrypt using the Electronic Code Book mode.
* *
* @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29 * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29
* @access public
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
*/ */
const MODE_ECB = 1; const MODE_ECB = 1;
/** /**
* Encrypt / decrypt using the Code Book Chaining mode. * Encrypt / decrypt using the Code Book Chaining mode.
* *
* @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29 * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29
* @access public
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
*/ */
const MODE_CBC = 2; const MODE_CBC = 2;
/** /**
* Encrypt / decrypt using the Cipher Feedback mode. * Encrypt / decrypt using the Cipher Feedback mode.
* *
* @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29 * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29
* @access public
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
*/ */
const MODE_CFB = 3; const MODE_CFB = 3;
/** /**
* Encrypt / decrypt using the Cipher Feedback mode (8bit) * Encrypt / decrypt using the Cipher Feedback mode (8bit)
*
* @access public
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
*/ */
const MODE_CFB8 = 38; const MODE_CFB8 = 38;
/** /**
* Encrypt / decrypt using the Output Feedback mode. * Encrypt / decrypt using the Output Feedback mode.
* *
* @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29 * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29
* @access public
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
*/ */
const MODE_OFB = 4; const MODE_OFB = 4;
/** /**
* Encrypt / decrypt using Galois/Counter mode. * Encrypt / decrypt using Galois/Counter mode.
* *
* @link https://en.wikipedia.org/wiki/Galois/Counter_Mode * @link https://en.wikipedia.org/wiki/Galois/Counter_Mode
* @access public
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
*/ */
const MODE_GCM = 5; const MODE_GCM = 5;
/** /**
* Encrypt / decrypt using streaming mode. * Encrypt / decrypt using streaming mode.
*
* @access public
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
*/ */
const MODE_STREAM = 6; const MODE_STREAM = 6;
/**#@-*/
/** /**
* Mode Map * Mode Map
@ -126,35 +146,48 @@ abstract class SymmetricKey
'stream' => self::MODE_STREAM 'stream' => self::MODE_STREAM
]; ];
/**#@+
* @access private
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
*/
/** /**
* Base value for the internal implementation $engine switch * Base value for the internal implementation $engine switch
*
* @access private
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
*/ */
const ENGINE_INTERNAL = 1; const ENGINE_INTERNAL = 1;
/** /**
* Base value for the eval() implementation $engine switch * Base value for the eval() implementation $engine switch
*
* @access private
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
*/ */
const ENGINE_EVAL = 2; const ENGINE_EVAL = 2;
/** /**
* Base value for the mcrypt implementation $engine switch * Base value for the mcrypt implementation $engine switch
*
* @access private
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
*/ */
const ENGINE_MCRYPT = 3; const ENGINE_MCRYPT = 3;
/** /**
* Base value for the openssl implementation $engine switch * Base value for the openssl implementation $engine switch
*
* @access private
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
*/ */
const ENGINE_OPENSSL = 4; const ENGINE_OPENSSL = 4;
/** /**
* Base value for the libsodium implementation $engine switch * Base value for the libsodium implementation $engine switch
*
* @access private
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
*/ */
const ENGINE_LIBSODIUM = 5; const ENGINE_LIBSODIUM = 5;
/** /**
* Base value for the openssl / gcm implementation $engine switch * Base value for the openssl / gcm implementation $engine switch
*
* @access private
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
*/ */
const ENGINE_OPENSSL_GCM = 6; const ENGINE_OPENSSL_GCM = 6;
/**#@-*/
/** /**
* Engine Reverse Map * Engine Reverse Map

View File

@ -54,20 +54,22 @@ use phpseclib3\Exception\BadModeException;
*/ */
class DES extends BlockCipher class DES extends BlockCipher
{ {
/**#@+ /**
* Contains $keys[self::ENCRYPT]
*
* @access private * @access private
* @see \phpseclib3\Crypt\DES::setupKey() * @see \phpseclib3\Crypt\DES::setupKey()
* @see \phpseclib3\Crypt\DES::processBlock() * @see \phpseclib3\Crypt\DES::processBlock()
*/ */
/**
* Contains $keys[self::ENCRYPT]
*/
const ENCRYPT = 0; const ENCRYPT = 0;
/** /**
* Contains $keys[self::DECRYPT] * Contains $keys[self::DECRYPT]
*
* @access private
* @see \phpseclib3\Crypt\DES::setupKey()
* @see \phpseclib3\Crypt\DES::processBlock()
*/ */
const DECRYPT = 1; const DECRYPT = 1;
/**#@-*/
/** /**
* Block Length of the cipher * Block Length of the cipher

View File

@ -48,15 +48,26 @@ use phpseclib3\Math\PrimeField;
*/ */
class Hash class Hash
{ {
/**#@+ /**
* Padding Types * Padding Types
* *
* @access private * @access private
*/ */
//const PADDING_KECCAK = 1; //const PADDING_KECCAK = 1;
/**
* Padding Types
*
* @access private
*/
const PADDING_SHA3 = 2; const PADDING_SHA3 = 2;
/**
* Padding Types
*
* @access private
*/
const PADDING_SHAKE = 3; const PADDING_SHAKE = 3;
/**#@-*/
/** /**
* Padding Type * Padding Type

View File

@ -55,13 +55,17 @@ use phpseclib3\Crypt\Common\StreamCipher;
*/ */
class RC4 extends StreamCipher class RC4 extends StreamCipher
{ {
/**#@+ /**
* @access private * @access private
* @see \phpseclib3\Crypt\RC4::_crypt() * @see \phpseclib3\Crypt\RC4::_crypt()
*/ */
const ENCRYPT = 0; const ENCRYPT = 0;
/**
* @access private
* @see \phpseclib3\Crypt\RC4::_crypt()
*/
const DECRYPT = 1; const DECRYPT = 1;
/**#@-*/
/** /**
* Key Length (in bytes) * Key Length (in bytes)

View File

@ -80,11 +80,6 @@ abstract class RSA extends AsymmetricKey
*/ */
const ALGORITHM = 'RSA'; const ALGORITHM = 'RSA';
/**#@+
* @access public
* @see self::encrypt()
* @see self::decrypt()
*/
/** /**
* Use {@link http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding Optimal Asymmetric Encryption Padding} * Use {@link http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding Optimal Asymmetric Encryption Padding}
* (OAEP) for encryption / decryption. * (OAEP) for encryption / decryption.
@ -93,6 +88,9 @@ abstract class RSA extends AsymmetricKey
* *
* @see self::setHash() * @see self::setHash()
* @see self::setMGFHash() * @see self::setMGFHash()
* @access public
* @see self::encrypt()
* @see self::decrypt()
*/ */
const ENCRYPTION_OAEP = 1; const ENCRYPTION_OAEP = 1;
/** /**
@ -100,6 +98,10 @@ abstract class RSA extends AsymmetricKey
* *
* Although self::PADDING_OAEP / self::PADDING_PSS offers more security, including PKCS#1 padding is necessary for purposes of backwards * Although self::PADDING_OAEP / self::PADDING_PSS offers more security, including PKCS#1 padding is necessary for purposes of backwards
* compatibility with protocols (like SSH-1) written before OAEP's introduction. * compatibility with protocols (like SSH-1) written before OAEP's introduction.
*
* @access public
* @see self::encrypt()
* @see self::decrypt()
*/ */
const ENCRYPTION_PKCS1 = 2; const ENCRYPTION_PKCS1 = 2;
/** /**
@ -107,16 +109,13 @@ abstract class RSA extends AsymmetricKey
* *
* Although this method is not recommended it can none-the-less sometimes be useful if you're trying to decrypt some legacy * Although this method is not recommended it can none-the-less sometimes be useful if you're trying to decrypt some legacy
* stuff, if you're trying to diagnose why an encrypted message isn't decrypting, etc. * stuff, if you're trying to diagnose why an encrypted message isn't decrypting, etc.
*
* @access public
* @see self::encrypt()
* @see self::decrypt()
*/ */
const ENCRYPTION_NONE = 4; const ENCRYPTION_NONE = 4;
/**#@-*/
/**#@+
* @access public
* @see self::sign()
* @see self::verify()
* @see self::setHash()
*/
/** /**
* Use the Probabilistic Signature Scheme for signing * Use the Probabilistic Signature Scheme for signing
* *
@ -125,17 +124,30 @@ abstract class RSA extends AsymmetricKey
* @see self::setSaltLength() * @see self::setSaltLength()
* @see self::setMGFHash() * @see self::setMGFHash()
* @see self::setHash() * @see self::setHash()
* @see self::sign()
* @see self::verify()
* @see self::setHash()
* @access public
*/ */
const SIGNATURE_PSS = 16; const SIGNATURE_PSS = 16;
/** /**
* Use a relaxed version of PKCS#1 padding for signature verification * Use a relaxed version of PKCS#1 padding for signature verification
*
* @see self::sign()
* @see self::verify()
* @see self::setHash()
* @access public
*/ */
const SIGNATURE_RELAXED_PKCS1 = 32; const SIGNATURE_RELAXED_PKCS1 = 32;
/** /**
* Use PKCS#1 padding for signature verification * Use PKCS#1 padding for signature verification
*
* @see self::sign()
* @see self::verify()
* @see self::setHash()
* @access public
*/ */
const SIGNATURE_PKCS1 = 64; const SIGNATURE_PKCS1 = 64;
/**#@-*/
/** /**
* Encryption padding mode * Encryption padding mode

View File

@ -33,38 +33,48 @@ use phpseclib3\Exception\UnsupportedFormatException;
*/ */
abstract class MSBLOB abstract class MSBLOB
{ {
/**#@+
* @access private
*/
/** /**
* Public/Private Key Pair * Public/Private Key Pair
*
* @access private
*/ */
const PRIVATEKEYBLOB = 0x7; const PRIVATEKEYBLOB = 0x7;
/** /**
* Public Key * Public Key
*
* @access private
*/ */
const PUBLICKEYBLOB = 0x6; const PUBLICKEYBLOB = 0x6;
/** /**
* Public Key * Public Key
*
* @access private
*/ */
const PUBLICKEYBLOBEX = 0xA; const PUBLICKEYBLOBEX = 0xA;
/** /**
* RSA public key exchange algorithm * RSA public key exchange algorithm
*
* @access private
*/ */
const CALG_RSA_KEYX = 0x0000A400; const CALG_RSA_KEYX = 0x0000A400;
/** /**
* RSA public key exchange algorithm * RSA public key exchange algorithm
*
* @access private
*/ */
const CALG_RSA_SIGN = 0x00002400; const CALG_RSA_SIGN = 0x00002400;
/** /**
* Public Key * Public Key
*
* @access private
*/ */
const RSA1 = 0x31415352; const RSA1 = 0x31415352;
/** /**
* Private Key * Private Key
*
* @access private
*/ */
const RSA2 = 0x32415352; const RSA2 = 0x32415352;
/**#@-*/
/** /**
* Break a public or private key down into its constituent components * Break a public or private key down into its constituent components

View File

@ -50,13 +50,17 @@ class Salsa20 extends StreamCipher
*/ */
protected $key_length = 32; // = 256 bits protected $key_length = 32; // = 256 bits
/**#@+ /**
* @access private * @access private
* @see \phpseclib3\Crypt\Salsa20::crypt() * @see \phpseclib3\Crypt\Salsa20::crypt()
*/ */
const ENCRYPT = 0; const ENCRYPT = 0;
/**
* @access private
* @see \phpseclib3\Crypt\Salsa20::crypt()
*/
const DECRYPT = 1; const DECRYPT = 1;
/**#@-*/
/** /**
* Encryption buffer for continuous mode * Encryption buffer for continuous mode

View File

@ -39,24 +39,15 @@ use DateTimeZone;
*/ */
abstract class ASN1 abstract class ASN1
{ {
/**#@+ // Tag Classes
* Tag Classes // http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=12
*
* @access private
* @link http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=12
*/
const CLASS_UNIVERSAL = 0; const CLASS_UNIVERSAL = 0;
const CLASS_APPLICATION = 1; const CLASS_APPLICATION = 1;
const CLASS_CONTEXT_SPECIFIC = 2; const CLASS_CONTEXT_SPECIFIC = 2;
const CLASS_PRIVATE = 3; const CLASS_PRIVATE = 3;
/**#@-*/
/**#@+ // Tag Classes
* Tag Classes // http://www.obj-sys.com/asn1tutorial/node124.html
*
* @access private
* @link http://www.obj-sys.com/asn1tutorial/node124.html
*/
const TYPE_BOOLEAN = 1; const TYPE_BOOLEAN = 1;
const TYPE_INTEGER = 2; const TYPE_INTEGER = 2;
const TYPE_BIT_STRING = 3; const TYPE_BIT_STRING = 3;
@ -72,13 +63,9 @@ abstract class ASN1
//const TYPE_RELATIVE_OID = 13; //const TYPE_RELATIVE_OID = 13;
const TYPE_SEQUENCE = 16; // SEQUENCE OF const TYPE_SEQUENCE = 16; // SEQUENCE OF
const TYPE_SET = 17; // SET OF const TYPE_SET = 17; // SET OF
/**#@-*/
/**#@+ // More Tag Classes
* More Tag Classes // http://www.obj-sys.com/asn1tutorial/node10.html
*
* @access private
* @link http://www.obj-sys.com/asn1tutorial/node10.html
*/
const TYPE_NUMERIC_STRING = 18; const TYPE_NUMERIC_STRING = 18;
const TYPE_PRINTABLE_STRING = 19; const TYPE_PRINTABLE_STRING = 19;
const TYPE_TELETEX_STRING = 20; // T61String const TYPE_TELETEX_STRING = 20; // T61String
@ -92,18 +79,11 @@ abstract class ASN1
const TYPE_UNIVERSAL_STRING = 28; const TYPE_UNIVERSAL_STRING = 28;
//const TYPE_CHARACTER_STRING = 29; //const TYPE_CHARACTER_STRING = 29;
const TYPE_BMP_STRING = 30; const TYPE_BMP_STRING = 30;
/**#@-*/
/**#@+ // Tag Aliases
* Tag Aliases // These tags are kinda place holders for other tags.
*
* These tags are kinda place holders for other tags.
*
* @access private
*/
const TYPE_CHOICE = -1; const TYPE_CHOICE = -1;
const TYPE_ANY = -2; const TYPE_ANY = -2;
/**#@-*/
/** /**
* ASN.1 object identifiers * ASN.1 object identifiers

View File

@ -62,55 +62,77 @@ class X509
*/ */
const VALIDATE_SIGNATURE_BY_CA = 1; const VALIDATE_SIGNATURE_BY_CA = 1;
/**#@+
* @access public
* @see \phpseclib3\File\X509::getDN()
*/
/** /**
* Return internal array representation * Return internal array representation
*
* @access public
* @see \phpseclib3\File\X509::getDN()
*/ */
const DN_ARRAY = 0; const DN_ARRAY = 0;
/** /**
* Return string * Return string
*
* @access public
* @see \phpseclib3\File\X509::getDN()
*/ */
const DN_STRING = 1; const DN_STRING = 1;
/** /**
* Return ASN.1 name string * Return ASN.1 name string
*
* @access public
* @see \phpseclib3\File\X509::getDN()
*/ */
const DN_ASN1 = 2; const DN_ASN1 = 2;
/** /**
* Return OpenSSL compatible array * Return OpenSSL compatible array
*
* @access public
* @see \phpseclib3\File\X509::getDN()
*/ */
const DN_OPENSSL = 3; const DN_OPENSSL = 3;
/** /**
* Return canonical ASN.1 RDNs string * Return canonical ASN.1 RDNs string
*
* @access public
* @see \phpseclib3\File\X509::getDN()
*/ */
const DN_CANON = 4; const DN_CANON = 4;
/** /**
* Return name hash for file indexing * Return name hash for file indexing
*
* @access public
* @see \phpseclib3\File\X509::getDN()
*/ */
const DN_HASH = 5; const DN_HASH = 5;
/**#@-*/
/**#@+ /**
* Save as PEM
*
* ie. a base64-encoded PEM with a header and a footer
*
* @access public * @access public
* @see \phpseclib3\File\X509::saveX509() * @see \phpseclib3\File\X509::saveX509()
* @see \phpseclib3\File\X509::saveCSR() * @see \phpseclib3\File\X509::saveCSR()
* @see \phpseclib3\File\X509::saveCRL() * @see \phpseclib3\File\X509::saveCRL()
*/ */
/**
* Save as PEM
*
* ie. a base64-encoded PEM with a header and a footer
*/
const FORMAT_PEM = 0; const FORMAT_PEM = 0;
/** /**
* Save as DER * Save as DER
*
* @access public
* @see \phpseclib3\File\X509::saveX509()
* @see \phpseclib3\File\X509::saveCSR()
* @see \phpseclib3\File\X509::saveCRL()
*/ */
const FORMAT_DER = 1; const FORMAT_DER = 1;
/** /**
* Save as a SPKAC * Save as a SPKAC
* *
* @access public
* @see \phpseclib3\File\X509::saveX509()
* @see \phpseclib3\File\X509::saveCSR()
* @see \phpseclib3\File\X509::saveCRL()
*
* Only works on CSRs. Not currently supported. * Only works on CSRs. Not currently supported.
*/ */
const FORMAT_SPKAC = 2; const FORMAT_SPKAC = 2;
@ -118,9 +140,13 @@ class X509
* Auto-detect the format * Auto-detect the format
* *
* Used only by the load*() functions * Used only by the load*() functions
*
* @access public
* @see \phpseclib3\File\X509::saveX509()
* @see \phpseclib3\File\X509::saveCSR()
* @see \phpseclib3\File\X509::saveCRL()
*/ */
const FORMAT_AUTO_DETECT = 3; const FORMAT_AUTO_DETECT = 3;
/**#@-*/
/** /**
* Attribute value disposition. * Attribute value disposition.

View File

@ -26,20 +26,20 @@ use phpseclib3\Math\BigInteger\Engines\BCMath;
*/ */
abstract class Base extends BCMath abstract class Base extends BCMath
{ {
/**#@+
* @access private
*/
/** /**
* Cache constants * Cache constants
* *
* $cache[self::VARIABLE] tells us whether or not the cached data is still valid. * $cache[self::VARIABLE] tells us whether or not the cached data is still valid.
*
* @access private
*/ */
const VARIABLE = 0; const VARIABLE = 0;
/** /**
* $cache[self::DATA] contains the cached data. * $cache[self::DATA] contains the cached data.
*
* @access private
*/ */
const DATA = 1; const DATA = 1;
/**#@-*/
/** /**
* Test for engine validity * Test for engine validity

View File

@ -26,20 +26,20 @@ use phpseclib3\Math\BigInteger\Engines\BCMath\Base;
*/ */
abstract class Barrett extends Base abstract class Barrett extends Base
{ {
/**#@+
* @access private
*/
/** /**
* Cache constants * Cache constants
* *
* $cache[self::VARIABLE] tells us whether or not the cached data is still valid. * $cache[self::VARIABLE] tells us whether or not the cached data is still valid.
*
* @access private
*/ */
const VARIABLE = 0; const VARIABLE = 0;
/** /**
* $cache[self::DATA] contains the cached data. * $cache[self::DATA] contains the cached data.
*
* @access private
*/ */
const DATA = 1; const DATA = 1;
/**#@-*/
/** /**
* Barrett Modular Reduction * Barrett Modular Reduction

View File

@ -26,20 +26,20 @@ use phpseclib3\Math\BigInteger\Engines\PHP;
*/ */
abstract class Base extends PHP abstract class Base extends PHP
{ {
/**#@+
* @access private
*/
/** /**
* Cache constants * Cache constants
* *
* $cache[self::VARIABLE] tells us whether or not the cached data is still valid. * $cache[self::VARIABLE] tells us whether or not the cached data is still valid.
*
* @access private
*/ */
const VARIABLE = 0; const VARIABLE = 0;
/** /**
* $cache[self::DATA] contains the cached data. * $cache[self::DATA] contains the cached data.
*
* @access private
*/ */
const DATA = 1; const DATA = 1;
/**#@-*/
/** /**
* Test for engine validity * Test for engine validity

View File

@ -28,9 +28,7 @@ use ParagonIE\ConstantTime\Hex;
*/ */
class PHP32 extends PHP class PHP32 extends PHP
{ {
/**#@+ // Constants used by PHP.php
* Constants used by PHP.php
*/
const BASE = 26; const BASE = 26;
const BASE_FULL = 0x4000000; const BASE_FULL = 0x4000000;
const MAX_DIGIT = 0x3FFFFFF; const MAX_DIGIT = 0x3FFFFFF;

View File

@ -28,9 +28,7 @@ use ParagonIE\ConstantTime\Hex;
*/ */
class PHP64 extends PHP class PHP64 extends PHP
{ {
/**#@+ // Constants used by PHP.php
* Constants used by PHP.php
*/
const BASE = 31; const BASE = 31;
const BASE_FULL = 0x80000000; const BASE_FULL = 0x80000000;
const MAX_DIGIT = 0x7FFFFFFF; const MAX_DIGIT = 0x7FFFFFFF;

View File

@ -61,33 +61,43 @@ class SFTP extends SSH2
*/ */
const CHANNEL = 0x100; const CHANNEL = 0x100;
/**#@+
* @access public
* @see \phpseclib3\Net\SFTP::put()
*/
/** /**
* Reads data from a local file. * Reads data from a local file.
*
* @access public
* @see \phpseclib3\Net\SFTP::put()
*/ */
const SOURCE_LOCAL_FILE = 1; const SOURCE_LOCAL_FILE = 1;
/** /**
* Reads data from a string. * Reads data from a string.
*
* @access public
* @see \phpseclib3\Net\SFTP::put()
*/ */
// this value isn't really used anymore but i'm keeping it reserved for historical reasons // this value isn't really used anymore but i'm keeping it reserved for historical reasons
const SOURCE_STRING = 2; const SOURCE_STRING = 2;
/** /**
* Reads data from callback: * Reads data from callback:
* function callback($length) returns string to proceed, null for EOF * function callback($length) returns string to proceed, null for EOF
*
* @access public
* @see \phpseclib3\Net\SFTP::put()
*/ */
const SOURCE_CALLBACK = 16; const SOURCE_CALLBACK = 16;
/** /**
* Resumes an upload * Resumes an upload
*
* @access public
* @see \phpseclib3\Net\SFTP::put()
*/ */
const RESUME = 4; const RESUME = 4;
/** /**
* Append a local file to an already existing remote file * Append a local file to an already existing remote file
*
* @access public
* @see \phpseclib3\Net\SFTP::put()
*/ */
const RESUME_START = 8; const RESUME_START = 8;
/**#@-*/
/** /**
* Packet Types * Packet Types

View File

@ -80,21 +80,15 @@ use phpseclib3\Common\Functions\Strings;
*/ */
class SSH2 class SSH2
{ {
/**#@+ // Execution Bitmap Masks
* Execution Bitmap Masks
*
* @see \phpseclib3\Net\SSH2::bitmap
* @access private
*/
const MASK_CONSTRUCTOR = 0x00000001; const MASK_CONSTRUCTOR = 0x00000001;
const MASK_CONNECTED = 0x00000002; const MASK_CONNECTED = 0x00000002;
const MASK_LOGIN_REQ = 0x00000004; const MASK_LOGIN_REQ = 0x00000004;
const MASK_LOGIN = 0x00000008; const MASK_LOGIN = 0x00000008;
const MASK_SHELL = 0x00000010; const MASK_SHELL = 0x00000010;
const MASK_WINDOW_ADJUST = 0x00000020; const MASK_WINDOW_ADJUST = 0x00000020;
/**#@-*/
/**#@+ /*
* Channel constants * Channel constants
* *
* RFC4254 refers not to client and server channels but rather to sender and recipient channels. we don't refer * RFC4254 refers not to client and server channels but rather to sender and recipient channels. we don't refer
@ -115,44 +109,55 @@ class SSH2
const CHANNEL_SUBSYSTEM = 3; const CHANNEL_SUBSYSTEM = 3;
const CHANNEL_AGENT_FORWARD = 4; const CHANNEL_AGENT_FORWARD = 4;
const CHANNEL_KEEP_ALIVE = 5; const CHANNEL_KEEP_ALIVE = 5;
/**#@-*/
/**#@+
* @access public
* @see \phpseclib3\Net\SSH2::getLog()
*/
/** /**
* Returns the message numbers * Returns the message numbers
*
* @access public
* @see \phpseclib3\Net\SSH2::getLog()
*/ */
const LOG_SIMPLE = 1; const LOG_SIMPLE = 1;
/** /**
* Returns the message content * Returns the message content
*
* @access public
* @see \phpseclib3\Net\SSH2::getLog()
*/ */
const LOG_COMPLEX = 2; const LOG_COMPLEX = 2;
/** /**
* Outputs the content real-time * Outputs the content real-time
*
* @access public
* @see \phpseclib3\Net\SSH2::getLog()
*/ */
const LOG_REALTIME = 3; const LOG_REALTIME = 3;
/** /**
* Dumps the content real-time to a file * Dumps the content real-time to a file
*
* @access public
* @see \phpseclib3\Net\SSH2::getLog()
*/ */
const LOG_REALTIME_FILE = 4; const LOG_REALTIME_FILE = 4;
/** /**
* Make sure that the log never gets larger than this * Make sure that the log never gets larger than this
*
* @access public
* @see \phpseclib3\Net\SSH2::getLog()
*/ */
const LOG_MAX_SIZE = 1048576; // 1024 * 1024 const LOG_MAX_SIZE = 1048576; // 1024 * 1024
/**#@-*/
/**#@+
* @access public
* @see \phpseclib3\Net\SSH2::read()
*/
/** /**
* Returns when a string matching $expect exactly is found * Returns when a string matching $expect exactly is found
*
* @access public
* @see \phpseclib3\Net\SSH2::read()
*/ */
const READ_SIMPLE = 1; const READ_SIMPLE = 1;
/** /**
* Returns when a string matching the regular expression $expect is found * Returns when a string matching the regular expression $expect is found
*
* @access public
* @see \phpseclib3\Net\SSH2::read()
*/ */
const READ_REGEX = 2; const READ_REGEX = 2;
/** /**
@ -160,9 +165,11 @@ class SSH2
* *
* Some data packets may only contain a single character so it may be necessary * Some data packets may only contain a single character so it may be necessary
* to call read() multiple times when using this option * to call read() multiple times when using this option
*
* @access public
* @see \phpseclib3\Net\SSH2::read()
*/ */
const READ_NEXT = 3; const READ_NEXT = 3;
/**#@-*/
/** /**
* The SSH identifier * The SSH identifier

View File

@ -53,11 +53,8 @@ class Agent
{ {
use Common\Traits\ReadBytes; use Common\Traits\ReadBytes;
/**#@+ // Message numbers
* Message numbers
*
* @access private
*/
// to request SSH1 keys you have to use SSH_AGENTC_REQUEST_RSA_IDENTITIES (1) // to request SSH1 keys you have to use SSH_AGENTC_REQUEST_RSA_IDENTITIES (1)
const SSH_AGENTC_REQUEST_IDENTITIES = 11; const SSH_AGENTC_REQUEST_IDENTITIES = 11;
// this is the SSH2 response; the SSH1 response is SSH_AGENT_RSA_IDENTITIES_ANSWER (2). // this is the SSH2 response; the SSH1 response is SSH_AGENT_RSA_IDENTITIES_ANSWER (2).
@ -66,20 +63,15 @@ class Agent
const SSH_AGENTC_SIGN_REQUEST = 13; const SSH_AGENTC_SIGN_REQUEST = 13;
// the SSH1 response is SSH_AGENT_RSA_RESPONSE (4) // the SSH1 response is SSH_AGENT_RSA_RESPONSE (4)
const SSH_AGENT_SIGN_RESPONSE = 14; const SSH_AGENT_SIGN_RESPONSE = 14;
/**#@-*/
/**@+ // Agent forwarding status
* Agent forwarding status
*
* @access private
*/
// no forwarding requested and not active // no forwarding requested and not active
const FORWARD_NONE = 0; const FORWARD_NONE = 0;
// request agent forwarding when opportune // request agent forwarding when opportune
const FORWARD_REQUEST = 1; const FORWARD_REQUEST = 1;
// forwarding has been request and is active // forwarding has been request and is active
const FORWARD_ACTIVE = 2; const FORWARD_ACTIVE = 2;
/**#@-*/
/** /**
* Unused * Unused

View File

@ -42,16 +42,10 @@ class Identity implements PrivateKey
{ {
use \phpseclib3\System\SSH\Common\Traits\ReadBytes; use \phpseclib3\System\SSH\Common\Traits\ReadBytes;
/**@+ // Signature Flags
* Signature Flags // See https://tools.ietf.org/html/draft-miller-ssh-agent-00#section-5.3
*
* See https://tools.ietf.org/html/draft-miller-ssh-agent-00#section-5.3
*
* @access private
*/
const SSH_AGENT_RSA2_256 = 2; const SSH_AGENT_RSA2_256 = 2;
const SSH_AGENT_RSA2_512 = 4; const SSH_AGENT_RSA2_512 = 4;
/**#@-*/
/** /**
* Key Object * Key Object