From 191aeaa4d918efe77b4f7c01d8fc89bb6c9a1a9c Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 1 Apr 2010 12:50:08 -0500 Subject: [PATCH] fingerprint works on secret key too --- lib/openpgp.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/openpgp.php b/lib/openpgp.php index 4d9b528..c83ce8b 100644 --- a/lib/openpgp.php +++ b/lib/openpgp.php @@ -798,16 +798,19 @@ class OpenPGP_PublicKeyPacket extends OpenPGP_Packet { case 3: return $this->fingerprint = md5($this->key['n'] . $this->key['e']); case 4: - $material = array( - chr(0x99), pack('n', $this->length), + $head = array( + chr(0x99), NULL, chr($this->version), pack('N', $this->timestamp), chr($this->algorithm), ); + $material = array(); foreach ($this->key as $data) { $material[] = pack('n', OpenPGP::bitlength($data)); $material[] = $data; } - return $this->fingerprint = sha1(implode('', $material)); + $material = implode('', $material); + $head[1] = pack('n', 6 + strlen($material)); + return $this->fingerprint = sha1(implode('',$head).$material); } }