Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SignaturePacket method to do actual signing

  • Loading branch information...
commit d991d454a74f89d05a93f1808f4ef0a5d0a5ea10 1 parent d17063c
@singpolyma singpolyma authored committed
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/openpgp.php
View
11 lib/openpgp.php
@@ -414,6 +414,17 @@ function __construct($data=NULL, $key_algorithm=NULL, $hash_algorithm=NULL) {
$this->data = $data; // Store to-be-signed data in here until the signing happens
}
+ /**
+ * $this->data must be set to the data to sign (done by constructor)
+ * $signers in the same format as $verifiers for OpenPGP_Message.
+ */
+ function sign_data($signers) {
+ $this->trailer = $this->body(true);
+ $signer = $signers[$this->key_algorithm_name()][$this->hash_algorithm_name()];
+ $this->data = call_user_func($signer, $this->data.$this->trailer);
+ $this->hash_head = array_pop(unpack('n', substr($this->data, 0, 2)));
+ }
+
function read() {
switch($this->version = ord($this->read_byte())) {
case 3:
Please sign in to comment.
Something went wrong with that request. Please try again.