Initial revision

CVS patchset: 303
CVS date: 1996/02/19 02:19:18
This commit is contained in:
marc 1996-02-19 02:19:18 +00:00
parent 5a64e734f5
commit 6cad74bc6e
2 changed files with 72 additions and 0 deletions

40
tools/rpmchecksig.c Normal file
View File

@ -0,0 +1,40 @@
/* rpmchecksig: verify the signature of an RPM */
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include "rpmlib.h"
#include "rpmlead.h"
#include "signature.h"
int main(int argc, char **argv)
{
int fd;
struct rpmlead lead;
char *sig;
char result[1024];
int res;
if (argc == 1) {
fd = 0;
} else {
fd = open(argv[1], O_RDONLY, 0644);
}
/* Need this for any PGP settings */
if (readConfigFiles())
exit(-1);
readLead(fd, &lead);
readSignature(fd, lead.signature_type, (void **) &sig);
res = verifySignature(fd, lead.signature_type, sig, result);
printf("%s", result);
if (res) {
printf("Signature OK.\n");
return 0;
} else {
printf("Signature NOT OK!\n");
return 1;
}
}

32
tools/rpmsignature.c Normal file
View File

@ -0,0 +1,32 @@
/* rpmsignature: spit out the signature portion of a package */
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include "rpmlead.h"
#include "signature.h"
int main(int argc, char **argv)
{
int fd;
struct rpmlead lead;
char *sig;
if (argc == 1) {
fd = 0;
} else {
fd = open(argv[1], O_RDONLY, 0644);
}
readLead(fd, &lead);
readSignature(fd, lead.signature_type, (void **) &sig);
switch (lead.signature_type) {
case RPMSIG_NONE:
break;
case RPMSIG_PGP262_1024:
write(1, sig, 152);
}
return 0;
}