PHP Secure Communications Library

Jim TerraFrost Wigginton

Abstract

The PHP Secure Communications Library contains LGPL-licensed pure-PHP implementations of arbitrary-precision integers, DES, 3DES, RC4, Rijndael, AES, SSH-1, SSH-2, and SFTP. This book discusses how to use them.


Table of Contents

1. Introduction
1.1. Who should use phpseclib
1.2. Using phpseclib
1.2.1. The incorrect way
1.2.2. The correct way
2. Math
2.1. Math_BigInteger
2.1.1. Dependencies
2.1.2. The constructor
2.1.3. toString() and toBytes()
2.1.4. add(), subtract(), multiply() and divide()
2.1.5. modPow() and modInverse()
2.1.6. abs() and compare()
2.1.7. bitwise_and(), bitwise_or(), bitwise_xor() and bitwise_not()
2.1.8. bitwise_rightShift() and bitwise_leftShift()
2.1.9. random()
3. Cryptography
3.1. Introduction
3.1.1. Dependencies
3.1.2. setKey() and setIV()
3.1.3. setMCrypt()
3.1.4. encrypt() and decrypt()
3.1.5. enableContinuousBuffer() and disableContinuousBuffer()
3.1.6. enablePadding() and disablePadding()
3.2. Crypt_DES
3.2.1. The constructor
3.3. Crypt_TripleDES
3.3.1. The constructor
3.4. Crypt_RC4
3.4.1. The constructor
3.5. Crypt_Rijndael & Crypt_AES
3.5.1. The constructor
3.5.2. AES vs. Rijndael
3.5.3. setKeyLength()
3.5.4. setBlockLength()
3.5.5. Speed Comparisons
4. Networking
4.1. Net_SSH
4.1.1. Dependencies
4.1.2. Net_SSH1 Examples
4.1.3. Net_SSH2 Examples
4.1.4. Host Key Verification
4.1.5. interactiveRead() / interactiveWrite() vs. exec()
4.1.6. SSH-1's exec() vs. SSH-2's exec()
4.1.7. Successive calls to SSH-2's exec()
4.2. Net_SFTP
4.2.1. Introduction
4.2.2. Dependencies
4.2.3. Net_SFTP Example
4.2.4. put($remote_file, $data [, $mode])
4.2.5. get($remote_file [, $local_file])
4.2.6. pwd(), chdir(), mkdir() and rmdir()
4.2.7. chmod() and nlist()
4.2.8. delete() and rename()

List of Tables

3.1. AES Speed Comparisons