示例#1
0
 /**
  * Verify the signature
  *
  * @param $data The data to verify the signature of
  * @param $signature The signature to match
  * @return Boolean true if the signature is valid
  */
 static function verify($signature)
 {
     $gp = gnupg_init();
     $result = "";
     if (gnupg_verify($gp, $this->data, $signature)) {
         return true;
     } else {
         return false;
     }
 }
示例#2
0
function login($sig, $key, $text)
{
    # Set this to a private directory outside of the webroot. Make sure the permissions are correct
    putenv("GNUPGHOME=/var/www/clients/client0/web5/private/.gnupg");
    $res = gnupg_init();
    gnupg_seterrormode($res, GNUPG_ERROR_WARNING);
    gnupg_import($res, $key);
    $info = gnupg_verify($res, $text, $sig);
    $key = gnupg_keyinfo($res, $info[fingerprint])[0];
    $id = $key["subkeys"][0]["keyid"];
    $uid = $key["uids"][0];
    print " KeyId: " . $id;
    var_dump($uid);
}