1
0
mirror of https://github.com/danog/tgseclib.git synced 2024-12-02 17:48:00 +01:00
Commit Graph

396 Commits

Author SHA1 Message Date
terrafrost
b23a693ae5 RSA: update comments for _extractBER 2013-12-26 01:46:58 -06:00
Andreas Fischer
8bb80b3df0 CS: Add useful whitespace CodeSniffer rules. 2013-12-26 00:33:08 +01:00
terrafrost
3a0193875a RSA: more verbose RSA key handling 2013-12-24 18:37:43 -06:00
terrafrost
0f5b3ea416 Compatibility fixes
- PHP4 doesn't allow method chaining
- $_SESSION isn't always defined
- on PHP5.1 and earlier using 0x100000000 instead of 4294967296 gives E_NOTICE
- array('Net_SSH2', 'func_name') doesn't work so we fix this by passing $this to it.
  to make that work on PHP4 pass by call-time reference. normally this would result
  in a fatal error on PHP5.4+ but doesn't seem to in this case. the following URL
  elaborates:

  http://stackoverflow.com/q/20732563/569976
2013-12-22 18:14:49 -06: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
161bb7d362 CS: Fix PEAR.ControlStructures.ControlSignature sniff. 2013-12-03 21:04:13 +01:00
Andreas Fischer
e09f1b730e CodeSniffer: Fix PEAR.Classes.ClassDeclaration.OpenBraceNewLine sniff. 2013-12-03 19:34:41 +01:00
Andreas Fischer
ca9c8b107b CodeSniffer: Fix Generic.PHP.LowerCaseConstant.Found sniff. 2013-12-03 18:54:43 +01:00
Andreas Fischer
399308f98a Merge pull request #180 from mpscholten/removed-vim-comments
Removed vim comments

* mpscholten/removed-vim-comments:
  Removed vim comments
2013-11-23 21:16:25 +01:00
Marc Philip Scholten
3bfd884813 Removed vim comments
Reformated files
2013-11-23 19:42:26 +01:00
terrafrost
300a3afe8d Merge branch 'master' of https://github.com/phpseclib/phpseclib 2013-11-10 22:38:36 -06:00
terrafrost
755f0f17a5 RSA: putty keys weren't being formatted correctly 2013-11-10 22:27:48 -06:00
Andreas Fischer
2241d0e6f4 Partial revert of 9f1108e52e.
This change should not be necessary.
2013-11-06 23:12:00 +01:00
Frank de Jonge
4976cd1622 Fixed coding style to comply with other not defined statements 2013-11-05 13:01:03 +01:00
Frank de Jonge
9f1108e52e Check wether CRYPT_RANDOM_IS_WINDOWS is defined before defining it. 2013-11-05 11:27:16 +01:00
terrafrost
15677715e3 RSA: only set $this->current when it's already set 2013-10-24 15:48:15 -05:00
terrafrost
1e3ff81e7d RSA: make RSA objects clonable 2013-10-18 13:24:06 -05:00
terrafrost
9c5563503e RSA: public key was never getting set 2013-10-06 02:23:57 -05:00
terrafrost
402b7e8176 RSA: if setPublicKey is called unneccessarily return false 2013-10-05 21:30:57 -05:00
terrafrost
77447a3fc7 BigInteger, RSA: updates to OpenSSL version detection code 2013-09-20 12:14:01 -05:00
terrafrost
2b3fe58dbc RSA: fix E_NOTICE 2013-09-11 21:13:23 -05:00
terrafrost
815f609887 RSA: check to see if MATH_BIGINTEGER_MODE_DISABLE is defined 2013-09-11 11:48:40 -05:00
terrafrost
54f0f2131b RSA, BigInteger: add more openssl checks 2013-09-10 11:07:56 -05:00
terrafrost
0149644210 RSA: fix error when exponent isn't co-prime to lcm 2013-07-31 21:50:40 -05:00
terrafrost
ae2a0886a5 RSA: remove extra new line 2013-07-16 11:21:46 -05:00
Patrick Monnerat
e644c42efa RC2: Changes according to arguments in https://github.com/phpseclib/phpseclib/pull/124 2013-06-28 16:32:06 +02:00
Patrick Monnerat
a76558541c Merge branch 'master' of https://github.com/petrich/phpseclib into petrich-master
Apply pull request https://github.com/phpseclib/phpseclib/pull/124
2013-06-28 11:37:40 +02:00
Hans-Jürgen Petrich
f102ce62e2 Crypt_Base: removed die(1)
re:
89ea2da86b (commitcomment-3505770)
2013-06-26 13:15:04 +07:00
Hans-Jürgen Petrich
af1700a025 Crypt_base: Typo 2013-06-26 11:55:19 +07: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
Hans-Jürgen Petrich
b5da66e979 RC2: Optimizations, inline-crypt bug fix 2013-06-25 13:38:50 +07:00
Patrick Monnerat
b247ad1743 Add Crypt RC2 algorithm. 2013-06-24 19:17:13 +02:00
terrafrost
4de71168d8 RSA: loading XML private keys didn't always work 2013-06-20 17:05:29 -05: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
terrafrost
17d73a4e35 AES: use ()'s for require_once
All other require_once's use them so for consistency this one ought to too
2013-06-10 16:39:49 -05:00
Hans-Jürgen Petrich
6c4b0cb833 RC4: removed __destruct()
Re: https://github.com/phpseclib/phpseclib/issues/107
2013-06-03 06:39:18 +07: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
fb8d185804 Base/AES/Rijndael: Optimizations
- Base/Rijndael/AES: Comments updated.

