forked from phpseclib/phpseclib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
170 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
use phpseclib3\Crypt\ECDSA; | ||
|
||
/** | ||
* Base Class for all stream cipher classes | ||
* Base Class for all asymmetric cipher classes | ||
* | ||
* @package AsymmetricKey | ||
* @author Jim Wigginton <[email protected]> | ||
|
@@ -173,8 +173,8 @@ public static function load($key, $password = false) | |
} | ||
|
||
$components['format'] = $format; | ||
|
||
$new = static::onLoad($components); | ||
$new->format = $format; | ||
return $new instanceof PrivateKey ? | ||
$new->withPassword($password) : | ||
$new; | ||
|
@@ -206,6 +206,7 @@ public static function loadFormat($type, $key, $password = false) | |
$components['format'] = $format; | ||
|
||
$new = static::onLoad($components); | ||
$new->format = $format; | ||
return $new instanceof PrivateKey ? | ||
$new->withPassword($password) : | ||
$new; | ||
|
@@ -304,16 +305,16 @@ public static function addFileFormat($fullname) | |
* Returns the format of the loaded key. | ||
* | ||
* If the key that was loaded wasn't in a valid or if the key was auto-generated | ||
* with RSA::createKey() then this will return false. | ||
* with RSA::createKey() then this will throw an exception. | ||
* | ||
* @see self::load() | ||
* @access public | ||
* @return mixed | ||
*/ | ||
public function getLoadedFormat() | ||
{ | ||
if ($this->format === false) { | ||
return false; | ||
if (empty($this->format)) { | ||
throw new NoKeyLoadedException('This key was created with createKey - it was not loaded with load. Therefore there is no "loaded format"'); | ||
} | ||
|
||
$meta = new \ReflectionClass($this->format); | ||
|
@@ -387,7 +388,7 @@ public function withHash($hash) | |
*/ | ||
public function getHash() | ||
{ | ||
return $this->hash->getHash(); | ||
return clone $this->hash; | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.