mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-15 17:57:12 +00:00
Merge branch '3.0'
This commit is contained in:
commit
bef6b2159c
@ -56,58 +56,78 @@ use phpseclib3\Exception\UnsupportedAlgorithmException;
|
||||
*/
|
||||
abstract class SymmetricKey
|
||||
{
|
||||
/**#@+
|
||||
* @access public
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
|
||||
*/
|
||||
/**
|
||||
* Encrypt / decrypt using the Counter 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
|
||||
* @access public
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
|
||||
*/
|
||||
const MODE_CTR = -1;
|
||||
/**
|
||||
* Encrypt / decrypt using the Electronic Code Book mode.
|
||||
*
|
||||
* @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;
|
||||
/**
|
||||
* Encrypt / decrypt using the Code Book Chaining mode.
|
||||
*
|
||||
* @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;
|
||||
/**
|
||||
* Encrypt / decrypt using the Cipher Feedback mode.
|
||||
*
|
||||
* @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;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* Encrypt / decrypt using the Output Feedback mode.
|
||||
*
|
||||
* @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;
|
||||
/**
|
||||
* Encrypt / decrypt using 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;
|
||||
/**
|
||||
* Encrypt / decrypt using streaming mode.
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
|
||||
*/
|
||||
const MODE_STREAM = 6;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Mode Map
|
||||
@ -126,35 +146,48 @@ abstract class SymmetricKey
|
||||
'stream' => self::MODE_STREAM
|
||||
];
|
||||
|
||||
/**#@+
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
|
||||
*/
|
||||
/**
|
||||
* Base value for the internal implementation $engine switch
|
||||
*
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
|
||||
*/
|
||||
const ENGINE_INTERNAL = 1;
|
||||
/**
|
||||
* Base value for the eval() implementation $engine switch
|
||||
*
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
|
||||
*/
|
||||
const ENGINE_EVAL = 2;
|
||||
/**
|
||||
* Base value for the mcrypt implementation $engine switch
|
||||
*
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
|
||||
*/
|
||||
const ENGINE_MCRYPT = 3;
|
||||
/**
|
||||
* Base value for the openssl implementation $engine switch
|
||||
*
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
|
||||
*/
|
||||
const ENGINE_OPENSSL = 4;
|
||||
/**
|
||||
* Base value for the libsodium implementation $engine switch
|
||||
*
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
|
||||
*/
|
||||
const ENGINE_LIBSODIUM = 5;
|
||||
/**
|
||||
* Base value for the openssl / gcm implementation $engine switch
|
||||
*
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
|
||||
*/
|
||||
const ENGINE_OPENSSL_GCM = 6;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Engine Reverse Map
|
||||
|
@ -54,20 +54,22 @@ use phpseclib3\Exception\BadModeException;
|
||||
*/
|
||||
class DES extends BlockCipher
|
||||
{
|
||||
/**#@+
|
||||
/**
|
||||
* Contains $keys[self::ENCRYPT]
|
||||
*
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\DES::setupKey()
|
||||
* @see \phpseclib3\Crypt\DES::processBlock()
|
||||
*/
|
||||
/**
|
||||
* Contains $keys[self::ENCRYPT]
|
||||
*/
|
||||
const ENCRYPT = 0;
|
||||
/**
|
||||
* Contains $keys[self::DECRYPT]
|
||||
*
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\DES::setupKey()
|
||||
* @see \phpseclib3\Crypt\DES::processBlock()
|
||||
*/
|
||||
const DECRYPT = 1;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Block Length of the cipher
|
||||
|
@ -48,15 +48,26 @@ use phpseclib3\Math\PrimeField;
|
||||
*/
|
||||
class Hash
|
||||
{
|
||||
/**#@+
|
||||
/**
|
||||
* Padding Types
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
//const PADDING_KECCAK = 1;
|
||||
|
||||
/**
|
||||
* Padding Types
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const PADDING_SHA3 = 2;
|
||||
|
||||
/**
|
||||
* Padding Types
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const PADDING_SHAKE = 3;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Padding Type
|
||||
|
@ -55,13 +55,17 @@ use phpseclib3\Crypt\Common\StreamCipher;
|
||||
*/
|
||||
class RC4 extends StreamCipher
|
||||
{
|
||||
/**#@+
|
||||
/**
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\RC4::_crypt()
|
||||
*/
|
||||
const ENCRYPT = 0;
|
||||
|
||||
/**
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\RC4::_crypt()
|
||||
*/
|
||||
const DECRYPT = 1;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Key Length (in bytes)
|
||||
|
@ -80,11 +80,6 @@ abstract class RSA extends AsymmetricKey
|
||||
*/
|
||||
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}
|
||||
* (OAEP) for encryption / decryption.
|
||||
@ -93,6 +88,9 @@ abstract class RSA extends AsymmetricKey
|
||||
*
|
||||
* @see self::setHash()
|
||||
* @see self::setMGFHash()
|
||||
* @access public
|
||||
* @see self::encrypt()
|
||||
* @see self::decrypt()
|
||||
*/
|
||||
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
|
||||
* compatibility with protocols (like SSH-1) written before OAEP's introduction.
|
||||
*
|
||||
* @access public
|
||||
* @see self::encrypt()
|
||||
* @see self::decrypt()
|
||||
*/
|
||||
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
|
||||
* 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;
|
||||
/**#@-*/
|
||||
|
||||
/**#@+
|
||||
* @access public
|
||||
* @see self::sign()
|
||||
* @see self::verify()
|
||||
* @see self::setHash()
|
||||
*/
|
||||
/**
|
||||
* Use the Probabilistic Signature Scheme for signing
|
||||
*
|
||||
@ -125,17 +124,30 @@ abstract class RSA extends AsymmetricKey
|
||||
* @see self::setSaltLength()
|
||||
* @see self::setMGFHash()
|
||||
* @see self::setHash()
|
||||
* @see self::sign()
|
||||
* @see self::verify()
|
||||
* @see self::setHash()
|
||||
* @access public
|
||||
*/
|
||||
const SIGNATURE_PSS = 16;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* Use PKCS#1 padding for signature verification
|
||||
*
|
||||
* @see self::sign()
|
||||
* @see self::verify()
|
||||
* @see self::setHash()
|
||||
* @access public
|
||||
*/
|
||||
const SIGNATURE_PKCS1 = 64;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Encryption padding mode
|
||||
|
@ -33,38 +33,48 @@ use phpseclib3\Exception\UnsupportedFormatException;
|
||||
*/
|
||||
abstract class MSBLOB
|
||||
{
|
||||
/**#@+
|
||||
* @access private
|
||||
*/
|
||||
/**
|
||||
* Public/Private Key Pair
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const PRIVATEKEYBLOB = 0x7;
|
||||
/**
|
||||
* Public Key
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const PUBLICKEYBLOB = 0x6;
|
||||
/**
|
||||
* Public Key
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const PUBLICKEYBLOBEX = 0xA;
|
||||
/**
|
||||
* RSA public key exchange algorithm
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const CALG_RSA_KEYX = 0x0000A400;
|
||||
/**
|
||||
* RSA public key exchange algorithm
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const CALG_RSA_SIGN = 0x00002400;
|
||||
/**
|
||||
* Public Key
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const RSA1 = 0x31415352;
|
||||
/**
|
||||
* Private Key
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const RSA2 = 0x32415352;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Break a public or private key down into its constituent components
|
||||
|
@ -50,13 +50,17 @@ class Salsa20 extends StreamCipher
|
||||
*/
|
||||
protected $key_length = 32; // = 256 bits
|
||||
|
||||
/**#@+
|
||||
/**
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\Salsa20::crypt()
|
||||
*/
|
||||
const ENCRYPT = 0;
|
||||
|
||||
/**
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\Salsa20::crypt()
|
||||
*/
|
||||
const DECRYPT = 1;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Encryption buffer for continuous mode
|
||||
|
@ -39,24 +39,15 @@ use DateTimeZone;
|
||||
*/
|
||||
abstract class ASN1
|
||||
{
|
||||
/**#@+
|
||||
* Tag Classes
|
||||
*
|
||||
* @access private
|
||||
* @link http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=12
|
||||
*/
|
||||
// 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;
|
||||
/**#@-*/
|
||||
|
||||
/**#@+
|
||||
* Tag Classes
|
||||
*
|
||||
* @access private
|
||||
* @link http://www.obj-sys.com/asn1tutorial/node124.html
|
||||
*/
|
||||
// Tag Classes
|
||||
// http://www.obj-sys.com/asn1tutorial/node124.html
|
||||
const TYPE_BOOLEAN = 1;
|
||||
const TYPE_INTEGER = 2;
|
||||
const TYPE_BIT_STRING = 3;
|
||||
@ -72,13 +63,9 @@ abstract class ASN1
|
||||
//const TYPE_RELATIVE_OID = 13;
|
||||
const TYPE_SEQUENCE = 16; // SEQUENCE OF
|
||||
const TYPE_SET = 17; // SET OF
|
||||
/**#@-*/
|
||||
/**#@+
|
||||
* More Tag Classes
|
||||
*
|
||||
* @access private
|
||||
* @link http://www.obj-sys.com/asn1tutorial/node10.html
|
||||
*/
|
||||
|
||||
// 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
|
||||
@ -92,18 +79,11 @@ abstract class ASN1
|
||||
const TYPE_UNIVERSAL_STRING = 28;
|
||||
//const TYPE_CHARACTER_STRING = 29;
|
||||
const TYPE_BMP_STRING = 30;
|
||||
/**#@-*/
|
||||
|
||||
/**#@+
|
||||
* Tag Aliases
|
||||
*
|
||||
* These tags are kinda place holders for other tags.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
// Tag Aliases
|
||||
// These tags are kinda place holders for other tags.
|
||||
const TYPE_CHOICE = -1;
|
||||
const TYPE_ANY = -2;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* ASN.1 object identifiers
|
||||
|
@ -62,55 +62,77 @@ class X509
|
||||
*/
|
||||
const VALIDATE_SIGNATURE_BY_CA = 1;
|
||||
|
||||
/**#@+
|
||||
* @access public
|
||||
* @see \phpseclib3\File\X509::getDN()
|
||||
*/
|
||||
/**
|
||||
* Return internal array representation
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\File\X509::getDN()
|
||||
*/
|
||||
const DN_ARRAY = 0;
|
||||
/**
|
||||
* Return string
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\File\X509::getDN()
|
||||
*/
|
||||
const DN_STRING = 1;
|
||||
/**
|
||||
* Return ASN.1 name string
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\File\X509::getDN()
|
||||
*/
|
||||
const DN_ASN1 = 2;
|
||||
/**
|
||||
* Return OpenSSL compatible array
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\File\X509::getDN()
|
||||
*/
|
||||
const DN_OPENSSL = 3;
|
||||
/**
|
||||
* Return canonical ASN.1 RDNs string
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\File\X509::getDN()
|
||||
*/
|
||||
const DN_CANON = 4;
|
||||
/**
|
||||
* Return name hash for file indexing
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\File\X509::getDN()
|
||||
*/
|
||||
const DN_HASH = 5;
|
||||
/**#@-*/
|
||||
|
||||
/**#@+
|
||||
/**
|
||||
* Save as PEM
|
||||
*
|
||||
* ie. a base64-encoded PEM with a header and a footer
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\File\X509::saveX509()
|
||||
* @see \phpseclib3\File\X509::saveCSR()
|
||||
* @see \phpseclib3\File\X509::saveCRL()
|
||||
*/
|
||||
/**
|
||||
* Save as PEM
|
||||
*
|
||||
* ie. a base64-encoded PEM with a header and a footer
|
||||
*/
|
||||
const FORMAT_PEM = 0;
|
||||
/**
|
||||
* Save as DER
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\File\X509::saveX509()
|
||||
* @see \phpseclib3\File\X509::saveCSR()
|
||||
* @see \phpseclib3\File\X509::saveCRL()
|
||||
*/
|
||||
const FORMAT_DER = 1;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
const FORMAT_SPKAC = 2;
|
||||
@ -118,9 +140,13 @@ class X509
|
||||
* Auto-detect the format
|
||||
*
|
||||
* 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;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Attribute value disposition.
|
||||
|
@ -26,20 +26,20 @@ use phpseclib3\Math\BigInteger\Engines\BCMath;
|
||||
*/
|
||||
abstract class Base extends BCMath
|
||||
{
|
||||
/**#@+
|
||||
* @access private
|
||||
*/
|
||||
/**
|
||||
* Cache constants
|
||||
*
|
||||
* $cache[self::VARIABLE] tells us whether or not the cached data is still valid.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const VARIABLE = 0;
|
||||
/**
|
||||
* $cache[self::DATA] contains the cached data.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const DATA = 1;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Test for engine validity
|
||||
|
@ -26,20 +26,20 @@ use phpseclib3\Math\BigInteger\Engines\BCMath\Base;
|
||||
*/
|
||||
abstract class Barrett extends Base
|
||||
{
|
||||
/**#@+
|
||||
* @access private
|
||||
*/
|
||||
/**
|
||||
* Cache constants
|
||||
*
|
||||
* $cache[self::VARIABLE] tells us whether or not the cached data is still valid.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const VARIABLE = 0;
|
||||
/**
|
||||
* $cache[self::DATA] contains the cached data.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const DATA = 1;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Barrett Modular Reduction
|
||||
|
@ -26,20 +26,20 @@ use phpseclib3\Math\BigInteger\Engines\PHP;
|
||||
*/
|
||||
abstract class Base extends PHP
|
||||
{
|
||||
/**#@+
|
||||
* @access private
|
||||
*/
|
||||
/**
|
||||
* Cache constants
|
||||
*
|
||||
* $cache[self::VARIABLE] tells us whether or not the cached data is still valid.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const VARIABLE = 0;
|
||||
/**
|
||||
* $cache[self::DATA] contains the cached data.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
const DATA = 1;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Test for engine validity
|
||||
|
@ -28,9 +28,7 @@ use ParagonIE\ConstantTime\Hex;
|
||||
*/
|
||||
class PHP32 extends PHP
|
||||
{
|
||||
/**#@+
|
||||
* Constants used by PHP.php
|
||||
*/
|
||||
// Constants used by PHP.php
|
||||
const BASE = 26;
|
||||
const BASE_FULL = 0x4000000;
|
||||
const MAX_DIGIT = 0x3FFFFFF;
|
||||
|
@ -28,9 +28,7 @@ use ParagonIE\ConstantTime\Hex;
|
||||
*/
|
||||
class PHP64 extends PHP
|
||||
{
|
||||
/**#@+
|
||||
* Constants used by PHP.php
|
||||
*/
|
||||
// Constants used by PHP.php
|
||||
const BASE = 31;
|
||||
const BASE_FULL = 0x80000000;
|
||||
const MAX_DIGIT = 0x7FFFFFFF;
|
||||
|
@ -61,33 +61,43 @@ class SFTP extends SSH2
|
||||
*/
|
||||
const CHANNEL = 0x100;
|
||||
|
||||
/**#@+
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SFTP::put()
|
||||
*/
|
||||
/**
|
||||
* Reads data from a local file.
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SFTP::put()
|
||||
*/
|
||||
const SOURCE_LOCAL_FILE = 1;
|
||||
/**
|
||||
* 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
|
||||
const SOURCE_STRING = 2;
|
||||
/**
|
||||
* Reads data from callback:
|
||||
* function callback($length) returns string to proceed, null for EOF
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SFTP::put()
|
||||
*/
|
||||
const SOURCE_CALLBACK = 16;
|
||||
/**
|
||||
* Resumes an upload
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SFTP::put()
|
||||
*/
|
||||
const RESUME = 4;
|
||||
/**
|
||||
* Append a local file to an already existing remote file
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SFTP::put()
|
||||
*/
|
||||
const RESUME_START = 8;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Packet Types
|
||||
|
@ -80,21 +80,15 @@ use phpseclib3\Common\Functions\Strings;
|
||||
*/
|
||||
class SSH2
|
||||
{
|
||||
/**#@+
|
||||
* Execution Bitmap Masks
|
||||
*
|
||||
* @see \phpseclib3\Net\SSH2::bitmap
|
||||
* @access private
|
||||
*/
|
||||
// Execution Bitmap Masks
|
||||
const MASK_CONSTRUCTOR = 0x00000001;
|
||||
const MASK_CONNECTED = 0x00000002;
|
||||
const MASK_LOGIN_REQ = 0x00000004;
|
||||
const MASK_LOGIN = 0x00000008;
|
||||
const MASK_SHELL = 0x00000010;
|
||||
const MASK_WINDOW_ADJUST = 0x00000020;
|
||||
/**#@-*/
|
||||
|
||||
/**#@+
|
||||
/*
|
||||
* Channel constants
|
||||
*
|
||||
* 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_AGENT_FORWARD = 4;
|
||||
const CHANNEL_KEEP_ALIVE = 5;
|
||||
/**#@-*/
|
||||
|
||||
/**#@+
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SSH2::getLog()
|
||||
*/
|
||||
/**
|
||||
* Returns the message numbers
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SSH2::getLog()
|
||||
*/
|
||||
const LOG_SIMPLE = 1;
|
||||
/**
|
||||
* Returns the message content
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SSH2::getLog()
|
||||
*/
|
||||
const LOG_COMPLEX = 2;
|
||||
/**
|
||||
* Outputs the content real-time
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SSH2::getLog()
|
||||
*/
|
||||
const LOG_REALTIME = 3;
|
||||
/**
|
||||
* Dumps the content real-time to a file
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SSH2::getLog()
|
||||
*/
|
||||
const LOG_REALTIME_FILE = 4;
|
||||
/**
|
||||
* Make sure that the log never gets larger than this
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SSH2::getLog()
|
||||
*/
|
||||
const LOG_MAX_SIZE = 1048576; // 1024 * 1024
|
||||
/**#@-*/
|
||||
|
||||
/**#@+
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SSH2::read()
|
||||
*/
|
||||
/**
|
||||
* Returns when a string matching $expect exactly is found
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SSH2::read()
|
||||
*/
|
||||
const READ_SIMPLE = 1;
|
||||
/**
|
||||
* Returns when a string matching the regular expression $expect is found
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SSH2::read()
|
||||
*/
|
||||
const READ_REGEX = 2;
|
||||
/**
|
||||
@ -160,9 +165,11 @@ class SSH2
|
||||
*
|
||||
* Some data packets may only contain a single character so it may be necessary
|
||||
* to call read() multiple times when using this option
|
||||
*
|
||||
* @access public
|
||||
* @see \phpseclib3\Net\SSH2::read()
|
||||
*/
|
||||
const READ_NEXT = 3;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* The SSH identifier
|
||||
|
@ -53,11 +53,8 @@ class Agent
|
||||
{
|
||||
use Common\Traits\ReadBytes;
|
||||
|
||||
/**#@+
|
||||
* Message numbers
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
// Message numbers
|
||||
|
||||
// to request SSH1 keys you have to use SSH_AGENTC_REQUEST_RSA_IDENTITIES (1)
|
||||
const SSH_AGENTC_REQUEST_IDENTITIES = 11;
|
||||
// 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;
|
||||
// the SSH1 response is SSH_AGENT_RSA_RESPONSE (4)
|
||||
const SSH_AGENT_SIGN_RESPONSE = 14;
|
||||
/**#@-*/
|
||||
|
||||
/**@+
|
||||
* Agent forwarding status
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
// Agent forwarding status
|
||||
|
||||
// no forwarding requested and not active
|
||||
const FORWARD_NONE = 0;
|
||||
// request agent forwarding when opportune
|
||||
const FORWARD_REQUEST = 1;
|
||||
// forwarding has been request and is active
|
||||
const FORWARD_ACTIVE = 2;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Unused
|
||||
|
@ -42,16 +42,10 @@ class Identity implements PrivateKey
|
||||
{
|
||||
use \phpseclib3\System\SSH\Common\Traits\ReadBytes;
|
||||
|
||||
/**@+
|
||||
* Signature Flags
|
||||
*
|
||||
* See https://tools.ietf.org/html/draft-miller-ssh-agent-00#section-5.3
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
// Signature Flags
|
||||
// See https://tools.ietf.org/html/draft-miller-ssh-agent-00#section-5.3
|
||||
const SSH_AGENT_RSA2_256 = 2;
|
||||
const SSH_AGENT_RSA2_512 = 4;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Key Object
|
||||
|
Loading…
Reference in New Issue
Block a user