- Base: removed __desctructor(). Re:
https://github.com/phpseclib/phpseclib/issues/107

- Base: setPassword() will use >= php-5.5's new (faster) hash_pbkdf2()
function if availalbe/possible. 100% compatible to the internal
implementation. Strong testet with all
hashes/iterations/lengths/ciphers.

- Rijndael: Runtime engine-switch: Will now use mcrypt (in case of
128/192/256-bit block/keys), if possible. Otherwise MODE_INTERNAL.

AES: Soucecode reducing. After all, now, AES.php is virtually nothing
other than a wrapper to Rijndael.php::new
Crypt_Rijndael()->setBlockLength(128). No different in speed or
functionality, but fixed block_size.
2013-06-02 16:21:32 +07:00
Hans-Jürgen Petrich
53276ba4a1 AES: inconsistencey with 160 / 224-bits keys
re: https://github.com/phpseclib/phpseclib/issues/110
2013-06-01 08:00:04 +07:00
Hans-Jürgen Petrich
e71ec8f4c8 CS adjustments 2013-05-25 18:10:20 +07: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
448be87e83 Twofish: bugfix in setPasswort()
fixed bug in setPasswort()... (occurred only in Twofish.php)
2013-05-19 23:35:06 +07:00
Hans-Jürgen Petrich
b242259d17 optimizations 2013-05-13 12:41:52 +07:00
terrafrost
0bdf39c83b Merge pull request #101 from johnsterling/rsa-comment
Add support for custom RSA key comments.
2013-05-08 08:11:20 -07:00
Veres Lajos
dd2a4ddff2 typofixes 2013-05-08 15:34:07 +01:00
terrafrost
c89db52e39 Twofish: make CS more consistent 2013-05-07 23:23:07 -05:00
John Sterling
c1244805cf Add support for custom RSA key comments.
Add ivar and set/getComment() instead of constant. Also parse comment from applicable formats in loadKey().
2013-05-05 19:38:34 -04:00
Hans-Jürgen Petrich
dcac12003a Blowfish
Blowfish implementation
2013-05-05 09:32:00 +07:00
terrafrost
3ac29adff1 Merge remote-tracking branch 'petrich/master' into twofish 2013-05-03 01:43:43 -05:00
terrafrost
232d3e2725 Random: remove comment for old code 2013-05-01 08:13:41 -05:00
terrafrost
65a6c85450 Merge branch 'master' of https://github.com/phpseclib/phpseclib 2013-05-01 00:33:13 -05:00
terrafrost
cb36b811a0 Random: use constant for windows test
BigInteger: Docblock adjustments
2013-05-01 00:30:01 -05:00
Hans-Jürgen Petrich
be47960908 Twofish
Twofish implementation
2013-04-30 17:26:14 +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
terrafrost
f16d8ba6b2 Hash: docblock updates 2013-04-20 20:09:42 -05:00
terrafrost
700d28f642 RSA: apply terite's changes to RSA.php too 2013-04-08 01:04:52 -05:00
terrafrost
c5bd12dd14 RSA: Add CRYPT_RSA_PKCS15_COMPAT mode 2013-03-23 14:13:24 -05:00
terrafrost
11a6b1a1af RSA: only use OpenSSL if openssl.cnf file exists 2013-03-21 10:43:27 -05:00
terrafrost
35f5c83d36 Random: CS adjustment 2013-03-09 21:15:01 -06:00
Hans-Jürgen Petrich
ee84c4b41d $plaintext should be $ciphertext 2013-03-06 18:14:27 +07:00
terrafrost
994c2c6c79 Rijndael, TripleDES: $block not defined in these either 2013-03-05 00:19:11 -06:00
terrafrost
5f64ab67ab DES: $block wasn't defined 2013-03-04 08:25:40 -06:00
terrafrost
c4b3288851 TripleDES, Rijndael: Fix overflow in OFB mode 2013-03-03 17:30:30 -06:00
terrafrost
7ce05ed591 Merge branch 'master' of https://github.com/phpseclib/phpseclib 2013-03-03 11:30:54 -06:00
terrafrost
15817a416e DES: Fix memory leak in OFB mode 2013-03-03 11:30:03 -06:00
Hans-Jürgen Petrich
eff0bb21c5 3DES/Rijndael/AES: Fix memory leak with CTR mode
Related to: https://github.com/phpseclib/phpseclib/issues/77
2013-03-03 17:26:41 +07:00
terrafrost
bf3ca6312e DES: Fix memory leak with CTR mode 2013-03-03 00:31:48 -06:00
terrafrost
eb860d275e RSA: Add support for AES-256-CBC 2013-02-27 20:00:20 -06:00
Hans-Jürgen Petrich
e90708297a Removed Debug function...
Removed Debug function...
2013-02-25 17:54:06 +07:00
Hans-Jürgen Petrich
afa5465e63 AES/Rijndael Performance Update [3]
Performance Update for AES/Rijndael
2013-02-25 12:19:51 +07:00
Patrick Monnerat
90ff746ad1 Make all sources 7-bit ASCII. 2013-02-20 19:25:47 +01:00
Gemorroj
cc2c844d0e some minor fixes 2013-02-20 16:46:13 +03:00
Hans-Jürgen Petrich
93f9922410 Small CS fix [2] 2013-02-07 00:45:03 +07:00
Hans-Jürgen Petrich
323396df3c Small CS fix 2013-02-03 23:19:09 +07:00
Hans-Jürgen Petrich
b4bbb27ef6 AES: Performance update
Performance update for AES
2013-01-31 00:59:53 +07:00
terrafrost
13eb688c90 AES, RC4: CS adjustments 2013-01-30 08:39:02 -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
terrafrost
6765cb3b2b Rijndael, AES: CS adjustments 2013-01-27 01:21:28 -06:00
terrafrost
7894fd98f5 Merge pull request #65 from petrich/patch-3
Rijndael: Performance update
2013-01-26 16:29:26 -08:00
terrafrost
01be859b44 Merge pull request #66 from petrich/patch-5
AES: Performance update
2013-01-26 16:29:10 -08:00
terrafrost
d774476bcf RC4: keys were never being set in continuous mode 2013-01-26 11:16:42 -06:00
Hans-Jürgen Petrich
7dceef6ef4 AES: Performance update
Performance update for AES
Related to: https://github.com/phpseclib/phpseclib/pull/65
2013-01-26 16:58:31 +07:00
Hans-Jürgen Petrich
c95b997fa7 Rijndael: Performance update
Performance update for Rijndael
2013-01-26 16:54:19 +07:00
terrafrost
111544428e Merge pull request #63 from petrich/patch-3
Rijndael: little code optimizing
2013-01-25 21:52:40 -08:00
Hans-Jürgen Petrich
376b2759c9 RC4: fixed ContinuousBuffer() using MODE_MCRYPT
Fixed multiple calls to ContinuousBuffer() using MODE_MCRYPT
2013-01-21 21:01:37 +07:00
Hans-Jürgen Petrich
d81563d6f3 Rijndael: little code optimizing
little code optimizing
2013-01-21 15:46:44 +07:00
terrafrost
45976002c7 Merge pull request #61 from petrich/patch-3
AES: Fixed CFB decrypt() using MODE_MCRYPT and ContinuousBuffer
2013-01-20 22:57:43 -08: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
Hans-Jürgen Petrich
2deea8b491 AES: Fixed CFB decrypt() using MODE_MCRYPT and ContinuousBuffer
AES: Fixed small bug from commit d94f1b252d (AES.php in line 425-426)
in CFB decrypt() using CRYPT_AES_MODE_MCRYPT and enableContinuousBuffer()
2013-01-21 10:08:49 +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
f7dc23a18e 3DES: Fixed ContinuousBuffer() in CTR/CFB/OFB
FIXED: multiple calls to enable/enableContinuousBuffer() work's now in CTR/CFB/OFB
FIXED: "Illegal string offset" and strlen(array()) Warning/Notice
Performance improvement in CFB Mode with enableContinuousBuffer() using MODE_MCRYPT
2013-01-14 21:23:20 +07: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
76a24dc546 AES: $pos will always be 0 in the last if statement for CFB 2013-01-11 18:09:28 -06:00
terrafrost
7c0926d94a Merge remote-tracking branch 'origin/petrich'
Conflicts:
	phpseclib/Crypt/AES.php
