Skip to content

Commit

Permalink
fingerprint works on secret key too
Browse files Browse the repository at this point in the history
  • Loading branch information
singpolyma authored and artob committed Jun 18, 2010
1 parent d991d45 commit 6183772
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/openpgp.php
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 6183772

Please sign in to comment.