Permalink
Browse files

Convenience function for expiry time of keys

  • Loading branch information...
1 parent 92f73ae commit 43291a8aec280483f285fcdac52f24042409ea5d @singpolyma singpolyma committed with bendiken Apr 1, 2010
Showing with 12 additions and 0 deletions.
  1. +12 −0 lib/openpgp.php
View
12 lib/openpgp.php
@@ -816,6 +816,18 @@ function self_signatures($message) {
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
*/

0 comments on commit 43291a8

Please sign in to comment.