terrafrost
f6e0c4b506
Crypt: add OpenSSL support
...
aside from the addition of OpenSSL support a few other changes have been included:
- setEngine(), as added by petrich, is depricated (not that it was ever in trunk to begin with)
it has been replaced with isValidEngine() and setPreferredEngine().
- replace _generate_xor() with increment_str()
_increment_str() had extra functionality that wasn't being used. ie. it could concatenate
multiple successive string increments to one another automatically. but not only was that
functionality not used - it also made the function less versatile. _increment_str() can be
used more easily for iterative brute forcing (for example)
- rename Crypt_Base::_stringShift to Crypt_Base::_string_shift (for consistency)
- more expansive unit test coverage
2014-11-29 07:39:21 -06:00
terrafrost
beb3d0db79
Merge remote-tracking branch 'petrich/master' into petrich
...
Conflicts:
phpseclib/Crypt/AES.php
phpseclib/Crypt/Base.php
phpseclib/Crypt/Blowfish.php
phpseclib/Crypt/DES.php
phpseclib/Crypt/RC2.php
phpseclib/Crypt/RC4.php
phpseclib/Crypt/Rijndael.php
phpseclib/Crypt/TripleDES.php
phpseclib/Crypt/Twofish.php
2014-10-11 22:56:32 -05:00
Andreas Fischer
67aedc240b
Change constructors from class name to __construct().
...
This has been produced as follows:
<?php
$replace = $files = [];
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($argv[1]));
foreach ($it as $fileinfo) {
if ($fileinfo->getExtension() === 'php') {
$file = $fileinfo->getPathname();
$content = file_get_contents($file);
$files[$file] = $content;
$tokens = token_get_all($content);
foreach ($tokens as $key => $value) {
if ($value[0] === T_CLASS) {
$class = $tokens[$key + 2][1];
$replace += array(
"$class::$class(" => "$class::__construct(",
"parent::$class(" => "parent::__construct(",
"function $class(" => "function __construct(",
);
}
}
}
}
foreach ($files as $file => $content) {
file_put_contents(
$file,
str_replace(
array_keys($replace),
array_values($replace),
$content
)
);
}
2014-06-16 17:06:34 +02:00
Andreas Fischer
d38886c2a9
Always correctly link to the constructor of Crypt_Base.
2014-06-16 16:42:18 +02:00
Andreas Fischer
91e78c2106
Remove unnecessary constructors.
2014-06-16 16:14:35 +02:00
Andreas Fischer
e6f87318f5
Adjust documentation to coding guidelines: No () around include.
2014-06-01 23:28:49 +02:00
Andreas Fischer
fb1296bbec
Drop meaningless, outdated, inconsistent version tags in doc blocks.
...
find phpseclib -type f -name "*.php" -exec sed -i '/@version/d' {} \;
2014-03-11 15:58:33 +01:00
Veres Lajos
930a3fb4d2
typofixes - https://github.com/vlajos/misspell_fixer
2014-03-05 23:41:20 +00:00
Andreas Fischer
56f1ada5c1
CS: Each file MUST end with exactly one newline character
2014-02-10 14:51:35 +01:00
Hans-Jürgen Petrich
50f46959ed
Ciphers: Adding setEngine() and some optimizations
...
Ciphers: Adding setEngine() and some optimizations
2014-01-31 06:13:14 +07:00
Andreas Fischer
f0f029b2c1
CS: Fix "PEAR.Commenting.ClassComment.WrongTagOrder" sniff.
2013-12-11 18:33:18 +01:00
Andreas Fischer
3db1fbb072
CS: Fix "PEAR.Commenting.FileComment.TagIndent" sniff.
2013-12-10 20:10:37 +01:00
Andreas Fischer
cee0f3343b
CS: Fix "PEAR.Formatting.MultiLineAssignment.EqualSignLine" sniff.
2013-12-07 20:47:30 +01:00
Andreas Fischer
6d1fb9f7db
CS: Fix "PEAR.Files.IncludingFile.UseIncludeOnce" sniff.
2013-12-06 01:03:34 +01:00
Andreas Fischer
bc6ff96292
Fix "PEAR.Files.IncludingFile.BracketsNotRequired" sniff.
2013-12-05 23:17:40 +01:00
Andreas Fischer
e09f1b730e
CodeSniffer: Fix PEAR.Classes.ClassDeclaration.OpenBraceNewLine sniff.
2013-12-03 19:34:41 +01:00
Marc Philip Scholten
3bfd884813
Removed vim comments
...
Reformated files
2013-11-23 19:42:26 +01:00
Hans-Jürgen Petrich
89ea2da86b
Crypt_*: CS and comments
...
- Crypt_* Some CS
- Crypt_Base: better comments for phpseclib developers
- Crypt_Base::_createInlineCryptFunction(): better namespace for
internal variables (all now prefixed with an underscore to avoid
conflicts)
2013-06-26 11:50:40 +07:00
terrafrost
7b3434c01f
Merge remote-tracking branch 'origin/master' into Crypt_Base
...
Conflicts:
phpseclib/Crypt/DES.php
phpseclib/Crypt/RC4.php
2013-06-11 14:59:13 -05:00
Andreas Fischer
727dba5905
[remove-svn-version-lines] Remove useless @version: $Id$ lines.
...
These lines served some purpose on SVN, but are now useless on Git. They
actually do harm as they might make people think their files are older
than they actually are.
2013-06-02 18:50:46 +02:00
Hans-Jürgen Petrich
35f1b8dc2b
Method namings
2013-05-25 14:08:17 +07:00
Hans-Jürgen Petrich
5429504aee
CS adjustment
2013-05-25 11:22:25 +07:00
Hans-Jürgen Petrich
995c09cb67
CS and method namings
2013-05-25 09:05:24 +07:00
Hans-Jürgen Petrich
72fa880aa2
BL/TF optimizations. 3DES: +20% speed
...
- Blowfish/Twofish small optimizations
- 3DES +20% speedup from Patrick's commit:
f596c577cf
2013-05-23 01:11:08 +07:00
Patrick Monnerat
f596c577cf
DES: move IP/inverse IP transforms out of the round loop in inline_crypt_setup().
...
This is another 20% runtime gain on triple DES.
2013-05-21 16:01:10 +02:00
Hans-Jürgen Petrich
55ff00cc35
Crypt_Base
...
Crypt_Base() implementation
2013-05-20 13:19:38 +07:00
Hans-Jürgen Petrich
6b7c1da103
DES: removed debug code
...
removed debug code
2013-04-30 14:53:27 +07:00
Hans-Jürgen Petrich
c4752cbeba
DES / 3DES Performance Update
...
DES / 3DES Performance Update.
Inline en/decrypting gives additional ~25% performance.
100% compatible with the current DES/TribleDES.php
Strong testet on Windows/Linux 32/64bit with php4/5.0/5.1//5.2/5.3/5.4
2013-04-25 14:16:10 +07:00
Patrick Monnerat
a13684584c
DES: fix file permissions.
2013-04-24 11:02:01 +02:00
Patrick Monnerat
a8e5ccf895
DES: pre-permuted tables version.
2013-04-24 11:00:11 +02:00
Hans-Jürgen Petrich
ee84c4b41d
$plaintext should be $ciphertext
2013-03-06 18:14:27 +07:00
terrafrost
5f64ab67ab
DES: $block wasn't defined
2013-03-04 08:25:40 -06:00
terrafrost
15817a416e
DES: Fix memory leak in OFB mode
2013-03-03 11:30:03 -06:00
terrafrost
bf3ca6312e
DES: Fix memory leak with CTR mode
2013-03-03 00:31:48 -06:00
terrafrost
248e3bb085
Undo last commit
2013-01-30 08:37:50 -06:00
terrafrost
bfb04dcf4d
Add __construct() constructor to make namespace'ing easier for those wishing to do it
2013-01-29 22:09:31 -06:00
Hans-Jürgen Petrich
bfab4c47f9
DES: Fixed CFB decrypt() using MODE_MCRYPT and ContinuousBuffer
...
DES: Fixed small bug from commit d94f1b252d
(DES.php in line 739-740)
in CFB decrypt() using CRYPT_DES_MODE_MCRYPT and enableContinuousBuffer()
2013-01-21 10:15:13 +07:00
terrafrost
d94f1b252d
AES, DES, RC4, Rijndael, TripleDES: multiple changes
...
- apply petrich's TripleDES / CFB decrypt to AES and DES
- make DES use the updated _generate_xor
- correct a comment typo
2013-01-20 10:11:19 -06:00
Hans-Jürgen Petrich
c624c785ee
DES: Fixed CFB/OFB and continuousBuffer
...
FIXED: multiple calls to enable/disableCMode() will work now
FIXED: CFB/OFB modes
FIXED: "Illegal string offset" and strlen(array()) Warning/Notice
2013-01-13 01:48:48 +07:00
terrafrost
e71fc97913
Revamp SSH1 logging and go back to using user_error
...
(_handle_error returned the line number in _handle_error - not the line number triggering the error)
2013-01-08 22:09:27 -06:00
terrafrost
c1244dd339
CFB didn't always work in continuous mode
2013-01-04 20:53:23 -06:00
terrafrost
61ad80fd64
More strlen() / empty() changes
2013-01-03 00:26:27 -06:00
terrafrost
9b4240c104
Use !empty('0') instead of strlen('0')
...
Thanks petrich!
2013-01-03 00:21:09 -06:00
terrafrost
3caaa91160
Replace user_error() with new _handle_error() function
...
To use exceptions do define('PHPSECLIB_USE_EXCEPTIONS', true).
To have the exceptions thrown by phpseclib be of a certain class define PHPSECLIB_EXCEPTION_CLASS.
2012-11-28 23:33:15 -06:00
terrafrost
2a1909fd71
Set $this->paddable to true in a few missing places
2012-11-16 02:59:06 -06:00
terrafrost
3a5ab5276e
CRYPT_MODE_DES_CBC should have been CRYPT_DES_MODE_CBC
...
Thanks arook!
2012-09-22 11:32:41 -05:00
terrafrost
dfe264594f
Merge pull request #9 from bantu/feature/consistent-file-endings
...
[feature/consistent-file-endings] Remove ?> and make sure there is an empty line at the end of files.
2012-06-16 21:06:15 -07:00
terrafrost
ccd2b6ae78
- PBKDF2 updates
2012-06-16 16:42:54 -05:00
Andreas Fischer
eb64dfef7d
[feature/consistent-file-endings] Make sure files have empty line at the end.
2012-06-11 10:34:07 +02:00
Jim Wigginton
b39d2597dd
- if the algorithm is not supported upon mcrypt's initial initialization use the internal implementation
...
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@220 21d32557-59b3-4da0-833f-c5933fad653e
2012-05-14 01:21:21 +00:00
Jim Wigginton
a00a5e6ba4
- add pbkdf2 support via setPassword()
...
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@185 21d32557-59b3-4da0-833f-c5933fad653e
2011-11-13 02:23:56 +00:00
Jim Wigginton
d7c43d03a2
- fix bug with pure-PHP CTR mode (thanks, Max!)
...
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@177 21d32557-59b3-4da0-833f-c5933fad653e
2011-09-04 16:23:50 +00:00
Jim Wigginton
392d96445e
- add support for PuTTY and XML formatted RSA keys
...
- remove ?>'s from PHP_Compat files
- update LICENSE block
- make it so NET_SSH2_MSG_USERAUTH_PK_OK records direction and time
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@152 21d32557-59b3-4da0-833f-c5933fad653e
2011-04-18 12:17:40 +00:00
Jim Wigginton
4d4cc0e0f5
- keys should now be null padded if they're too short
...
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@136 21d32557-59b3-4da0-833f-c5933fad653e
2010-12-01 05:09:01 +00:00
Jim Wigginton
b94a467999
- change license to the less restrictive MIT license (if people want to modify phpseclib and distribute binaries of it [whatever that means for PHP] without including the source code I don't care); two of the three PHP_Compat stuff still uses the LGPL since I didn't author them but they're only needed, anyway, if you're using phpseclib on PHP4.
...
- add svn:eol-style: LF to all files
- fixed pear.php.net bug # 18037 (thanks, nounours!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@130 21d32557-59b3-4da0-833f-c5933fad653e
2010-11-13 19:28:20 +00:00
Jim Wigginton
a15cf62d3a
- change $ecb to $this->ecb
...
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@124 21d32557-59b3-4da0-833f-c5933fad653e
2010-09-26 05:24:52 +00:00
Jim Wigginton
76655b8bf9
- CFB mode is now supported as a stream cipher
...
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@122 21d32557-59b3-4da0-833f-c5933fad653e
2010-09-26 03:10:20 +00:00
Jim Wigginton
202c3b64e9
- added support for OFB and CFB modes (with the caveat that CFB mode isn't currently supported as a stream cipher)
...
- improvements to the fix to the bug Suby found
- fixed bug whereby CTR mode gave different results in mcrypt and internal modes when the continuous buffer was enabled and the plaintext being encrypted wasn't a multiple of the block size
- undid the fix for the bug f.dammassa found (thanks, j31!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@120 21d32557-59b3-4da0-833f-c5933fad653e
2010-09-12 21:58:54 +00:00
Jim Wigginton
f088d89712
- add logging to Net_SSH1 and fixed a bug in Crypt_DES (thanks, Suby!)
...
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@113 21d32557-59b3-4da0-833f-c5933fad653e
2010-08-08 05:06:38 +00:00
Jim Wigginton
d77c85218d
- removed setMCrypt from the Crypt_* objects (you can achieve the same effect by doing ini_set('mcrypt.algorithms_dir', $path))
...
- added support for CTR mode to the various Crypt_* objects
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@83 21d32557-59b3-4da0-833f-c5933fad653e
2010-02-09 06:10:26 +00:00
Jim Wigginton
7ecd481002
- fixes to Math_BigInteger::_barrett()
...
- speed ups based on <http://blog.libssh2.org/index.php?/archives/21-Compiled-Variables.html >.
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@74 21d32557-59b3-4da0-833f-c5933fad653e
2010-01-04 07:59:01 +00:00
Jim Wigginton
9bd3c793d3
- an inability to unpad doesn't necessarily mean that padding is enabled when it shouldn't be - it might also mean that the key being used is the wrong one.
...
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@67 21d32557-59b3-4da0-833f-c5933fad653e
2009-12-06 07:26:52 +00:00
Jim Wigginton
a4e72f7811
- replaced list(...) = unpack('...') calls with extract(unpack('...')) (thanks martinu!)
...
- added pure-php implementations of md2, sha256, and sha512 to Crypt_Hash
- added setPrecision() to Math_BigInteger
- other small fixes
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@56 21d32557-59b3-4da0-833f-c5933fad653e
2009-11-23 19:06:07 +00:00
Jim Wigginton
9194759d58
- cosmetic changes to the code
...
- encryption should work even when setKey() isn't called
- padding wasn't always done when it should have been
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@33 21d32557-59b3-4da0-833f-c5933fad653e
2009-05-27 16:15:23 +00:00
Jim Wigginton
1eb6ac05c0
$x & 3 == 1 is the same thing as $x & (3 == 1) per php's order of precidence
...
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@24 21d32557-59b3-4da0-833f-c5933fad653e
2009-03-09 05:13:24 +00:00
Jim Wigginton
39de68ab48
- [bug] Crypt_Rijndael calculated IVs incorrectly
...
- [new] renamed Crypt_HMAC to Crypt_Hash and revised the API
- [new] added Crypt_AES
- [new] added AES support to Net_SSH2
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@21 21d32557-59b3-4da0-833f-c5933fad653e
2009-02-16 22:22:13 +00:00
Jim Wigginton
a78d7df660
- if padding is disabled and the length of the text-to-be-encrypted isn't a multiple of the block size, padding will be automatically enabled
...
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@19 21d32557-59b3-4da0-833f-c5933fad653e
2008-08-04 17:59:12 +00:00
Jim Wigginton
6101b23a32
- fixed a bug discovered by MarkDHamill (see http://www.frostjedi.com/phpbb/viewtopic.php?f=46&t=9796 )
...
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@11 21d32557-59b3-4da0-833f-c5933fad653e
2008-03-31 00:49:09 +00:00
Jim Wigginton
29ee82e67b
- updated URL
...
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@7 21d32557-59b3-4da0-833f-c5933fad653e
2007-07-25 21:56:14 +00:00
Jim Wigginton
df0fe2386a
- added SSH2.php and HMAC.php
...
- fixed issue with the IV's in TripleDES.php and DES.php
- fixed decryption in TripleDES.php using CRYPT_DES_MODE_INTERNAL
- renamed CRYPT_DES_MODE_SSH to CRYPT_DES_MODE_3CBC
- added CRYPT_DES_MODE_CBC3 as an alias for CRYPT_DES_MODE_CBC
- fixed issue with RC4.php using CRYPT_RC4_MODE_MCRYPT
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@4 21d32557-59b3-4da0-833f-c5933fad653e
2007-07-23 05:21:39 +00:00
Jim Wigginton
367ddebf80
- initial commit
...
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@3 21d32557-59b3-4da0-833f-c5933fad653e
2007-07-02 04:19:55 +00:00