Convenience function for expiry time of keys
This commit is contained in:
parent
9cdc2500b1
commit
5756085e85
@ -816,6 +816,18 @@ class OpenPGP_PublicKeyPacket extends OpenPGP_Packet {
|
||||
return $sigs;
|
||||
}
|
||||
|
||||
// Find expiry time of this key based on the self signatures in a message
|
||||
function expires($message) {
|
||||
foreach($this->self_signatures($message) as $p) {
|
||||
foreach(array_merge($p->hashed_subpackets, $p->unhashed_subpackets) as $s) {
|
||||
if($s instanceof OpenPGP_SignaturePacket_KeyExpirationTimePacket) {
|
||||
return $this->timestamp + $s->data;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL; // Never expires
|
||||
}
|
||||
|
||||
/**
|
||||
* @see http://tools.ietf.org/html/rfc4880#section-5.5.2
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user