summaryrefslogtreecommitdiff
path: root/rpmio/rpmkeyring.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2011-11-09 12:47:02 +0200
committerPanu Matilainen <pmatilai@redhat.com>2011-11-09 13:09:37 +0200
commit9e58316b0fd69da9e57cdbaee0aeeab8c47b033a (patch)
tree7ffd2e47b4266125fd15d560e834cccd518c6eef /rpmio/rpmkeyring.c
parent6f7700dbed99068449717f384e2683c4b2f5fe67 (diff)
downloadlibrpm-tizen-9e58316b0fd69da9e57cdbaee0aeeab8c47b033a.tar.gz
librpm-tizen-9e58316b0fd69da9e57cdbaee0aeeab8c47b033a.tar.bz2
librpm-tizen-9e58316b0fd69da9e57cdbaee0aeeab8c47b033a.zip
Add a signature verification method to keyring
- At least within rpm itself, callers aren't particularly interested in the actual key that matches a given signature, they just want simple good/bad/nokey answers. This makes life simple for them and avoids exposing further rpmPubkey internals through APIs.
Diffstat (limited to 'rpmio/rpmkeyring.c')
-rw-r--r--rpmio/rpmkeyring.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/rpmio/rpmkeyring.c b/rpmio/rpmkeyring.c
index 74b152aba..6ebaab89e 100644
--- a/rpmio/rpmkeyring.c
+++ b/rpmio/rpmkeyring.c
@@ -255,3 +255,21 @@ rpmRC rpmKeyringLookup(rpmKeyring keyring, pgpDig sig)
return res;
}
+
+rpmRC rpmKeyringVerifySig(rpmKeyring keyring, pgpDigParams sig, DIGEST_CTX ctx)
+{
+ rpmRC rc = RPMRC_FAIL;
+
+ if (sig && ctx) {
+ pgpDigParams pgpkey = NULL;
+ rpmPubkey key = findbySig(keyring, sig);
+
+ if (key)
+ pgpkey = key->pgpkey;
+
+ /* We call verify even if key not found for a signature sanity check */
+ rc = pgpVerifySignature(pgpkey, sig, ctx);
+ }
+
+ return rc;
+}