2013-01-11 18:06:43 -06:00
terrafrost
74e61deb4f AES: CFB: decrypted strings were being truncated 2013-01-11 15:30:06 -06:00
terrafrost
4a1cbfa7fd Merge remote-tracking branch 'petrich/patch-3' into petrich
Conflicts:
	phpseclib/Crypt/AES.php
2013-01-10 23:49:59 -06:00
terrafrost
bbd62f6490 AES: CFB mode fix 2013-01-10 20:42:38 -06:00
terrafrost
5ce9ad6a42 Random: $urandom -> $fp 2013-01-10 13:19:31 -06:00
Hans-Jürgen Petrich
20461866ef AES: Fix broken CFB and disableContinuousBuffer()
Related to: https://github.com/phpseclib/phpseclib/pull/45
2013-01-10 23:27:12 +07:00
terrafrost
d741def23c AES: Fix broken CFB and disableContinuousBuffer()
Quoting from petrich's pull request (from which this commit was inspired):

Fixed: Broken CFB in continuous mode when using CRYPT_AES_MODE_MCRYPT (related to: #39 )
Fixed: Multiple calls to enable/disableContinuousBuffer()
Fixed: Some PHP Notice/Warnings about strlen(array())
2013-01-09 17:39:57 -06: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
a890c6d127 Merge remote-tracking branch 'origin/petrich' 2013-01-06 19:14:05 -06:00
terrafrost
5e882d57fe Merge remote-tracking branch 'origin/petrich' 2013-01-06 19:10:25 -06:00
terrafrost
edc6d9cf5b AES.php in mcrypt mode always treated CFB as though it was a continuous cipher 2013-01-06 19:09:43 -06:00
terrafrost
fc2bf41588 Fix E_NOTICEs in the rewritten CFB mode 2013-01-06 19:08:36 -06:00
terrafrost
1626c0a3c7 CS adjustments to petrich's code and optimizations 2013-01-05 17:55:30 -06:00
terrafrost
fba455dfb2 Merge remote-tracking branch 'petrich/patch-2' into petrich
Conflicts:
	phpseclib/Crypt/Rijndael.php
2013-01-05 17:54:22 -06:00
Hans-Jürgen Petrich
d1f71cc5a7 Fixed CFB Decrypt(). Fixed OFB warnings
Fixed/rewritten: Decrypt() in CFB mode to work clean with enableContinuousBuffer()

Fixed: PHP's strlen(array()) warning in OFB mode,

Fixed: disableContinuousBuffer() clear's now also the $enbuffer/$debuffer arrays so that multiple calls to enable/disableContinuousBuffer() will work without old buffers
2013-01-05 16:23:35 +07:00
terrafrost
c1244dd339 CFB didn't always work in continuous mode 2013-01-04 20:53:23 -06:00
Hans-Jürgen Petrich
359e38b4d4 fixed corrupted decrypt() in CTR mode
$buffer['encrypted'] (which is always empty) should be $buffer['ciphertext'] or buffered stream will get corrupt...

Example:
define('CRYPT_AES_MODE',CRYPT_AES_MODE_INTERNAL);//in MODE_MCRYPT all is fine
$aes = new Crypt_AES(CRYPT_AES_MODE_CTR);
$aes->setKey(':-8');
$aes->enableContinuousBuffer();
$plaintext = ':-):-):-):-):-):-)';
for($i=0; $i<strlen($plaintext); $i++) {
 echo $aes->Decrypt($aes->Encrypt($plaintext[$i]));
}

Output:
:-):-):-):-):-):-(

Expected:
:-):-):-):-):-):-)


