From b84a2a8752a493dd11bbbe9fae2a4f068ee502ec Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 25 Jul 2011 15:15:01 -0500 Subject: [PATCH] Allow using keys as data to sign over --- lib/openpgp.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/openpgp.php b/lib/openpgp.php index 83c2b73..956d089 100644 --- a/lib/openpgp.php +++ b/lib/openpgp.php @@ -415,6 +415,11 @@ class OpenPGP_SignaturePacket extends OpenPGP_Packet { $this->signature_type = ($data->format == 'b') ? 0x00 : 0x01; $data->normalize(); $data = $data->data; + } else if($data instanceof OpenPGP_Message && $data[0] instanceof OpenPGP_PublicKeyPacket) { + // $data is a message with PublicKey first, UserID second + $key = implode('', $data[0]->fingerprint_material()); + $user_id = $data[1]->body(); + $data = $key . chr(0xB4) . pack('N', strlen($user_id)) . $user_id; } $this->data = $data; // Store to-be-signed data in here until the signing happens }