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

310 Commits

Author SHA1 Message Date
Clint Nelissen
c70702afbb Namespaced Crypt\Random 2014-12-02 08:41:30 -08:00
Clint Nelissen
bc3deb191f Code sniff fix 2014-12-01 19:01:00 -08:00
Clint Nelissen
9c0c3faeb7 Initial commit 2014-12-01 18:54:44 -08:00
Andreas Fischer
5fa5a137dc Merge branch 'master' into php5
* master:
  RSA: syntax error in unit tests
  RSA: make unit tests perform string comparisons sans white space chars
  RSA: update unit test
  RSA: add unit test
  RSA: make XML keys use unsigned integers
2014-09-09 16:42:07 +02:00
terrafrost
c489852332 RSA: update unit test 2014-09-09 00:28:38 -05:00
terrafrost
713393c8ad RSA: make XML keys use unsigned integers
PKCS1 / PKCS8 keys need *signed* integers because of section 8.3.3
at http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=7
2014-09-06 11:13:11 -05:00
Andreas Fischer
830667ce75 Merge branch 'master' into php5
* master:
  Replaced "case true:" with "default:"
  Error: "Constant CRYPT_RSA_MODE already defined"
2014-08-25 15:16:34 +02:00
Vitaliy Zaytsev
2ee0529c9d Replaced "case true:" with "default:" 2014-08-25 19:58:38 +07:00
Vitaliy Zaytsev
cf10e07660 Error: "Constant CRYPT_RSA_MODE already defined"
It happens if defined(MATH_BIGINTEGER_OPENSSL_DISABLE) && !function_exists('openssl_pkey_get_details')
2014-08-25 19:03:24 +07:00
Andreas Fischer
6ba2b374e5 Merge branch 'master' into php5
* master:
  AES: don't do mcrypt unit tests if mcrypt extension is not available
  AES: a few final changes
  AES: set CRYPT_RIJNDAEL_MODE as well in unit tests
  AES: CS changes to unit tests
  AES: more unit test fixes
  AES: unit test updates
  AES: more unit test fixes
  AES: add new lines to end of unit tests
  AES: CS adjustments to unit tests
  AES: first attempt at unit tests for key padding
  Rijndael, AES: adjustments to what key sizes are and aren't allowed
2014-08-15 16:27:36 +02:00
terrafrost
aa0e7347ef AES: a few final changes 2014-08-14 23:09:17 -05:00
terrafrost
35fd2888ea Rijndael, AES: adjustments to what key sizes are and aren't allowed 2014-08-13 09:56:49 -05:00
Andreas Fischer
83485c130f Merge branch 'master' into php5
* master:
  Hash: apply fixes to sha512 unit tests as well
  Hash: one more fix to unit test
  Hash: fix unit tests
  Hash: add unit tests
  Hash: add sha256-96 and sha512-96
2014-08-10 17:59:08 +02:00
terrafrost
88d6517d93 Hash: add sha256-96 and sha512-96
IPSec uses them and some versions of OpenSSH use them (even though RFC6668 makes no mention of them)
2014-08-05 23:27:11 -05:00
Andreas Fischer
b50ef2dc64 Replace phpseclib_resolve_include_path with stream_resolve_include_path. 2014-06-19 16:14:15 +02:00
Andreas Fischer
f85d333912 Merge branch 'master' into php5
* master:
  phpseclib_is_includable() -> phpseclib_resolve_include_path()
  Drop Net_SSH2::_is_includable() method.
  Random: a few changes to the stream_resolve_include_path_function
  Replace stream_resolve_include_path with phpseclib_is_includable.
  Random: add explanatory comment
  SSH2: replace _is_includable() with stream_resolve_include_path
  Random: include the Crypt_* classes if they're available

Conflicts:
	tests/bootstrap.php
2014-06-19 16:09:23 +02:00
Andreas Fischer
709c7c4d48 Merge pull request #385 from bantu/a-random-change
Random: include the Crypt_* classes if they're available