After Bugfix, output is:
:-):-):-):-):-):-)
2013-01-04 14:23:34 +07: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
e4ccaef7bf Make PEM lines be 64 bytes long instead of 72
Also, add more notes to Crypt_Random's comments
2012-12-18 07:11:24 -06:00
terrafrost
7f5e9f404a Random: expand on the explanations as to how things work 2012-12-17 08:41:47 -06:00
terrafrost
35832fe2a1 Refactor crypt_random (renaming it to crypt_random_string)
...and update all the calls to it accordingly
2012-12-16 02:20:16 -06:00
Patrick Monnerat
06779a92de Merge branch 'master' of https://github.com/phpseclib/phpseclib into pmexts 2012-12-10 12:10:06 +01:00
Patrick Monnerat
f039a6ebc2 RSA: Allow changing openssl configuration file. X509: process HoldInstructionCode.
Also fixes HoldInstruction* OIDs.
2012-12-10 12:07:49 +01:00
terrafrost
3c6ae4312f The user_error in _handle_error shouldn't be replaced.. 2012-11-29 00:19: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
fbf3ba353e Null pad RSA ciphertext's to be the length of the modulo and improve XML parsing 2012-11-19 23:00:04 -06:00
terrafrost
2a1909fd71 Set $this->paddable to true in a few missing places 2012-11-16 02:59:06 -06:00
Patrick Monnerat
26b842be5b X509: compute public key identifiers.
Force subject public key identifier when signing a CA.
2012-10-29 18:21:25 +01:00
terrafrost
7ba006ccdc Add getSize() function to Crypt_RSA 2012-10-07 18:53:26 -05:00
terrafrost
ee25c73a44 Three fixes
- Ingore white space in keys
- Handle negative numbers in the same way OpenSSL seems to handle them
- Fix signature verification (thanks Richard Odekerken!)
2012-09-29 14:32:27 -05:00
terrafrost
13eed6147a Do CRYPT_DES_MODE_CBC instead of CRYPT_MODE_DES_CBC 2012-09-22 11:38:09 -05:00
terrafrost
6686e203e7 Reformat keys even if private key format is the same OpenSSL uses
As is private keys weren't being encrypted when a private key was being set and OpenSSL was being used.

