mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-10 21:38:50 +01:00
Code cleanups
This commit is contained in:
parent
cf477d0908
commit
abdd248af9
21
TODO
21
TODO
@ -45,14 +45,10 @@
|
|||||||
|
|
||||||
* g10/trustdb.c (make_sig_records): fix the fixme.
|
* g10/trustdb.c (make_sig_records): fix the fixme.
|
||||||
|
|
||||||
* Replace Valid/Invalid by Known/Unknown?
|
|
||||||
|
|
||||||
* Fix the bug in the mips assembler code
|
* Fix the bug in the mips assembler code
|
||||||
|
|
||||||
* Add a way to show the fingerprint of an key signator's keys
|
* Add a way to show the fingerprint of an key signator's keys
|
||||||
|
|
||||||
* New option --file-remove path-to-wipe-program ?
|
|
||||||
|
|
||||||
* Add an is_valid flag to each user ID.
|
* Add an is_valid flag to each user ID.
|
||||||
|
|
||||||
* Do not create a secring.gpg if it is not needed; I have fixed this
|
* Do not create a secring.gpg if it is not needed; I have fixed this
|
||||||
@ -84,10 +80,11 @@
|
|||||||
* --passphrase-fd can't work with -cs: document this or find a way
|
* --passphrase-fd can't work with -cs: document this or find a way
|
||||||
to work around.
|
to work around.
|
||||||
|
|
||||||
Scheduled for 1.1
|
|
||||||
-----------------
|
|
||||||
* export by user-IDs does only export the first matching name which leads
|
* export by user-IDs does only export the first matching name which leads
|
||||||
to a problem in cases where there are 2 keys with identically user-IDs.
|
to a problem in cases where there are 2 keys with identically
|
||||||
|
user-IDs.
|
||||||
|
--> Check whether this is still true.
|
||||||
|
|
||||||
|
|
||||||
* With option -i prompt before adding a key to the keyring and show some
|
* With option -i prompt before adding a key to the keyring and show some
|
||||||
info what we are about to add.
|
info what we are about to add.
|
||||||
@ -95,9 +92,12 @@ Scheduled for 1.1
|
|||||||
* --disable-asm should still assemble _udiv_qrnnd when needed
|
* --disable-asm should still assemble _udiv_qrnnd when needed
|
||||||
|
|
||||||
* Skip RO keyrings when importing a key.
|
* Skip RO keyrings when importing a key.
|
||||||
|
[Do an access(2) when registering a keyring and add code to
|
||||||
|
keydb_locate_writable()]
|
||||||
|
|
||||||
* replace the keyserver stuff either by a call to a specialized
|
* replace the keyserver stuff either by a call to a specialized
|
||||||
utility and SOCKSify this utility.
|
utility and SOCKSify this utility.
|
||||||
|
[David is working on this]
|
||||||
|
|
||||||
* Check the beginning of file to detect already compressed files (gzip,
|
* Check the beginning of file to detect already compressed files (gzip,
|
||||||
bzip2, xdelta and some picture formats)
|
bzip2, xdelta and some picture formats)
|
||||||
@ -105,7 +105,7 @@ Scheduled for 1.1
|
|||||||
* Get new assembler stuff from gmp 3.1
|
* Get new assembler stuff from gmp 3.1
|
||||||
|
|
||||||
* Use new-format headers for compressed packets.
|
* Use new-format headers for compressed packets.
|
||||||
|
The advantage is that a garbled zip file can be better detected.
|
||||||
|
|
||||||
|
|
||||||
Nice to have
|
Nice to have
|
||||||
@ -118,11 +118,14 @@ Nice to have
|
|||||||
* add test cases for invalid data (scrambled armor or other random data)
|
* add test cases for invalid data (scrambled armor or other random data)
|
||||||
* add checking of armor trailers
|
* add checking of armor trailers
|
||||||
* the pubkey encrypt functions should do some sanity checks.
|
* the pubkey encrypt functions should do some sanity checks.
|
||||||
* dynload: implement the hint stuff.
|
|
||||||
* "gpg filename.tar.gz.asc" should work like --verify (-sab).
|
* "gpg filename.tar.gz.asc" should work like --verify (-sab).
|
||||||
* for messages created with "-t", it might make sense to append the
|
* for messages created with "-t", it might make sense to append the
|
||||||
verification status of the message to the output (i.e. write something to
|
verification status of the message to the output (i.e. write something to
|
||||||
the --output file and not only to stderr.
|
the --output file and not only to stderr.
|
||||||
|
|
||||||
|
|
||||||
|
Things we won't do
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* New option --file-remove path-to-wipe-program ?
|
||||||
|
|
||||||
|
@ -1,5 +1,16 @@
|
|||||||
|
2001-09-20 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* passphrase.c (agent_open): Add missing bracket. Include windows.h.
|
||||||
|
|
||||||
2001-09-19 Werner Koch <wk@gnupg.org>
|
2001-09-19 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* keylist.c (print_fingerprint): Renamed from fingerprint, made
|
||||||
|
global available. Added new arg to control the print style.
|
||||||
|
* mainproc.c (print_fingerprint): Removed.
|
||||||
|
* pkclist.c (print_fpr, fpr_info): Removed and changed callers to
|
||||||
|
use print_fingerprint.
|
||||||
|
* keyedit.c (show_fingerprint): Ditto.
|
||||||
|
|
||||||
* passphrase.c (writen, readn)
|
* passphrase.c (writen, readn)
|
||||||
(agent_open, agent_close)
|
(agent_open, agent_close)
|
||||||
(agent_get_passphrase)
|
(agent_get_passphrase)
|
||||||
|
@ -54,6 +54,7 @@ common_source = \
|
|||||||
status.h \
|
status.h \
|
||||||
plaintext.c \
|
plaintext.c \
|
||||||
sig-check.c \
|
sig-check.c \
|
||||||
|
keylist.c \
|
||||||
signal.c
|
signal.c
|
||||||
|
|
||||||
gpg_SOURCES = g10.c \
|
gpg_SOURCES = g10.c \
|
||||||
@ -65,7 +66,6 @@ gpg_SOURCES = g10.c \
|
|||||||
seckey-cert.c \
|
seckey-cert.c \
|
||||||
encr-data.c \
|
encr-data.c \
|
||||||
cipher.c \
|
cipher.c \
|
||||||
keylist.c \
|
|
||||||
encode.c \
|
encode.c \
|
||||||
sign.c \
|
sign.c \
|
||||||
verify.c \
|
verify.c \
|
||||||
|
@ -499,7 +499,7 @@ keydb_delete_keyblock (KEYDB_HANDLE hd)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Locate the default writable key resource, so that the next
|
* Locate the default writable key resource, so that the next
|
||||||
* operation (which is only releavnt for inserts) will be onde on this
|
* operation (which is only relevant for inserts) will be done on this
|
||||||
* resource.
|
* resource.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
|
@ -44,7 +44,6 @@ static void show_prefs( PKT_user_id *uid, int verbose );
|
|||||||
static void show_key_with_all_names( KBNODE keyblock,
|
static void show_key_with_all_names( KBNODE keyblock,
|
||||||
int only_marked, int with_fpr, int with_subkeys, int with_prefs );
|
int only_marked, int with_fpr, int with_subkeys, int with_prefs );
|
||||||
static void show_key_and_fingerprint( KBNODE keyblock );
|
static void show_key_and_fingerprint( KBNODE keyblock );
|
||||||
static void show_fingerprint( PKT_public_key *pk );
|
|
||||||
static int menu_adduid( KBNODE keyblock, KBNODE sec_keyblock );
|
static int menu_adduid( KBNODE keyblock, KBNODE sec_keyblock );
|
||||||
static void menu_deluid( KBNODE pub_keyblock, KBNODE sec_keyblock );
|
static void menu_deluid( KBNODE pub_keyblock, KBNODE sec_keyblock );
|
||||||
static int menu_delsig( KBNODE pub_keyblock );
|
static int menu_delsig( KBNODE pub_keyblock );
|
||||||
@ -1166,7 +1165,7 @@ show_key_with_all_names( KBNODE keyblock, int only_marked,
|
|||||||
|
|
||||||
if( with_fpr ) {
|
if( with_fpr ) {
|
||||||
tty_printf("\n");
|
tty_printf("\n");
|
||||||
show_fingerprint( pk );
|
print_fingerprint ( pk, NULL, 2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tty_printf("\n");
|
tty_printf("\n");
|
||||||
@ -1248,36 +1247,10 @@ show_key_and_fingerprint( KBNODE keyblock )
|
|||||||
}
|
}
|
||||||
tty_printf("\n");
|
tty_printf("\n");
|
||||||
if( pk )
|
if( pk )
|
||||||
show_fingerprint( pk );
|
print_fingerprint( pk, NULL, 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
show_fingerprint( PKT_public_key *pk )
|
|
||||||
{
|
|
||||||
byte array[MAX_FINGERPRINT_LEN], *p;
|
|
||||||
size_t i, n;
|
|
||||||
|
|
||||||
fingerprint_from_pk( pk, array, &n );
|
|
||||||
p = array;
|
|
||||||
tty_printf(_(" Fingerprint:"));
|
|
||||||
if( n == 20 ) {
|
|
||||||
for(i=0; i < n ; i++, i++, p += 2 ) {
|
|
||||||
if( i == 10 )
|
|
||||||
tty_printf(" ");
|
|
||||||
tty_printf(" %02X%02X", *p, p[1] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for(i=0; i < n ; i++, p++ ) {
|
|
||||||
if( i && !(i%8) )
|
|
||||||
tty_printf(" ");
|
|
||||||
tty_printf(" %02X", *p );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tty_printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************
|
/****************
|
||||||
* Ask for a new user id, do the selfsignature and put it into
|
* Ask for a new user id, do the selfsignature and put it into
|
||||||
|
120
g10/keylist.c
120
g10/keylist.c
@ -31,6 +31,7 @@
|
|||||||
#include "keydb.h"
|
#include "keydb.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "ttyio.h"
|
||||||
#include "trustdb.h"
|
#include "trustdb.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
@ -38,7 +39,6 @@
|
|||||||
static void list_all(int);
|
static void list_all(int);
|
||||||
static void list_one( STRLIST names, int secret);
|
static void list_one( STRLIST names, int secret);
|
||||||
static void list_keyblock( KBNODE keyblock, int secret );
|
static void list_keyblock( KBNODE keyblock, int secret );
|
||||||
static void fingerprint( PKT_public_key *pk, PKT_secret_key *sk );
|
|
||||||
|
|
||||||
|
|
||||||
/****************
|
/****************
|
||||||
@ -268,7 +268,7 @@ list_keyblock_print ( KBNODE keyblock, int secret )
|
|||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( !any ) {
|
if( !any ) {
|
||||||
if( opt.fingerprint )
|
if( opt.fingerprint )
|
||||||
fingerprint( pk, sk );
|
print_fingerprint( pk, sk, 0 );
|
||||||
if( opt.with_key_data )
|
if( opt.with_key_data )
|
||||||
print_key_data( pk, keyid );
|
print_key_data( pk, keyid );
|
||||||
any = 1;
|
any = 1;
|
||||||
@ -281,7 +281,7 @@ list_keyblock_print ( KBNODE keyblock, int secret )
|
|||||||
if( !any ) {
|
if( !any ) {
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( opt.fingerprint )
|
if( opt.fingerprint )
|
||||||
fingerprint( pk, sk ); /* of the main key */
|
print_fingerprint( pk, sk, 0 ); /* of the main key */
|
||||||
any = 1;
|
any = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ list_keyblock_print ( KBNODE keyblock, int secret )
|
|||||||
}
|
}
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( opt.fingerprint > 1 )
|
if( opt.fingerprint > 1 )
|
||||||
fingerprint( pk2, NULL );
|
print_fingerprint( pk2, NULL, 0 );
|
||||||
if( opt.with_key_data )
|
if( opt.with_key_data )
|
||||||
print_key_data( pk2, keyid2 );
|
print_key_data( pk2, keyid2 );
|
||||||
}
|
}
|
||||||
@ -306,7 +306,7 @@ list_keyblock_print ( KBNODE keyblock, int secret )
|
|||||||
if( !any ) {
|
if( !any ) {
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( opt.fingerprint )
|
if( opt.fingerprint )
|
||||||
fingerprint( pk, sk ); /* of the main key */
|
print_fingerprint( pk, sk, 0 ); /* of the main key */
|
||||||
any = 1;
|
any = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ list_keyblock_print ( KBNODE keyblock, int secret )
|
|||||||
(ulong)keyid2[1],
|
(ulong)keyid2[1],
|
||||||
datestr_from_sk( sk2 ) );
|
datestr_from_sk( sk2 ) );
|
||||||
if( opt.fingerprint > 1 )
|
if( opt.fingerprint > 1 )
|
||||||
fingerprint( NULL, sk2 );
|
print_fingerprint( NULL, sk2, 0 );
|
||||||
}
|
}
|
||||||
else if( opt.list_sigs && node->pkt->pkttype == PKT_SIGNATURE ) {
|
else if( opt.list_sigs && node->pkt->pkttype == PKT_SIGNATURE ) {
|
||||||
PKT_signature *sig = node->pkt->pkt.signature;
|
PKT_signature *sig = node->pkt->pkt.signature;
|
||||||
@ -333,7 +333,7 @@ list_keyblock_print ( KBNODE keyblock, int secret )
|
|||||||
else
|
else
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( opt.fingerprint )
|
if( opt.fingerprint )
|
||||||
fingerprint( pk, sk );
|
print_fingerprint( pk, sk, 0 );
|
||||||
any=1;
|
any=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,7 +460,7 @@ list_keyblock_colon( KBNODE keyblock, int secret )
|
|||||||
print_capabilities (pk, sk, keyblock);
|
print_capabilities (pk, sk, keyblock);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( opt.fingerprint )
|
if( opt.fingerprint )
|
||||||
fingerprint( pk, sk );
|
print_fingerprint( pk, sk, 0 );
|
||||||
if( opt.with_key_data )
|
if( opt.with_key_data )
|
||||||
print_key_data( pk, keyid );
|
print_key_data( pk, keyid );
|
||||||
any = 1;
|
any = 1;
|
||||||
@ -507,7 +507,7 @@ list_keyblock_colon( KBNODE keyblock, int secret )
|
|||||||
print_capabilities (pk, sk, keyblock);
|
print_capabilities (pk, sk, keyblock);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( opt.fingerprint )
|
if( opt.fingerprint )
|
||||||
fingerprint( pk, sk );
|
print_fingerprint( pk, sk, 0 );
|
||||||
if( opt.with_key_data )
|
if( opt.with_key_data )
|
||||||
print_key_data( pk, keyid );
|
print_key_data( pk, keyid );
|
||||||
any = 1;
|
any = 1;
|
||||||
@ -523,7 +523,7 @@ list_keyblock_colon( KBNODE keyblock, int secret )
|
|||||||
print_capabilities (pk, sk, keyblock);
|
print_capabilities (pk, sk, keyblock);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( opt.fingerprint )
|
if( opt.fingerprint )
|
||||||
fingerprint( pk, sk ); /* of the main key */
|
print_fingerprint( pk, sk, 0 ); /* of the main key */
|
||||||
any = 1;
|
any = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,7 +557,7 @@ list_keyblock_colon( KBNODE keyblock, int secret )
|
|||||||
print_capabilities (pk2, NULL, NULL);
|
print_capabilities (pk2, NULL, NULL);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( opt.fingerprint > 1 )
|
if( opt.fingerprint > 1 )
|
||||||
fingerprint( pk2, NULL );
|
print_fingerprint( pk2, NULL, 0 );
|
||||||
if( opt.with_key_data )
|
if( opt.with_key_data )
|
||||||
print_key_data( pk2, keyid2 );
|
print_key_data( pk2, keyid2 );
|
||||||
}
|
}
|
||||||
@ -571,7 +571,7 @@ list_keyblock_colon( KBNODE keyblock, int secret )
|
|||||||
print_capabilities (pk, sk, keyblock);
|
print_capabilities (pk, sk, keyblock);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( opt.fingerprint )
|
if( opt.fingerprint )
|
||||||
fingerprint( pk, sk ); /* of the main key */
|
print_fingerprint( pk, sk, 0 ); /* of the main key */
|
||||||
any = 1;
|
any = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,7 +586,7 @@ list_keyblock_colon( KBNODE keyblock, int secret )
|
|||||||
print_capabilities (NULL, sk2, NULL);
|
print_capabilities (NULL, sk2, NULL);
|
||||||
putchar ('\n');
|
putchar ('\n');
|
||||||
if( opt.fingerprint > 1 )
|
if( opt.fingerprint > 1 )
|
||||||
fingerprint( NULL, sk2 );
|
print_fingerprint( NULL, sk2, 0 );
|
||||||
}
|
}
|
||||||
else if( opt.list_sigs && node->pkt->pkttype == PKT_SIGNATURE ) {
|
else if( opt.list_sigs && node->pkt->pkttype == PKT_SIGNATURE ) {
|
||||||
PKT_signature *sig = node->pkt->pkt.signature;
|
PKT_signature *sig = node->pkt->pkt.signature;
|
||||||
@ -606,7 +606,7 @@ list_keyblock_colon( KBNODE keyblock, int secret )
|
|||||||
print_capabilities (pk, sk, keyblock);
|
print_capabilities (pk, sk, keyblock);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( opt.fingerprint )
|
if( opt.fingerprint )
|
||||||
fingerprint( pk, sk );
|
print_fingerprint( pk, sk, 0 );
|
||||||
any=1;
|
any=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -718,38 +718,86 @@ list_keyblock( KBNODE keyblock, int secret )
|
|||||||
list_keyblock_print (keyblock, secret );
|
list_keyblock_print (keyblock, secret );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
/*
|
||||||
fingerprint( PKT_public_key *pk, PKT_secret_key *sk )
|
* standard function to print the finperprint.
|
||||||
|
* mode 0: as used in key listings, opt.with_colons is honored
|
||||||
|
* 1: print using log_info ()
|
||||||
|
* 2: direct use of tty
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
print_fingerprint (PKT_public_key *pk, PKT_secret_key *sk, int mode )
|
||||||
{
|
{
|
||||||
byte *array, *p;
|
byte array[MAX_FINGERPRINT_LEN], *p;
|
||||||
size_t i, n;
|
size_t i, n;
|
||||||
|
FILE *fp;
|
||||||
|
const char *text;
|
||||||
|
|
||||||
p = array = pk? fingerprint_from_pk( pk, NULL, &n )
|
if (mode == 1) {
|
||||||
: fingerprint_from_sk( sk, NULL, &n );
|
fp = log_stream ();
|
||||||
if( opt.with_colons ) {
|
text = _("Fingerprint:");
|
||||||
printf("fpr:::::::::");
|
}
|
||||||
for(i=0; i < n ; i++, p++ )
|
else if (mode == 2) {
|
||||||
printf("%02X", *p );
|
fp = NULL; /* use tty */
|
||||||
putchar(':');
|
/* Translators: this should fit into 24 bytes to that the fingerprint
|
||||||
|
* data is properly aligned with the user ID */
|
||||||
|
text = _(" Fingerprint:");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf(" Key fingerprint =");
|
fp = stdout;
|
||||||
if( n == 20 ) {
|
text = _(" Key fingerprint =");
|
||||||
for(i=0; i < n ; i++, i++, p += 2 ) {
|
}
|
||||||
if( i == 10 )
|
|
||||||
putchar(' ');
|
if (sk)
|
||||||
printf(" %02X%02X", *p, p[1] );
|
fingerprint_from_sk (sk, array, &n);
|
||||||
|
else
|
||||||
|
fingerprint_from_pk (pk, array, &n);
|
||||||
|
p = array;
|
||||||
|
if (opt.with_colons && !mode) {
|
||||||
|
fprintf (fp, "fpr:::::::::");
|
||||||
|
for (i=0; i < n ; i++, p++ )
|
||||||
|
fprintf (fp, "%02X", *p );
|
||||||
|
putc(':', fp);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (fp)
|
||||||
|
fputs (text, fp);
|
||||||
|
else
|
||||||
|
tty_printf ("%s", text);
|
||||||
|
if (n == 20) {
|
||||||
|
for (i=0; i < n ; i++, i++, p += 2 ) {
|
||||||
|
if (fp) {
|
||||||
|
if (i == 10 )
|
||||||
|
putc(' ', fp);
|
||||||
|
fprintf (fp, " %02X%02X", *p, p[1] );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (i == 10 )
|
||||||
|
tty_printf (" ");
|
||||||
|
tty_printf (" %02X%02X", *p, p[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for(i=0; i < n ; i++, p++ ) {
|
for (i=0; i < n ; i++, p++ ) {
|
||||||
if( i && !(i%8) )
|
if (fp) {
|
||||||
putchar(' ');
|
if (i && !(i%8) )
|
||||||
printf(" %02X", *p );
|
putc (' ', fp);
|
||||||
|
fprintf (fp, " %02X", *p );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (i && !(i%8) )
|
||||||
|
tty_printf (" ");
|
||||||
|
tty_printf (" %02X", *p );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
putchar('\n');
|
}
|
||||||
m_free(array);
|
if (fp)
|
||||||
|
putc ('\n', fp);
|
||||||
|
else
|
||||||
|
tty_printf ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,6 +154,7 @@ void release_revocation_reason_info( struct revocation_reason_info *reason );
|
|||||||
/*-- keylist.c --*/
|
/*-- keylist.c --*/
|
||||||
void public_key_list( STRLIST list );
|
void public_key_list( STRLIST list );
|
||||||
void secret_key_list( STRLIST list );
|
void secret_key_list( STRLIST list );
|
||||||
|
void print_fingerprint (PKT_public_key *pk, PKT_secret_key *sk, int mode);
|
||||||
|
|
||||||
/*-- verify.c --*/
|
/*-- verify.c --*/
|
||||||
int verify_signatures( int nfiles, char **files );
|
int verify_signatures( int nfiles, char **files );
|
||||||
|
@ -683,43 +683,6 @@ print_userid( PACKET *pkt )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_fingerprint( PKT_public_key *pk, PKT_secret_key *sk )
|
|
||||||
{
|
|
||||||
byte array[MAX_FINGERPRINT_LEN], *p;
|
|
||||||
size_t i, n;
|
|
||||||
|
|
||||||
if( sk )
|
|
||||||
fingerprint_from_sk( sk, array, &n );
|
|
||||||
else
|
|
||||||
fingerprint_from_pk( pk, array, &n );
|
|
||||||
p = array;
|
|
||||||
if( opt.with_colons ) {
|
|
||||||
printf("fpr:::::::::");
|
|
||||||
for(i=0; i < n ; i++, p++ )
|
|
||||||
printf("%02X", *p );
|
|
||||||
putchar(':');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf(" Key fingerprint =");
|
|
||||||
if( n == 20 ) {
|
|
||||||
for(i=0; i < n ; i++, i++, p += 2 ) {
|
|
||||||
if( i == 10 )
|
|
||||||
putchar(' ');
|
|
||||||
printf(" %02X%02X", *p, p[1] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for(i=0; i < n ; i++, p++ ) {
|
|
||||||
if( i && !(i%8) )
|
|
||||||
putchar(' ');
|
|
||||||
printf(" %02X", *p );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
putchar('\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_notation_data( PKT_signature *sig )
|
print_notation_data( PKT_signature *sig )
|
||||||
{
|
{
|
||||||
@ -805,7 +768,7 @@ list_node( CTX c, KBNODE node )
|
|||||||
if( node->next && node->next->pkt->pkttype == PKT_RING_TRUST) {
|
if( node->next && node->next->pkt->pkttype == PKT_RING_TRUST) {
|
||||||
putchar('\n'); any=1;
|
putchar('\n'); any=1;
|
||||||
if( opt.fingerprint )
|
if( opt.fingerprint )
|
||||||
print_fingerprint( pk, NULL );
|
print_fingerprint( pk, NULL, 0 );
|
||||||
printf("rtv:1:%u:\n",
|
printf("rtv:1:%u:\n",
|
||||||
node->next->pkt->pkt.ring_trust->trustval );
|
node->next->pkt->pkt.ring_trust->trustval );
|
||||||
}
|
}
|
||||||
@ -843,7 +806,7 @@ list_node( CTX c, KBNODE node )
|
|||||||
putchar(':');
|
putchar(':');
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( opt.fingerprint && !any )
|
if( opt.fingerprint && !any )
|
||||||
print_fingerprint( pk, NULL );
|
print_fingerprint( pk, NULL, 0 );
|
||||||
if( node->next
|
if( node->next
|
||||||
&& node->next->pkt->pkttype == PKT_RING_TRUST ) {
|
&& node->next->pkt->pkttype == PKT_RING_TRUST ) {
|
||||||
printf("rtv:2:%u:\n",
|
printf("rtv:2:%u:\n",
|
||||||
@ -867,7 +830,7 @@ list_node( CTX c, KBNODE node )
|
|||||||
if( !any )
|
if( !any )
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( !mainkey && opt.fingerprint > 1 )
|
if( !mainkey && opt.fingerprint > 1 )
|
||||||
print_fingerprint( pk, NULL );
|
print_fingerprint( pk, NULL, 0 );
|
||||||
}
|
}
|
||||||
else if( (mainkey = (node->pkt->pkttype == PKT_SECRET_KEY) )
|
else if( (mainkey = (node->pkt->pkttype == PKT_SECRET_KEY) )
|
||||||
|| node->pkt->pkttype == PKT_SECRET_SUBKEY ) {
|
|| node->pkt->pkttype == PKT_SECRET_SUBKEY ) {
|
||||||
@ -917,7 +880,7 @@ list_node( CTX c, KBNODE node )
|
|||||||
putchar(':');
|
putchar(':');
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( opt.fingerprint && !any )
|
if( opt.fingerprint && !any )
|
||||||
print_fingerprint( NULL, sk );
|
print_fingerprint( NULL, sk, 0 );
|
||||||
any=1;
|
any=1;
|
||||||
}
|
}
|
||||||
else if( node->pkt->pkttype == PKT_SECRET_SUBKEY ) {
|
else if( node->pkt->pkttype == PKT_SECRET_SUBKEY ) {
|
||||||
@ -932,7 +895,7 @@ list_node( CTX c, KBNODE node )
|
|||||||
if( !any )
|
if( !any )
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( !mainkey && opt.fingerprint > 1 )
|
if( !mainkey && opt.fingerprint > 1 )
|
||||||
print_fingerprint( NULL, sk );
|
print_fingerprint( NULL, sk, 0 );
|
||||||
}
|
}
|
||||||
else if( node->pkt->pkttype == PKT_SIGNATURE ) {
|
else if( node->pkt->pkttype == PKT_SIGNATURE ) {
|
||||||
PKT_signature *sig = node->pkt->pkt.signature;
|
PKT_signature *sig = node->pkt->pkt.signature;
|
||||||
|
@ -29,6 +29,9 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@ -303,7 +306,7 @@ agent_open (void)
|
|||||||
|
|
||||||
if ( writen ( fd, "GPGA\0\0\0\x01", 8 ) ) {
|
if ( writen ( fd, "GPGA\0\0\0\x01", 8 ) ) {
|
||||||
fd = -1;
|
fd = -1;
|
||||||
|
}
|
||||||
#else /* Posix */
|
#else /* Posix */
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "keydb.h"
|
#include "keydb.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "main.h"
|
||||||
#include "trustdb.h"
|
#include "trustdb.h"
|
||||||
#include "ttyio.h"
|
#include "ttyio.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
@ -39,62 +40,6 @@
|
|||||||
|
|
||||||
#define CONTROL_D ('D' - 'A' + 1)
|
#define CONTROL_D ('D' - 'A' + 1)
|
||||||
|
|
||||||
/* fixme: we have nearly the same code in keyedit.c */
|
|
||||||
static void
|
|
||||||
print_fpr( PKT_public_key *pk )
|
|
||||||
{
|
|
||||||
byte array[MAX_FINGERPRINT_LEN], *p;
|
|
||||||
size_t i, n;
|
|
||||||
|
|
||||||
fingerprint_from_pk( pk, array, &n );
|
|
||||||
p = array;
|
|
||||||
/* Translators: this shoud fit into 24 bytes to that the fingerprint
|
|
||||||
* data is properly aligned with the user ID */
|
|
||||||
tty_printf(_(" Fingerprint:"));
|
|
||||||
if( n == 20 ) {
|
|
||||||
for(i=0; i < n ; i++, i++, p += 2 ) {
|
|
||||||
if( i == 10 )
|
|
||||||
tty_printf(" ");
|
|
||||||
tty_printf(" %02X%02X", *p, p[1] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for(i=0; i < n ; i++, p++ ) {
|
|
||||||
if( i && !(i%8) )
|
|
||||||
tty_printf(" ");
|
|
||||||
tty_printf(" %02X", *p );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tty_printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
fpr_info( PKT_public_key *pk )
|
|
||||||
{
|
|
||||||
byte array[MAX_FINGERPRINT_LEN], *p;
|
|
||||||
size_t i, n;
|
|
||||||
FILE *fp = log_stream();
|
|
||||||
|
|
||||||
fingerprint_from_pk( pk, array, &n );
|
|
||||||
p = array;
|
|
||||||
log_info(_("Fingerprint:"));
|
|
||||||
if( n == 20 ) {
|
|
||||||
for(i=0; i < n ; i++, i++, p += 2 ) {
|
|
||||||
if( i == 10 )
|
|
||||||
putc(' ', fp);
|
|
||||||
fprintf(fp, " %02X%02X", *p, p[1] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for(i=0; i < n ; i++, p++ ) {
|
|
||||||
if( i && !(i%8) )
|
|
||||||
putc(' ', fp);
|
|
||||||
fprintf(fp, " %02X", *p );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
putc('\n', fp );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************
|
/****************
|
||||||
* Show the revocation reason as it is stored with the given signature
|
* Show the revocation reason as it is stored with the given signature
|
||||||
@ -312,7 +257,7 @@ do_edit_ownertrust( ulong lid, int mode, unsigned *new_trust, int defer_help )
|
|||||||
tty_print_utf8_string( p, n ),
|
tty_print_utf8_string( p, n ),
|
||||||
m_free(p);
|
m_free(p);
|
||||||
tty_printf("\"\n");
|
tty_printf("\"\n");
|
||||||
print_fpr( pk );
|
print_fingerprint (pk, NULL, 2);
|
||||||
tty_printf("\n");
|
tty_printf("\n");
|
||||||
}
|
}
|
||||||
tty_printf(_(
|
tty_printf(_(
|
||||||
@ -586,7 +531,7 @@ do_we_trust_pre( PKT_public_key *pk, int trustlevel )
|
|||||||
tty_print_utf8_string( p, n ),
|
tty_print_utf8_string( p, n ),
|
||||||
m_free(p);
|
m_free(p);
|
||||||
tty_printf("\"\n");
|
tty_printf("\"\n");
|
||||||
print_fpr( pk );
|
print_fingerprint (pk, NULL, 2);
|
||||||
tty_printf("\n");
|
tty_printf("\n");
|
||||||
|
|
||||||
tty_printf(_(
|
tty_printf(_(
|
||||||
@ -629,7 +574,7 @@ check_signatures_trust( PKT_signature *sig )
|
|||||||
if( !opt.quiet )
|
if( !opt.quiet )
|
||||||
log_info(_("WARNING: Using untrusted key!\n"));
|
log_info(_("WARNING: Using untrusted key!\n"));
|
||||||
if (opt.with_fingerprint)
|
if (opt.with_fingerprint)
|
||||||
fpr_info (pk);
|
print_fingerprint (pk, NULL, 1);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
@ -680,7 +625,7 @@ check_signatures_trust( PKT_signature *sig )
|
|||||||
|
|
||||||
case TRUST_EXPIRED:
|
case TRUST_EXPIRED:
|
||||||
log_info(_("Note: This key has expired!\n"));
|
log_info(_("Note: This key has expired!\n"));
|
||||||
fpr_info( pk );
|
print_fingerprint (pk, NULL, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRUST_UNDEFINED:
|
case TRUST_UNDEFINED:
|
||||||
@ -691,7 +636,7 @@ check_signatures_trust( PKT_signature *sig )
|
|||||||
log_info(_(
|
log_info(_(
|
||||||
" There is no indication that the "
|
" There is no indication that the "
|
||||||
"signature belongs to the owner.\n" ));
|
"signature belongs to the owner.\n" ));
|
||||||
fpr_info( pk );
|
print_fingerprint (pk, NULL, 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int quit;
|
int quit;
|
||||||
@ -709,7 +654,7 @@ check_signatures_trust( PKT_signature *sig )
|
|||||||
log_info(_("WARNING: We do NOT trust this key!\n"));
|
log_info(_("WARNING: We do NOT trust this key!\n"));
|
||||||
log_info(_(" The signature is probably a FORGERY.\n"));
|
log_info(_(" The signature is probably a FORGERY.\n"));
|
||||||
if (opt.with_fingerprint)
|
if (opt.with_fingerprint)
|
||||||
fpr_info (pk);
|
print_fingerprint (pk, NULL, 1);
|
||||||
rc = G10ERR_BAD_SIGN;
|
rc = G10ERR_BAD_SIGN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -721,19 +666,19 @@ check_signatures_trust( PKT_signature *sig )
|
|||||||
log_info(_(
|
log_info(_(
|
||||||
" It is not certain that the signature belongs to the owner.\n"
|
" It is not certain that the signature belongs to the owner.\n"
|
||||||
));
|
));
|
||||||
fpr_info( pk );
|
print_fingerprint (pk, NULL, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRUST_FULLY:
|
case TRUST_FULLY:
|
||||||
write_status( STATUS_TRUST_FULLY );
|
write_status( STATUS_TRUST_FULLY );
|
||||||
if (opt.with_fingerprint)
|
if (opt.with_fingerprint)
|
||||||
fpr_info (pk);
|
print_fingerprint (pk, NULL, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRUST_ULTIMATE:
|
case TRUST_ULTIMATE:
|
||||||
write_status( STATUS_TRUST_ULTIMATE );
|
write_status( STATUS_TRUST_ULTIMATE );
|
||||||
if (opt.with_fingerprint)
|
if (opt.with_fingerprint)
|
||||||
fpr_info (pk);
|
print_fingerprint (pk, NULL, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: BUG();
|
default: BUG();
|
||||||
|
@ -224,6 +224,9 @@ int strcasecmp( const char *, const char *b);
|
|||||||
/*-- w32reg.c --*/
|
/*-- w32reg.c --*/
|
||||||
char *read_w32_registry_string( const char *root,
|
char *read_w32_registry_string( const char *root,
|
||||||
const char *dir, const char *name );
|
const char *dir, const char *name );
|
||||||
|
int write_w32_registry_string(const char *root, const char *dir,
|
||||||
|
const char *name, const char *value);
|
||||||
|
|
||||||
/*-- strgutil.c --*/
|
/*-- strgutil.c --*/
|
||||||
int vasprintf ( char **result, const char *format, va_list args);
|
int vasprintf ( char **result, const char *format, va_list args);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user