Permalink
Browse files

fingerprint works on secret key too

  • Loading branch information...
1 parent d991d45 commit 61837722e67a4ed1514f390d3ecad0fa05f1d216 @singpolyma singpolyma committed with bendiken Apr 1, 2010
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/openpgp.php
View
@@ -798,16 +798,19 @@ function fingerprint() {
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);
}
}

0 comments on commit 6183772

Please sign in to comment.