i had some trouble w/ that my self, and there's more trouble down this
road for you...( rpmVerifySignature needs a ts, a ts needs a dig, dig
needs readFile, and readFile needs rpmio_internal.h?? something like
that. that's your most likely discovery path, anywhoo... uhhgg.)
try something along the lines of (mostly culled from lib/rpmchecksig.c):
// rpm "lead"...
memset(l, 0, sizeof(*l));
rpmlrc = readLead(sfd, l);
if (rpmlrc != RPMRC_OK) {
printf("%s: not an rpm package\n", argv[1]);
exit(10);
}
// rpm version of current package
switch (l->major) {
case 1:
printf("%s: No signature available (v1.0 RPM)\n", argv[1]);
break;
exit(11);
default:
break;
}
// read the signature
msg = NULL;
printf("reading signatures...");
int rpmRSrc = rpmReadSignature(sfd, &sigh, l->signature_type, &msg);
printf(" ok\n");
switch (rpmRSrc) {
default:
printf("%s: rpmReadSignature failed: %s", argv[1],
(msg && *msg? msg : "\n"));
msg = _free(msg);
exit(12);
break;
case RPMRC_OK:
if (sigh == NULL) {
printf("%s: No signature available\n", argv[1]);
exit(13);
}
break;
}
msg = _free(msg);
try running doxygen over the source again for the api documentation?
there seems to be some voodoo around signatures, and folks don't seem to
like to talk about them much.
good luck!
star
On Tue, 2003-08-12 at 20:57, David Eduardo Gomez Noguera wrote:
> Hello.
> I am trying to learn to program with librpm. Im using RedHat 9's rpm
> packages.
> The devel package, aside from the fact that doesnt include the api, it
> seems to have the same header files that other devel packages, but files
> like signature.h are not included.
> Why is that so?
> I just wrote this test app, and crashes on rpmReadSignature . Is that
> function deprecated? it doesnt say so on the API docs.
> here is the program (small) if you could point me out. Maybe I shouldnt
> be usign those functions
> NOTE: I am using RedHat RPM Guide book
> --------- Start Here -------------
> #include <stdio.h>
> #include <stdlib.h>
>
> #include <rpm/rpmlib.h>
>
> int main(int argc, char *argv[])
> {
> FD_t fd;
> struct rpmlead lead;
> Header header;
> rpmRC rc;
>
> int status = rpmReadConfigFiles( NULL, NULL);
>
> if(status) {
> printf("Error reading RC files.\n");
> exit(-1);
> } else {
> printf("Read RC OK\n");
> }
>
> rpmSetVerbosity(RPMMESS_NORMAL);
>
> rpmShowRC(stdout);
>
>
> fd = Fopen("mldonkey-2.5-3.i586.rpm","r");
> readLead(fd,&lead);
> header=headerRead(fd, (lead.major >=3) ? HEADER_MAGIC_YES :
> HEADER_MAGIC_NO);
> rc=rpmReadSignature(fd, &header, lead.signature_type);
>
> exit(0);
> }
> ---- End Here----
>
> Of course, this doesnt do anything usefull, and its only intended to
> help me learn librpm with c.
>
>
> _______________________________________________
> Rpm-list mailing list
> Rpm-list@redhat.com
> https://www.redhat.com/mailman/listinfo/rpm-list
--
| Star Morin
| System Engineer - Muse Research Inc
| mail: star@museresearch.com
| tel: (650) 326-5400 x140
Attachment:
signature.asc
Description: This is a digitally signed message part