Thanks TeigneuX!
2012-09-18 05:17:14 -05:00
terrafrost
26776b486e Update a few comments 2012-09-03 01:42:50 -05:00
terrafrost
a3781bd172 Changing the public key format broke File_X509 2012-09-03 01:32:57 -05:00
terrafrost
2f8d1055ea Use OpenSSL for Math_BigInteger::modPow speedups
Also, make Crypt_RSA's public keys compatible with OpenSSL and make it so __toString will return the key even when it's the public key that's loaded and it hasn't been set as the public key.
2012-08-26 01:36:34 -05:00
terrafrost
6c4fcd34d3 Misc fixes
- make it so '' is a legit password and doesn't unset the pw to pass bantu's unit tests (unit test could have been updated too but whatever)
- make it so not passing in any parameters to Crypt_RSA::setPassword() works without E_NOTICE or E_WARNING as per example in docs
- add missing phpdoc headers to File_ANSI
- cryan -> cyan in File_ANSI
2012-08-23 08:59:49 -05:00
terrafrost
6e1b79ba24 - add __toString magic method to Crypt_RSA 2012-07-26 13:14:18 -05:00
terrafrost
f292931aed - make Net_SSH2 return more printer friendly server public host keys 2012-07-04 13:36:26 -05:00
terrafrost
1417463eba - make Crypt_RSA use openssl for key generation (if openssl is available) and make it so File_X509 can create CSRs 2012-07-01 12:07:42 -05:00
terrafrost
f0e1b2deec - add second function_exists call to prevent require_once from being called if autoloader was called 2012-06-27 20:56:36 -05:00
terrafrost
5eacf2b05d - do class_exists(Crypt_Random) too to facilitate auto-loading 2012-06-24 16:53:16 -05:00
terrafrost
6ee991f604 Merge branch 'master' of https://github.com/phpseclib/phpseclib 2012-06-20 10:43:20 -05:00
terrafrost
1e3778dc4f - auto loading fixes (thanks skydiablo) 2012-06-20 10:36:36 -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
Andreas Fischer
5923f4ad68 [feature/consistent-file-endings] Remove remaining ?> from PHP files. 2012-06-11 10:33:39 +02:00
Rob Loach
7e9a975296 Add Composer support to phpseclib 2012-06-08 15:38:27 -04:00
Andreas Fischer
71dea1fc2b [topic/40730] Use strlen() instead of count() in function _equals() of Crypt_RSA.
It appears that count() always returns int(1) on strings. Thus, this check is
pointless as is. strlen() was meant here and is actually required to prevent
E_NOTICEs from invalid array accesses using $y[$i].
2012-06-06 13:12:48 +02:00
Jim Wigginton
7f1c861c1a - $this->mcrypt was removed in a commit from yesterday
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@222 21d32557-59b3-4da0-833f-c5933fad653e
2012-05-14 18:20:11 +00: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
5db0f88218 - add blinded rsa equality test (thanks singpolyma!)
- make validateSignature behave more like openssl_verify()

