mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-04 18:48:24 +01:00
AsymetrticKey: add getComment() method
This commit is contained in:
parent
701881d3de
commit
d9615a6fb9
@ -115,6 +115,14 @@ abstract class AsymmetricKey
|
||||
*/
|
||||
protected static $engines = [];
|
||||
|
||||
/**
|
||||
* Key Comment
|
||||
*
|
||||
* @var null|string
|
||||
* @access private
|
||||
*/
|
||||
private $comment;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
@ -173,8 +181,10 @@ abstract class AsymmetricKey
|
||||
}
|
||||
|
||||
$components['format'] = $format;
|
||||
$comment = isset($components['comment']) ? $components['comment'] : null;
|
||||
$new = static::onLoad($components);
|
||||
$new->format = $format;
|
||||
$new->comment = $comment;
|
||||
return $new instanceof PrivateKey ?
|
||||
$new->withPassword($password) :
|
||||
$new;
|
||||
@ -425,6 +435,19 @@ abstract class AsymmetricKey
|
||||
return $meta->getShortName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the key's comment
|
||||
*
|
||||
* Not all key formats support comments. If you want to set a comment use toString()
|
||||
*
|
||||
* @access public
|
||||
* @return null|string
|
||||
*/
|
||||
public function getComment()
|
||||
{
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests engine validity
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user