* bantu/a-random-change:
  phpseclib_is_includable() -> phpseclib_resolve_include_path()
  Drop Net_SSH2::_is_includable() method.
  Random: a few changes to the stream_resolve_include_path_function
  Replace stream_resolve_include_path with phpseclib_is_includable.
  Random: add explanatory comment
  SSH2: replace _is_includable() with stream_resolve_include_path
  Random: include the Crypt_* classes if they're available
2014-06-19 16:08:59 +02:00
Andreas Fischer
fd65c55720 phpseclib_is_includable() -> phpseclib_resolve_include_path() 2014-06-19 14:57:09 +02:00
terrafrost
96ccca2817 Random: a few changes to the stream_resolve_include_path_function 2014-06-18 22:03:09 +02:00
Andreas Fischer
9c90beaf82 Replace stream_resolve_include_path with phpseclib_is_includable. 2014-06-17 14:38:24 +02:00
Andreas Fischer
8ba3dd0846 Merge branch 'master' into php5
* master:
  Crypt/Base: readability improvement
  RSA: CS adjustments
  RSA: rename PUBLIC_FORMAT_PKCS1_RAW -> PUBLIC_FORMAT_PKCS8
  RSA: add PKCS8 unit tests
  RSA: add support for saving encrypted PKCS8 keys
  Crypt/Base: adjust default key size for pbkdf1
  RSA: add support for loading PKCS8 encrypted private keys
  Crypt/Base: add support for pbkdf1
  RSA: add support for saving to PKCS8 (unencrypted)
2014-06-17 00:36:54 +02:00
Andreas Fischer
f807d8799e Merge pull request #370 from terrafrost/pkcs8
RSA: add support for PKCS8 encoded private keys

* terrafrost/pkcs8:
  Crypt/Base: readability improvement
  RSA: CS adjustments
  RSA: rename PUBLIC_FORMAT_PKCS1_RAW -> PUBLIC_FORMAT_PKCS8
  RSA: add PKCS8 unit tests
  RSA: add support for saving encrypted PKCS8 keys
  Crypt/Base: adjust default key size for pbkdf1
  RSA: add support for loading PKCS8 encrypted private keys
  Crypt/Base: add support for pbkdf1
  RSA: add support for saving to PKCS8 (unencrypted)
2014-06-17 00:36:54 +02:00
Andreas Fischer
b56c6a535e HHVM does not like it when we call an non-existent parent constructor. 2014-06-16 22:18:19 +02: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
ac449e1965 Merge branch 'master' into php5
* master:
  Always correctly link to the constructor of Crypt_Base.
2014-06-16 17:03:52 +02:00
Andreas Fischer
765154f54e Merge pull request #378 from bantu/UselessOverridingMethod
Always correctly link to the constructor of Crypt_Base.

* bantu/UselessOverridingMethod:
  Always correctly link to the constructor of Crypt_Base.
2014-06-16 17:03:51 +02:00
terrafrost
0bafe1e6c6 Crypt/Base: readability improvement 2014-06-16 09:57:04 -05:00
terrafrost
82b5e02f06 Random: add explanatory comment 2014-06-16 09:53:55 -05:00
Andreas Fischer
d38886c2a9 Always correctly link to the constructor of Crypt_Base. 2014-06-16 16:42:18 +02:00
terrafrost
638e6c78ec Random: include the Crypt_* classes if they're available
also error out if none are available
2014-06-16 09:40:27 -05:00
Andreas Fischer
c2a6667ed2 Merge branch 'master' into php5
* master:
  Remove unnecessary constructors.
2014-06-16 16:29:29 +02:00
Andreas Fischer
c05cfe4c10 Merge pull request #376 from bantu/UselessOverridingMethod
Remove unnecessary constructors.

* bantu/UselessOverridingMethod:
  Remove unnecessary constructors.
2014-06-16 16:29:28 +02:00
Andreas Fischer
635c524b6b Merge branch 'master' into php5
* master:
  RC4: speedups