git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@218 21d32557-59b3-4da0-833f-c5933fad653e
2012-05-05 23:57:30 +00:00
Jim Wigginton
6d60fa63e5 - make it so the following all do the same thing:
$pubKey = new Crypt_RSA();
$pubKey->loadKey($privKey->getPublicKey());
$pubKey->setPublicKey();

$pubKey = new Crypt_RSA();
$pubKey->loadKey($privKey->getPublicKey());
$pubKey->setPublicKey($privKey->getPublicKey());

$pubKey = new Crypt_RSA();
$pubKey->setPublicKey($privKey->getPublicKey());

git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@211 21d32557-59b3-4da0-833f-c5933fad653e
2012-04-17 06:21:42 +00:00
Jim Wigginton
60340d5466 - make it so setPublicKey() can guess at the format like loadKey() can
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@204 21d32557-59b3-4da0-833f-c5933fad653e
2012-03-11 19:13:34 +00:00
Jim Wigginton
257b18501e - make setHash non case sensitive (thanks e1ven!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@191 21d32557-59b3-4da0-833f-c5933fad653e
2011-12-14 13:36:31 +00:00
Jim Wigginton
019edc6694 - the key has to be truncated before setKey() is called or else it'll be rounded up to the nearest key size - not down
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@190 21d32557-59b3-4da0-833f-c5933fad653e
2011-11-25 00:11:19 +00:00
Jim Wigginton
f600a9bb50 - !== is faster than !=
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@189 21d32557-59b3-4da0-833f-c5933fad653e
2011-11-24 19:03:56 +00:00
Jim Wigginton
70ea9ceec8 - update link to svn.php.net
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@188 21d32557-59b3-4da0-833f-c5933fad653e
2011-11-24 18:46:12 +00:00
Jim Wigginton
e8d6d8d165 - use openssl_random_pseudo_bytes if available (thanks wise.man!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@187 21d32557-59b3-4da0-833f-c5933fad653e
2011-11-24 18:32:49 +00:00
Jim Wigginton
b1c7fed946 - the IV wasn't resetting when mcrypt was being used
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@186 21d32557-59b3-4da0-833f-c5933fad653e
2011-11-16 06:53:36 +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
bc1c12357d - CRYPT_RSA_PUBLIC_FORMAT_XML didn't work correctly
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@184 21d32557-59b3-4da0-833f-c5933fad653e
2011-11-07 08:25:59 +00:00
Jim Wigginton
cfcf20cce5 - add the ability to save newly created keys in the XML and PuTTY formats
- add the ability to save private keys that have already been loaded

git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@182 21d32557-59b3-4da0-833f-c5933fad653e
2011-11-07 01:35:12 +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
2676ca1d91 - password protected PuTTY keys error out ungracefully when a bad password is used to decrypt
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@176 21d32557-59b3-4da0-833f-c5933fad653e
2011-08-17 00:12:42 +00:00
Jim Wigginton
a5d702346a - improved handling of malformed RSA keys: part II
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@172 21d32557-59b3-4da0-833f-c5933fad653e
2011-07-11 00:37:46 +00:00
Jim Wigginton
d4a3d61ff5 - improved handling of malformed RSA keys (thanks scope_v24!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@171 21d32557-59b3-4da0-833f-c5933fad653e
2011-07-11 00:02:53 +00:00
Jim Wigginton
96471cf1dd - fix an E_NOTE error in Rijndael.php (thanks, tchamness!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@164 21d32557-59b3-4da0-833f-c5933fad653e
2011-06-04 16:10:05 +00:00
Jim Wigginton
737ea2c9e9 - add support for a new type of key format (thanks spotweb2!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@159 21d32557-59b3-4da0-833f-c5933fad653e
2011-05-28 16:23:15 +00:00
Jim Wigginton
c61b3f9da9 - fix E_NOTICE (thanks, loige!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@157 21d32557-59b3-4da0-833f-c5933fad653e
2011-05-08 03:09:11 +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
06e8afb418 - fixed a bug that could prevent _emsa_pss_verify from working in rare circumstances (thanks Lesque!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@148 21d32557-59b3-4da0-833f-c5933fad653e
2011-03-19 03:32:22 +00:00
Jim Wigginton
27700e9ca7 - changed $fp to $urandom (thanks, Ben!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@144 21d32557-59b3-4da0-833f-c5933fad653e
2011-02-08 05:16:11 +00:00
Jim Wigginton
a4d39a9e66 - array_slice() reindexes the array so we'll use array_pop() instead
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@143 21d32557-59b3-4da0-833f-c5933fad653e
2011-02-06 16:35:48 +00:00
Jim Wigginton
5eea5be210 - fopen() can fail even when file_exists() succeeds (thanks, dakitiger!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@142 21d32557-59b3-4da0-833f-c5933fad653e
2011-02-06 01:12:20 +00:00
Jim Wigginton
80bf62d6fc - fix issues with partially generated RSA keys (thanks, Ben!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@141 21d32557-59b3-4da0-833f-c5933fad653e
2011-02-06 00:04:07 +00:00
Jim Wigginton
bf49338fa9 - the ciphertext wasn't being null padded correctly when it wasn't a multiple of the block size (thanks Elledan!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@139 21d32557-59b3-4da0-833f-c5933fad653e
2010-12-04 14:48:06 +00:00
Jim Wigginton
4ab5b5c16f - rm some legacy code and make Crypt_TripleDES better handle short keys
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@138 21d32557-59b3-4da0-833f-c5933fad653e
2010-12-02 04:59:46 +00:00
Jim Wigginton
354a0965e8 - AES should try to auto-predict the size of keys when the size isn't specified; last update interfered with that
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@137 21d32557-59b3-4da0-833f-c5933fad653e
2010-12-02 03:38:22 +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
66b5dad728 - rm debug code
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@133 21d32557-59b3-4da0-833f-c5933fad653e
2010-11-20 14:45:42 +00:00
Jim Wigginton
a31d9ba38d - rm debug code
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@131 21d32557-59b3-4da0-833f-c5933fad653e
2010-11-20 02:13:39 +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
dd4f0036f2 - fixed a bug that prevented key re-exchange from working
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@126 21d32557-59b3-4da0-833f-c5933fad653e
2010-10-24 01:24:30 +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
2140de74d0 - fixed a warning in Crypt_Rijndael
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@123 21d32557-59b3-4da0-833f-c5933fad653e
2010-09-26 05:02:10 +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
b3690e0fde - added support for AES-128-CBC encrypted private keys (ie. the default format of OpenSSH 5.4+)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@119 21d32557-59b3-4da0-833f-c5933fad653e
2010-09-05 03:04:29 +00:00
Jim Wigginton
d07570b0eb - added limited support for keyboard-interactive authentication (thanks, j31!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@115 21d32557-59b3-4da0-833f-c5933fad653e
2010-08-28 17:26:22 +00:00
Jim Wigginton
d9d70f8797 - fixed a few bugs in Crypt_Hash
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@114 21d32557-59b3-4da0-833f-c5933fad653e
2010-08-08 21:29:39 +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
3ef15724be - undo last commit - if you want to load a public key use loadKey(). it's called loadKey() and not loadPublicKey() for a reason. and while you're at it reread the documentation. i do have to concede, though... i should have read my own documentation before making the last commit.
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@112 21d32557-59b3-4da0-833f-c5933fad653e
2010-07-11 02:33:13 +00:00