some minor fixes

This commit is contained in:
Gemorroj 2013-02-20 16:46:13 +03:00
parent 4334d381b9
commit cc2c844d0e
4 changed files with 19 additions and 19 deletions

View File

@ -143,7 +143,7 @@ function crypt_random_string($length) {
serialize($_POST) .
serialize($_GET) .
serialize($_COOKIE) .
serialize($_GLOBAL) .
serialize($GLOBALS) .
serialize($_SESSION) .
serialize($_OLD_SESSION)
));

View File

@ -260,7 +260,7 @@ class File_ASN1 {
*/
function decodeBER($encoded)
{
if (is_object($encoded) && strtolower(get_class($encoded)) == 'file_asn1_element') {
if (is_object($encoded) && strtolower(get_class($encoded)) === 'file_asn1_element') {
$encoded = $encoded->element;
}
@ -304,12 +304,12 @@ class File_ASN1 {
} while ( $loop );
}
// Length, as discussed in § 8.1.3 of X.690-0207.pdf#page=13
// Length, as discussed in <EFBFBD> 8.1.3 of X.690-0207.pdf#page=13
$length = ord($this->_string_shift($encoded));
$start++;
if ( $length == 0x80 ) { // indefinite length
// "[A sender shall] use the indefinite form (see 8.1.3.6) if the encoding is constructed and is not all
// immediately available." -- § 8.1.3.2.c
// immediately available." -- <EFBFBD> 8.1.3.2.c
//if ( !$constructed ) {
// return false;
//}
@ -323,7 +323,7 @@ class File_ASN1 {
extract(unpack('Nlength', substr(str_pad($temp, 4, chr(0), STR_PAD_LEFT), -4)));
}
// End-of-content, see §§ 8.1.1.3, 8.1.3.2, 8.1.3.6, 8.1.5, and (for an example) 8.6.4.2
// End-of-content, see <EFBFBD><EFBFBD> 8.1.1.3, 8.1.3.2, 8.1.3.6, 8.1.5, and (for an example) 8.6.4.2
if (!$type && !$length) {
return $decoded;
}
@ -357,7 +357,7 @@ class File_ASN1 {
// decode UNIVERSAL tags
switch ($tag) {
case FILE_ASN1_TYPE_BOOLEAN:
// "The contents octets shall consist of a single octet." -- § 8.2.1
// "The contents octets shall consist of a single octet." -- <EFBFBD> 8.2.1
//if (strlen($content) != 1) {
// return false;
//}
@ -410,7 +410,7 @@ class File_ASN1 {
}
break;
case FILE_ASN1_TYPE_NULL:
// "The contents octets shall not contain any octets." -- § 8.8.2
// "The contents octets shall not contain any octets." -- <EFBFBD> 8.8.2
//if (strlen($content)) {
// return false;
//}
@ -441,7 +441,7 @@ class File_ASN1 {
/* Each character string type shall be encoded as if it had been declared:
[UNIVERSAL x] IMPLICIT OCTET STRING
-- X.690-0207.pdf#page=23 (§ 8.21.3)
-- X.690-0207.pdf#page=23 (<EFBFBD> 8.21.3)
Per that, we're not going to do any validation. If there are any illegal characters in the string,
we don't really care */
@ -1055,7 +1055,7 @@ class File_ASN1 {
* DER-encode the length
*
* DER supports lengths up to (2**8)**127, however, we'll only support lengths up to (2**8)**4. See
* {@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 § 8.1.3} for more information.
* {@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 <EFBFBD> 8.1.3} for more information.
*
* @access private
* @param Integer $length

View File

@ -2630,9 +2630,9 @@ class File_X509 {
case !isset($this->currentCert) || !is_array($this->currentCert):
break;
case isset($this->currentCert['tbsCertificate']):
return $this->getDNProp($propname, $this->currentCert['tbsCertificate']['issuer'], $withType);
return $this->getDNProp($propName, $this->currentCert['tbsCertificate']['issuer'], $withType);
case isset($this->currentCert['tbsCertList']):
return $this->getDNProp($propname, $this->currentCert['tbsCertList']['issuer'], $withType);
return $this->getDNProp($propName, $this->currentCert['tbsCertList']['issuer'], $withType);
}
return false;
@ -2656,7 +2656,7 @@ class File_X509 {
case isset($this->currentCert['tbsCertificate']):
return $this->getDNProp($propName, $this->currentCert['tbsCertificate']['subject'], $withType);
case isset($this->currentCert['certificationRequestInfo']):
return $this->getDNProp($propname, $this->currentCert['certificationRequestInfo']['subject'], $withType);
return $this->getDNProp($propName, $this->currentCert['certificationRequestInfo']['subject'], $withType);
}
return false;
@ -4011,15 +4011,15 @@ class File_X509 {
return $this->computeKeyIdentifier($key['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey'], $method);
case !is_object($key):
return false;
case strtolower(get_class($key)) == 'file_asn1_element':
case strtolower(get_class($key)) === 'file_asn1_element':
$asn1 = new File_ASN1();
$decoded = $asn1->decodeBER($cert);
$decoded = $asn1->decodeBER($cert); //TODO:undefined variable $cert
if (empty($decoded)) {
return false;
}
$key = $asn1->asn1map($decoded[0], array('type' => FILE_ASN1_TYPE_BIT_STRING));
break;
case strtolower(get_class($key)) == 'file_x509':
case strtolower(get_class($key)) === 'file_x509':
if (isset($key->publicKey)) {
return $this->computeKeyIdentifier($key->publicKey, $method);
}

View File

@ -2112,7 +2112,7 @@ class Math_BigInteger {
if ($this->_compare($result, false, $temp[MATH_BIGINTEGER_VALUE], $temp[MATH_BIGINTEGER_SIGN]) < 0) {
$corrector_value = $this->_array_repeat(0, $n_length + 1);
$corrector_value[] = 1;
$result = $this->_add($result, false, $corrector, false);
$result = $this->_add($result, false, $corrector_value, false);
$result = $result[MATH_BIGINTEGER_VALUE];
}
@ -2425,12 +2425,12 @@ class Math_BigInteger {
}
/**
* Calculates the greatest common divisor and Bézout's identity.
* Calculates the greatest common divisor and B<EFBFBD>zout's identity.
*
* Say you have 693 and 609. The GCD is 21. Bézout's identity states that there exist integers x and y such that
* Say you have 693 and 609. The GCD is 21. B<EFBFBD>zout's identity states that there exist integers x and y such that
* 693*x + 609*y == 21. In point of fact, there are actually an infinite number of x and y combinations and which
* combination is returned is dependant upon which mode is in use. See
* {@link http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity Bézout's identity - Wikipedia} for more information.
* {@link http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity B<EFBFBD>zout's identity - Wikipedia} for more information.
*
* Here's an example:
* <code>