diff options
author | Christophe Fergeau <cfergeau@mandriva.com> | 2009-05-11 13:17:06 +0000 |
---|---|---|
committer | Christophe Fergeau <cfergeau@mandriva.com> | 2009-05-11 13:17:06 +0000 |
commit | 773de2cbfd1a7df8d2207d90d2661b6c2be7ef77 (patch) | |
tree | 20b8fcb8ffac53e84152430a50091b2992d1feeb | |
parent | bb9acaba360cbdb1ad4736fc6ca6c032c9fc95a3 (diff) | |
download | perl-URPM-773de2cbfd1a7df8d2207d90d2661b6c2be7ef77.tar perl-URPM-773de2cbfd1a7df8d2207d90d2661b6c2be7ef77.tar.gz perl-URPM-773de2cbfd1a7df8d2207d90d2661b6c2be7ef77.tar.bz2 perl-URPM-773de2cbfd1a7df8d2207d90d2661b6c2be7ef77.tar.xz perl-URPM-773de2cbfd1a7df8d2207d90d2661b6c2be7ef77.zip |
Introduce get_gpg_fingerprint XS function
-rw-r--r-- | URPM.xs | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -3727,6 +3727,42 @@ Urpm_verify_rpm(filename, ...) OUTPUT: RETVAL + +char * +Urpm_get_gpg_fingerprint(filename) + URPM::DB db + char * filename + PREINIT: + uint8_t fingerprint[sizeof(pgpKeyID_t)]; + char fingerprint_str[sizeof(pgpKeyID_t) * 2 + 1]; +#if RPM_VERSION_CODE < RPM_VERSION(5,2,0) + const +#endif + uint8_t *pkt = NULL; + size_t pktlen = 0; + int rc; + + CODE: + memset (fingerprint, 0, sizeof (fingerprint)); + if ((rc = pgpReadPkts(filename, (uint8_t ** ) &pkt, &pktlen)) <= 0) { + fprintf(stderr, "pgpReadPkts failed\n"); + pktlen = 0; + } else if (rc != PGPARMOR_PUBKEY) { + fprintf(stderr, "not an armoured pubkey\n"); + pktlen = 0; + } else { + unsigned int i; + pgpPubkeyFingerprint (pkt, pktlen, fingerprint); + for (i = 0; i < sizeof (pgpKeyID_t); i++) { + sprintf(&fingerprint_str[i*2], "%02x", fingerprint[i]); + } + } + _free(pkt); + RETVAL = fingerprint_str; + OUTPUT: + RETVAL + + char * Urpm_verify_signature(filename, prefix="/") char *filename |