2014-06-16 16:28:29 +02:00
Andreas Fischer
5cc024a3b5 Merge pull request #377 from terrafrost/rc4-changes
RC4: speedups

* terrafrost/rc4-changes:
  RC4: speedups
2014-06-16 16:28:29 +02:00
terrafrost
0938cba3c3 RC4: speedups 2014-06-16 09:19:14 -05:00
Andreas Fischer
91e78c2106 Remove unnecessary constructors. 2014-06-16 16:14:35 +02:00
Andreas Fischer
6a8ac88a0c Merge branch 'master' into php5
* master:
  RC2: speed-ups and CS changes
2014-06-13 23:49:53 +02:00
terrafrost
04d66db309 RC2: speed-ups and CS changes 2014-06-13 16:30:12 -05:00
terrafrost
d8b235141e RSA: CS adjustments 2014-06-13 13:17:37 -05:00
terrafrost
83301097ea RSA: rename PUBLIC_FORMAT_PKCS1_RAW -> PUBLIC_FORMAT_PKCS8
also make CRYPT_RSA_PUBLIC_FORMAT_PKCS8 the default format
2014-06-13 13:11:59 -05:00
terrafrost
4434d91f25 RSA: add support for saving encrypted PKCS8 keys 2014-06-13 11:43:32 -05:00
terrafrost
d474f56f60 Crypt/Base: adjust default key size for pbkdf1 2014-06-13 10:39:57 -05:00
terrafrost
abae026264 RSA: add support for loading PKCS8 encrypted private keys 2014-06-13 08:56:00 -05:00
terrafrost
21c6a15df3 Crypt/Base: add support for pbkdf1 2014-06-13 08:54:30 -05:00
terrafrost
0a5e26a648 RSA: add support for saving to PKCS8 (unencrypted) 2014-06-12 22:03:00 -05:00
Andreas Fischer
76ac2a863d Merge branch 'master' into php5
* master:
  RSA: slight adjustment to CRYPT_RSA_PUBLIC_FORMAT_PKCS1_RAW format
2014-06-11 08:05:49 +02:00
terrafrost
72a0913d39 RSA: slight adjustment to CRYPT_RSA_PUBLIC_FORMAT_PKCS1_RAW format
CRYPT_RSA_PUBLIC_FORMAT_PKCS1_RAW and CRYPT_RSA_PUBLIC_FORMAT_PKCS1
produce two very similar looking keys but they are not the same.
As dissection OpenSSL's asn1parse would reveal CRYPT_RSA_PUBLIC_FORMAT_PKCS1
has the fact that it is an RSA key embedded within it whereas
CRYPT_RSA_PUBLIC_FORMAT_PKCS1_RAW does not. phpseclib now resolves
this ambiguity in the same way that OpenSSH's ssh-keygen does.

Despite this change CRYPT_RSA_PUBLIC_FORMAT_PKCS1_RAW is still incompatible
with OpenSSL's rsautl (CRYPT_RSA_PUBLIC_FORMAT_PKCS1 is compatible). I guess
this incompatibility isn't just due to the headers but is also due to the
overall structure of the format.
2014-06-10 22:16:59 -05:00
Andreas Fischer
2a9d7e5e03 Merge branch 'master' into php5
* master:
  X509: Unit test CS changes
  X509: move location of SPKAC unit test
  X509: CS adjustments
  X509: PHP4 compat changes
  RSA: PHP4 compat changes
  X509: rm trailing white space from unit test
  X509: add SPKAC unit test
  X509: add signSPKAC() and saveSPKAC() methods
2014-06-05 16:56:36 +02:00
terrafrost
daa466db94 Merge branch 'master' of https://github.com/phpseclib/phpseclib into spkac 2014-06-05 08:40:49 -05:00
terrafrost
af0040b813 RSA: PHP4 compat changes 2014-06-05 08:10:20 -05:00