summaryrefslogtreecommitdiffstats
path: root/g10/export.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1998-12-10 20:20:47 +0100
committerWerner Koch <wk@gnupg.org>1998-12-10 20:20:47 +0100
commitaf6e96e4f918169508acd8a710309cf617eff3c1 (patch)
treebe313d86fcf1e63ae95686216e149e3aac770749 /g10/export.c
parentSee ChangeLog: Wed Dec 9 13:41:06 CET 1998 Werner Koch (diff)
downloadgnupg2-af6e96e4f918169508acd8a710309cf617eff3c1.tar.xz
gnupg2-af6e96e4f918169508acd8a710309cf617eff3c1.zip
See ChangeLog: Thu Dec 10 20:15:36 CET 1998 Werner Koch
Diffstat (limited to 'g10/export.c')
-rw-r--r--g10/export.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/g10/export.c b/g10/export.c
index ff003cc74..c9056115d 100644
--- a/g10/export.c
+++ b/g10/export.c
@@ -34,27 +34,28 @@
#include "main.h"
#include "i18n.h"
-static int do_export( STRLIST users, int secret );
+static int do_export( STRLIST users, int secret, int onlyrfc );
/****************
* Export the public keys (to standard out or --output).
* Depending on opt.armor the output is armored.
+ * If onlyrfc is True only RFC24404 compatible keys are exported.
* If USERS is NULL, the complete ring will be exported.
*/
int
-export_pubkeys( STRLIST users )
+export_pubkeys( STRLIST users, int onlyrfc )
{
- return do_export( users, 0 );
+ return do_export( users, 0, onlyrfc );
}
int
export_seckeys( STRLIST users )
{
- return do_export( users, 1 );
+ return do_export( users, 1, 0 );
}
static int
-do_export( STRLIST users, int secret )
+do_export( STRLIST users, int secret, int onlyrfc )
{
int rc = 0;
armor_filter_context_t afx;
@@ -110,7 +111,7 @@ do_export( STRLIST users, int secret )
rc = secret? find_secret_keyblock_byname( &kbpos, sl->d )
: find_keyblock_byname( &kbpos, sl->d );
if( rc ) {
- log_error("%s: user not found: %s\n", sl->d, g10_errstr(rc) );
+ log_error(_("%s: user not found: %s\n"), sl->d, g10_errstr(rc));
rc = 0;
continue;
}
@@ -119,10 +120,21 @@ do_export( STRLIST users, int secret )
}
if( rc ) {
- log_error("certificate read problem: %s\n", g10_errstr(rc));
+ log_error(_("certificate read problem: %s\n"), g10_errstr(rc));
goto leave;
}
+
+ /* do not export keys which are incompatible with rfc2440 */
+ if( onlyrfc && (node = find_kbnode( keyblock, PKT_PUBLIC_KEY )) ) {
+ PKT_public_key *pk = node->pkt->pkt.public_key;
+ if( pk->version == 3 && pk->pubkey_algo > 3 ) {
+ log_info(_("key %08lX: not a rfc2440 key - skipped\n"),
+ (ulong)keyid_from_pk( pk, NULL) );
+ continue;
+ }
+ }
+
/* and write it */
for( kbctx=NULL; (node = walk_kbnode( keyblock, &kbctx, 0 )); ) {
/* don't export any comment packets but those in the