~ubuntu-branches/ubuntu/karmic/gnupg2/karmic-security

« back to all changes in this revision

Viewing changes to g10/gpg.c

  • Committer: Bazaar Package Importer
  • Author(s): Eric Dorland
  • Date: 2009-03-08 22:46:47 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090308224647-gq17gatcl71lrc2k
Tags: 2.0.11-1
* New upstream release. (Closes: #496663)
* debian/control: Make the description a little more distinctive than
  gnupg v1's. Thanks Jari Aalto. (Closes: #496323)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* gpg.c - The GnuPG utility (main for gpg)
2
2
 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
3
 
 *               2006, 2007 Free Software Foundation, Inc.
 
3
 *               2006, 2007, 2008 Free Software Foundation, Inc.
4
4
 *
5
5
 * This file is part of GnuPG.
6
6
 *
119
119
    aListSigs,
120
120
    aSendKeys,
121
121
    aRecvKeys,
 
122
    aLocateKeys,
122
123
    aSearchKeys,
123
124
    aRefreshKeys,
124
125
    aFetchKeys,
229
230
    oHomedir,
230
231
    oWithColons,
231
232
    oWithKeyData,
 
233
    oWithSigList,
 
234
    oWithSigCheck,
232
235
    oSkipVerify,
233
236
    oCompressKeys,
234
237
    oCompressSigs,
364
367
 
365
368
static ARGPARSE_OPTS opts[] = {
366
369
 
367
 
    { 300, NULL, 0, N_("@Commands:\n ") },
 
370
  ARGPARSE_group (300, N_("@Commands:\n ")),
368
371
 
369
 
    { aSign, "sign",      256, N_("|[file]|make a signature")},
370
 
    { aClearsign, "clearsign", 256, N_("|[file]|make a clear text signature")},
371
 
    { aDetachedSign, "detach-sign", 256, N_("make a detached signature")},
372
 
    { aEncr, "encrypt",   256, N_("encrypt data")},
373
 
    { aEncrFiles, "encrypt-files", 256, "@"},
374
 
    { aSym, "symmetric", 256, N_("encryption only with symmetric cipher")},
375
 
    { aStore, "store",     256, "@"},
376
 
    { aDecrypt, "decrypt",   256, N_("decrypt data (default)")},
377
 
    { aDecryptFiles, "decrypt-files", 256, "@"},
378
 
    { aVerify, "verify"   , 256, N_("verify a signature")},
379
 
    { aVerifyFiles, "verify-files" , 256, "@" },
380
 
    { aListKeys, "list-keys", 256, N_("list keys")},
381
 
    { aListKeys, "list-public-keys", 256, "@" },
382
 
    { aListSigs, "list-sigs", 256, N_("list keys and signatures")},
383
 
    { aCheckKeys, "check-sigs",256, N_("list and check key signatures")},
384
 
    { oFingerprint, "fingerprint", 256, N_("list keys and fingerprints")},
385
 
    { aListSecretKeys, "list-secret-keys", 256, N_("list secret keys")},
386
 
    { aKeygen,     "gen-key",  256, N_("generate a new key pair")},
387
 
    { aDeleteKeys,"delete-keys",256,N_("remove keys from the public keyring")},
388
 
    { aDeleteSecretKeys, "delete-secret-keys",256,
389
 
                                    N_("remove keys from the secret keyring")},
390
 
    { aSignKey,  "sign-key"   ,256, N_("sign a key")},
391
 
    { aLSignKey, "lsign-key"  ,256, N_("sign a key locally")},
392
 
    { aEditKey,  "edit-key"   ,256, N_("sign or edit a key")},
393
 
    { aGenRevoke, "gen-revoke",256, N_("generate a revocation certificate")},
394
 
    { aDesigRevoke, "desig-revoke",256, "@" },
395
 
    { aExport, "export"           , 256, N_("export keys") },
396
 
    { aSendKeys, "send-keys"     , 256, N_("export keys to a key server") },
397
 
    { aRecvKeys, "recv-keys"     , 256, N_("import keys from a key server") },
398
 
    { aSearchKeys, "search-keys" , 256,
399
 
                                    N_("search for keys on a key server") },
400
 
    { aRefreshKeys, "refresh-keys", 256,
401
 
                                    N_("update all keys from a keyserver")},
402
 
    { aFetchKeys, "fetch-keys" , 256, "@" },
403
 
    { aExportSecret, "export-secret-keys" , 256, "@" },
404
 
    { aExportSecretSub, "export-secret-subkeys" , 256, "@" },
405
 
    { aImport, "import",      256     , N_("import/merge keys")},
406
 
    { aFastImport, "fast-import",  256 , "@"},
 
372
  ARGPARSE_c (aSign, "sign", N_("make a signature")),
 
373
  ARGPARSE_c (aClearsign, "clearsign", N_("make a clear text signature")),
 
374
  ARGPARSE_c (aDetachedSign, "detach-sign", N_("make a detached signature")),
 
375
  ARGPARSE_c (aEncr, "encrypt",   N_("encrypt data")),
 
376
  ARGPARSE_c (aEncrFiles, "encrypt-files", "@"),
 
377
  ARGPARSE_c (aSym, "symmetric", N_("encryption only with symmetric cipher")),
 
378
  ARGPARSE_c (aStore, "store",     "@"),
 
379
  ARGPARSE_c (aDecrypt, "decrypt",   N_("decrypt data (default)")),
 
380
  ARGPARSE_c (aDecryptFiles, "decrypt-files", "@"),
 
381
  ARGPARSE_c (aVerify, "verify"   , N_("verify a signature")),
 
382
  ARGPARSE_c (aVerifyFiles, "verify-files" , "@" ),
 
383
  ARGPARSE_c (aListKeys, "list-keys", N_("list keys")),
 
384
  ARGPARSE_c (aListKeys, "list-public-keys", "@" ),
 
385
  ARGPARSE_c (aListSigs, "list-sigs", N_("list keys and signatures")),
 
386
  ARGPARSE_c (aCheckKeys, "check-sigs",N_("list and check key signatures")),
 
387
  ARGPARSE_c (oFingerprint, "fingerprint", N_("list keys and fingerprints")),
 
388
  ARGPARSE_c (aListSecretKeys, "list-secret-keys", N_("list secret keys")),
 
389
  ARGPARSE_c (aKeygen,     "gen-key",  N_("generate a new key pair")),
 
390
  ARGPARSE_c (aDeleteKeys,"delete-keys", 
 
391
              N_("remove keys from the public keyring")),
 
392
  ARGPARSE_c (aDeleteSecretKeys, "delete-secret-keys",
 
393
              N_("remove keys from the secret keyring")),
 
394
  ARGPARSE_c (aSignKey,  "sign-key"   ,N_("sign a key")),
 
395
  ARGPARSE_c (aLSignKey, "lsign-key"  ,N_("sign a key locally")),
 
396
  ARGPARSE_c (aEditKey,  "edit-key"   ,N_("sign or edit a key")),
 
397
  ARGPARSE_c (aGenRevoke, "gen-revoke",N_("generate a revocation certificate")),
 
398
  ARGPARSE_c (aDesigRevoke, "desig-revoke","@" ),
 
399
  ARGPARSE_c (aExport, "export"           , N_("export keys") ),
 
400
  ARGPARSE_c (aSendKeys, "send-keys"     , N_("export keys to a key server") ),
 
401
  ARGPARSE_c (aRecvKeys, "recv-keys"     , N_("import keys from a key server") ),
 
402
  ARGPARSE_c (aSearchKeys, "search-keys" , 
 
403
              N_("search for keys on a key server") ),
 
404
  ARGPARSE_c (aRefreshKeys, "refresh-keys", 
 
405
              N_("update all keys from a keyserver")),
 
406
  ARGPARSE_c (aLocateKeys, "locate-keys", "@"),
 
407
  ARGPARSE_c (aFetchKeys, "fetch-keys" , "@" ),
 
408
  ARGPARSE_c (aExportSecret, "export-secret-keys" , "@" ),
 
409
  ARGPARSE_c (aExportSecretSub, "export-secret-subkeys" , "@" ),
 
410
  ARGPARSE_c (aImport, "import", N_("import/merge keys")),
 
411
  ARGPARSE_c (aFastImport, "fast-import", "@"),
407
412
#ifdef ENABLE_CARD_SUPPORT
408
 
    { aCardStatus,  "card-status", 256, N_("print the card status")},
409
 
    { aCardEdit,   "card-edit",  256, N_("change data on a card")},
410
 
    { aChangePIN,  "change-pin", 256, N_("change a card's PIN")},
 
413
  ARGPARSE_c (aCardStatus,  "card-status", N_("print the card status")),
 
414
  ARGPARSE_c (aCardEdit,   "card-edit",  N_("change data on a card")),
 
415
  ARGPARSE_c (aChangePIN,  "change-pin", N_("change a card's PIN")),
411
416
#endif
412
 
    { aListConfig, "list-config", 256, "@"},
413
 
    { aGPGConfList, "gpgconf-list", 256, "@" },
414
 
    { aGPGConfTest, "gpgconf-test", 256, "@" },
415
 
    { aListPackets, "list-packets",256, "@"},
416
 
    { aExportOwnerTrust, "export-ownertrust", 256, "@"},
417
 
    { aImportOwnerTrust, "import-ownertrust", 256, "@"},
418
 
    { aUpdateTrustDB,
419
 
              "update-trustdb",0 , N_("update the trust database")},
420
 
    { aCheckTrustDB, "check-trustdb", 0, "@"},
421
 
    { aFixTrustDB, "fix-trustdb", 0, "@"},
422
 
    { aDeArmor, "dearmor", 256, "@"},
423
 
    { aDeArmor, "dearmour", 256, "@"},
424
 
    { aEnArmor, "enarmor", 256, "@"},
425
 
    { aEnArmor, "enarmour", 256, "@"},
426
 
    { aPrintMD,  "print-md" , 256, N_("|algo [files]|print message digests")},
427
 
    { aPrimegen, "gen-prime" , 256, "@" },
428
 
    { aGenRandom, "gen-random", 256, "@" },
429
 
    { aServer,   "server",      256, N_("run in server mode")},
430
 
 
431
 
    { 301, NULL, 0, N_("@\nOptions:\n ") },
432
 
 
433
 
    { oArmor, "armor",     0, N_("create ascii armored output")},
434
 
    { oArmor, "armour",     0, "@" },
435
 
    { oRecipient, "recipient", 2, N_("|NAME|encrypt for NAME")},
436
 
    { oHiddenRecipient, "hidden-recipient", 2, "@" },
437
 
    { oRecipient, "remote-user", 2, "@"},  /* old option name */
438
 
    { oDefRecipient, "default-recipient", 2, "@"},
439
 
    { oDefRecipientSelf, "default-recipient-self", 0, "@"},
440
 
    { oNoDefRecipient, "no-default-recipient", 0, "@" },
441
 
    { oTempDir, "temp-directory", 2, "@" },
442
 
    { oExecPath, "exec-path", 2, "@" },
443
 
    { oEncryptTo, "encrypt-to", 2, "@" },
444
 
    { oHiddenEncryptTo, "hidden-encrypt-to", 2, "@" },
445
 
    { oNoEncryptTo, "no-encrypt-to", 0, "@" },
446
 
    { oLocalUser, "local-user",2, N_("use this user-id to sign or decrypt")},
447
 
    { oCompress, NULL, 1, N_("|N|set compress level N (0 disables)") },
448
 
    { oCompressLevel, "compress-level", 1, "@" },
449
 
    { oBZ2CompressLevel, "bzip2-compress-level", 1, "@" },
450
 
    { oBZ2DecompressLowmem, "bzip2-decompress-lowmem", 0, "@" },
451
 
    { oTextmodeShort, NULL,   0, "@"},
452
 
    { oTextmode, "textmode",  0, N_("use canonical text mode")},
453
 
    { oNoTextmode, "no-textmode",  0, "@"},
454
 
    { oExpert, "expert",   0, "@"},
455
 
    { oNoExpert, "no-expert",   0, "@"},
456
 
    { oDefSigExpire, "default-sig-expire", 2, "@"},
457
 
    { oAskSigExpire, "ask-sig-expire",   0, "@"},
458
 
    { oNoAskSigExpire, "no-ask-sig-expire",   0, "@"},
459
 
    { oDefCertExpire, "default-cert-expire", 2, "@"},
460
 
    { oAskCertExpire, "ask-cert-expire",   0, "@"},
461
 
    { oNoAskCertExpire, "no-ask-cert-expire",   0, "@"},
462
 
    { oDefCertLevel, "default-cert-level", 1, "@"},
463
 
    { oMinCertLevel, "min-cert-level", 1, "@"},
464
 
    { oAskCertLevel, "ask-cert-level",   0, "@"},
465
 
    { oNoAskCertLevel, "no-ask-cert-level",   0, "@"},
466
 
    { oOutput, "output",    2, N_("|FILE|write output to FILE")},
467
 
    { oMaxOutput, "max-output", 16|4, "@" },
468
 
    { oVerbose, "verbose",   0, N_("verbose") },
469
 
    { oQuiet,   "quiet",   0, "@"},
470
 
    { oNoTTY, "no-tty", 0, "@"},
471
 
    { oForceV3Sigs, "force-v3-sigs", 0, "@"},
472
 
    { oNoForceV3Sigs, "no-force-v3-sigs", 0, "@"},
473
 
    { oForceV4Certs, "force-v4-certs", 0, "@"},
474
 
    { oNoForceV4Certs, "no-force-v4-certs", 0, "@"},
475
 
    { oForceMDC, "force-mdc", 0, "@"},
476
 
    { oNoForceMDC, "no-force-mdc", 0, "@" },
477
 
    { oDisableMDC, "disable-mdc", 0, "@"},
478
 
    { oNoDisableMDC, "no-disable-mdc", 0, "@" },
479
 
    { oDryRun, "dry-run",   0, N_("do not make any changes") },
480
 
    { oInteractive, "interactive", 0, N_("prompt before overwriting") },
481
 
    { oUseAgent, "use-agent",0, "@"},
482
 
    { oNoUseAgent, "no-use-agent",0, "@"},
483
 
    { oGpgAgentInfo, "gpg-agent-info",2, "@"},
484
 
    { oBatch, "batch", 0, "@"},
485
 
    { oAnswerYes, "yes", 0, "@"},
486
 
    { oAnswerNo, "no", 0, "@"},
487
 
    { oKeyring, "keyring", 2, "@"},
488
 
    { oPrimaryKeyring, "primary-keyring",2, "@" },
489
 
    { oSecretKeyring, "secret-keyring", 2, "@"},
490
 
    { oShowKeyring, "show-keyring", 0, "@"},
491
 
    { oDefaultKey, "default-key", 2, "@"},
492
 
    { oKeyServer, "keyserver", 2, "@"},
493
 
    { oKeyServerOptions, "keyserver-options",2,"@"},
494
 
    { oImportOptions, "import-options",2,"@"},
495
 
    { oExportOptions, "export-options",2,"@"},
496
 
    { oListOptions, "list-options",2,"@"},
497
 
    { oVerifyOptions, "verify-options",2,"@"},
498
 
    { oDisplayCharset, "display-charset", 2, "@"},
499
 
    { oDisplayCharset, "charset", 2, "@"},
500
 
    { oOptions, "options", 2, "@"},
501
 
    { oDebug, "debug"     ,4|16, "@"},
502
 
    { oDebugLevel, "debug-level" ,2, "@"},
503
 
    { oDebugAll, "debug-all" ,0, "@"},
504
 
    { oStatusFD, "status-fd" ,1, "@"},
505
 
    { oStatusFile, "status-file" ,2, "@"},
506
 
    { oAttributeFD, "attribute-fd" ,1, "@" },
507
 
    { oAttributeFile, "attribute-file" ,2, "@" },
508
 
    { oNoop, "sk-comments", 0,   "@"},
509
 
    { oNoop, "no-sk-comments", 0,   "@"},
510
 
    { oCompletesNeeded, "completes-needed", 1, "@"},
511
 
    { oMarginalsNeeded, "marginals-needed", 1, "@"},
512
 
    { oMaxCertDepth,    "max-cert-depth", 1, "@" },
513
 
    { oTrustedKey, "trusted-key", 2, "@"},
514
 
    { oLoadExtension, "load-extension", 2, "@"},
515
 
    { oGnuPG, "gnupg",   0, "@"},
516
 
    { oGnuPG, "no-pgp2", 0, "@"},
517
 
    { oGnuPG, "no-pgp6", 0, "@"},
518
 
    { oGnuPG, "no-pgp7", 0, "@"},
519
 
    { oGnuPG, "no-pgp8", 0, "@"},
520
 
    { oRFC1991, "rfc1991",   0, "@"},
521
 
    { oRFC2440, "rfc2440", 0, "@" },
522
 
    { oRFC4880, "rfc4880", 0, "@" },
523
 
    { oOpenPGP, "openpgp", 0, N_("use strict OpenPGP behavior")},
524
 
    { oPGP2, "pgp2", 0, N_("generate PGP 2.x compatible messages")},
525
 
    { oPGP6, "pgp6", 0, "@"},
526
 
    { oPGP7, "pgp7", 0, "@"},
527
 
    { oPGP8, "pgp8", 0, "@"},
528
 
    { oRFC2440Text, "rfc2440-text", 0, "@"},
529
 
    { oNoRFC2440Text, "no-rfc2440-text", 0, "@"},
530
 
    { oS2KMode, "s2k-mode", 1, "@"},
531
 
    { oS2KDigest, "s2k-digest-algo", 2, "@"},
532
 
    { oS2KCipher, "s2k-cipher-algo", 2, "@"},
533
 
    { oS2KCount, "s2k-count", 1, "@"},
534
 
    { oSimpleSKChecksum, "simple-sk-checksum", 0, "@"},
535
 
    { oCipherAlgo, "cipher-algo", 2, "@"},
536
 
    { oDigestAlgo, "digest-algo", 2, "@"},
537
 
    { oCertDigestAlgo, "cert-digest-algo", 2 , "@" },
538
 
    { oCompressAlgo,"compress-algo", 2, "@"},
539
 
    { oCompressAlgo, "compression-algo", 2, "@"}, /* Alias */
540
 
    { oThrowKeyids, "throw-keyid", 0, "@"},
541
 
    { oThrowKeyids, "throw-keyids", 0, "@"},
542
 
    { oNoThrowKeyids, "no-throw-keyid", 0, "@" },
543
 
    { oNoThrowKeyids, "no-throw-keyids", 0, "@" },
544
 
    { oShowPhotos,   "show-photos", 0, "@" },
545
 
    { oNoShowPhotos, "no-show-photos", 0, "@" },
546
 
    { oPhotoViewer,  "photo-viewer", 2, "@" },
547
 
    { oSetNotation,  "set-notation", 2, "@" },
548
 
    { oSetNotation,  "notation-data", 2, "@" }, /* Alias */
549
 
    { oSigNotation,  "sig-notation", 2, "@" },
550
 
    { oCertNotation, "cert-notation", 2, "@" },
551
 
 
552
 
    { 302, NULL, 0, N_(
 
417
  ARGPARSE_c (aListConfig, "list-config", "@"),
 
418
  ARGPARSE_c (aGPGConfList, "gpgconf-list", "@" ),
 
419
  ARGPARSE_c (aGPGConfTest, "gpgconf-test", "@" ),
 
420
  ARGPARSE_c (aListPackets, "list-packets","@"),
 
421
  ARGPARSE_c (aExportOwnerTrust, "export-ownertrust", "@"),
 
422
  ARGPARSE_c (aImportOwnerTrust, "import-ownertrust", "@"),
 
423
  ARGPARSE_c (aUpdateTrustDB,"update-trustdb",
 
424
              N_("update the trust database")),
 
425
  ARGPARSE_c (aCheckTrustDB, "check-trustdb", "@"),
 
426
  ARGPARSE_c (aFixTrustDB, "fix-trustdb", "@"),
 
427
  ARGPARSE_c (aDeArmor, "dearmor", "@"),
 
428
  ARGPARSE_c (aDeArmor, "dearmour", "@"),
 
429
  ARGPARSE_c (aEnArmor, "enarmor", "@"),
 
430
  ARGPARSE_c (aEnArmor, "enarmour", "@"),
 
431
  ARGPARSE_c (aPrintMD, "print-md", N_("print message digests")),
 
432
  ARGPARSE_c (aPrimegen, "gen-prime", "@" ),
 
433
  ARGPARSE_c (aGenRandom,"gen-random", "@" ),
 
434
  ARGPARSE_c (aServer,   "server",  N_("run in server mode")),
 
435
 
 
436
  ARGPARSE_group (301, N_("@\nOptions:\n ")),
 
437
 
 
438
  ARGPARSE_s_n (oArmor, "armor", N_("create ascii armored output")),
 
439
  ARGPARSE_s_n (oArmor, "armour", "@"),
 
440
 
 
441
  ARGPARSE_s_s (oRecipient, "recipient", N_("|USER-ID|encrypt for USER-ID")),
 
442
  ARGPARSE_s_s (oHiddenRecipient, "hidden-recipient", "@"),
 
443
  ARGPARSE_s_s (oRecipient, "remote-user", "@"),  /* (old option name) */
 
444
  ARGPARSE_s_s (oDefRecipient, "default-recipient", "@"),
 
445
  ARGPARSE_s_n (oDefRecipientSelf,  "default-recipient-self", "@"),
 
446
  ARGPARSE_s_n (oNoDefRecipient, "no-default-recipient", "@"),
 
447
 
 
448
  ARGPARSE_s_s (oTempDir,  "temp-directory", "@"),
 
449
  ARGPARSE_s_s (oExecPath, "exec-path", "@"),
 
450
  ARGPARSE_s_s (oEncryptTo,      "encrypt-to", "@"),
 
451
  ARGPARSE_s_n (oNoEncryptTo, "no-encrypt-to", "@"),
 
452
  ARGPARSE_s_s (oHiddenEncryptTo, "hidden-encrypt-to", "@"),
 
453
  ARGPARSE_s_s (oLocalUser, "local-user",
 
454
                N_("|USER-ID|use USER-ID to sign or decrypt")),
 
455
 
 
456
  ARGPARSE_s_i (oCompress, NULL,
 
457
                N_("|N|set compress level to N (0 disables)")),
 
458
  ARGPARSE_s_i (oCompressLevel, "compress-level", "@"),
 
459
  ARGPARSE_s_i (oBZ2CompressLevel, "bzip2-compress-level", "@"),
 
460
  ARGPARSE_s_n (oBZ2DecompressLowmem, "bzip2-decompress-lowmem", "@"),
 
461
 
 
462
  ARGPARSE_s_n (oTextmodeShort, NULL, "@"),
 
463
  ARGPARSE_s_n (oTextmode,      "textmode", N_("use canonical text mode")),
 
464
  ARGPARSE_s_n (oNoTextmode, "no-textmode", "@"),
 
465
 
 
466
  ARGPARSE_s_n (oExpert,      "expert", "@"),
 
467
  ARGPARSE_s_n (oNoExpert, "no-expert", "@"),
 
468
 
 
469
  ARGPARSE_s_s (oDefSigExpire, "default-sig-expire", "@"),
 
470
  ARGPARSE_s_n (oAskSigExpire,      "ask-sig-expire", "@"),
 
471
  ARGPARSE_s_n (oNoAskSigExpire, "no-ask-sig-expire", "@"),
 
472
  ARGPARSE_s_s (oDefCertExpire, "default-cert-expire", "@"),
 
473
  ARGPARSE_s_n (oAskCertExpire,      "ask-cert-expire", "@"),
 
474
  ARGPARSE_s_n (oNoAskCertExpire, "no-ask-cert-expire", "@"),
 
475
  ARGPARSE_s_i (oDefCertLevel, "default-cert-level", "@"),
 
476
  ARGPARSE_s_i (oMinCertLevel, "min-cert-level", "@"),
 
477
  ARGPARSE_s_n (oAskCertLevel,      "ask-cert-level", "@"),
 
478
  ARGPARSE_s_n (oNoAskCertLevel, "no-ask-cert-level", "@"),
 
479
 
 
480
  ARGPARSE_s_s (oOutput, "output", N_("|FILE|write output to FILE")),
 
481
  ARGPARSE_p_u (oMaxOutput, "max-output", "@"),
 
482
 
 
483
  ARGPARSE_s_n (oVerbose, "verbose", N_("verbose")),
 
484
  ARGPARSE_s_n (oQuiet,   "quiet",   "@"),
 
485
  ARGPARSE_s_n (oNoTTY,   "no-tty",  "@"),
 
486
 
 
487
  ARGPARSE_s_n (oForceV3Sigs,      "force-v3-sigs", "@"),
 
488
  ARGPARSE_s_n (oNoForceV3Sigs, "no-force-v3-sigs", "@"),
 
489
  ARGPARSE_s_n (oForceV4Certs,     "force-v4-certs", "@"),
 
490
  ARGPARSE_s_n (oNoForceV4Certs, "no-force-v4-certs", "@"),
 
491
  ARGPARSE_s_n (oForceMDC, "force-mdc", "@"),
 
492
  ARGPARSE_s_n (oNoForceMDC, "no-force-mdc", "@"),
 
493
  ARGPARSE_s_n (oDisableMDC, "disable-mdc", "@"),
 
494
  ARGPARSE_s_n (oNoDisableMDC, "no-disable-mdc", "@"),
 
495
 
 
496
  ARGPARSE_s_n (oDryRun, "dry-run", N_("do not make any changes")),
 
497
  ARGPARSE_s_n (oInteractive, "interactive", N_("prompt before overwriting")),
 
498
 
 
499
  ARGPARSE_s_n (oUseAgent,      "use-agent", "@"),
 
500
  ARGPARSE_s_n (oNoUseAgent, "no-use-agent", "@"),
 
501
  ARGPARSE_s_s (oGpgAgentInfo, "gpg-agent-info", "@"),
 
502
 
 
503
  ARGPARSE_s_n (oBatch, "batch", "@"),
 
504
  ARGPARSE_s_n (oAnswerYes, "yes", "@"),
 
505
  ARGPARSE_s_n (oAnswerNo, "no", "@"),
 
506
  ARGPARSE_s_s (oKeyring, "keyring", "@"),
 
507
  ARGPARSE_s_s (oPrimaryKeyring, "primary-keyring", "@"),
 
508
  ARGPARSE_s_s (oSecretKeyring, "secret-keyring", "@"),
 
509
  ARGPARSE_s_n (oShowKeyring, "show-keyring", "@"),
 
510
  ARGPARSE_s_s (oDefaultKey, "default-key", "@"),
 
511
 
 
512
  ARGPARSE_s_s (oKeyServer, "keyserver", "@"),
 
513
  ARGPARSE_s_s (oKeyServerOptions, "keyserver-options", "@"),
 
514
  ARGPARSE_s_s (oImportOptions, "import-options", "@"),
 
515
  ARGPARSE_s_s (oExportOptions, "export-options", "@"),
 
516
  ARGPARSE_s_s (oListOptions,   "list-options", "@"),
 
517
  ARGPARSE_s_s (oVerifyOptions, "verify-options", "@"),
 
518
 
 
519
  ARGPARSE_s_s (oDisplayCharset, "display-charset", "@"),
 
520
  ARGPARSE_s_s (oDisplayCharset, "charset", "@"),
 
521
  ARGPARSE_s_s (oOptions, "options", "@"),
 
522
 
 
523
  ARGPARSE_p_u (oDebug, "debug", "@"),
 
524
  ARGPARSE_s_s (oDebugLevel, "debug-level", "@"),
 
525
  ARGPARSE_s_n (oDebugAll, "debug-all", "@"),
 
526
  ARGPARSE_s_i (oStatusFD, "status-fd", "@"),
 
527
  ARGPARSE_s_s (oStatusFile, "status-file", "@"),
 
528
  ARGPARSE_s_i (oAttributeFD, "attribute-fd", "@"),
 
529
  ARGPARSE_s_s (oAttributeFile, "attribute-file", "@"),
 
530
 
 
531
  ARGPARSE_s_n (oNoop, "sk-comments", "@"),
 
532
  ARGPARSE_s_n (oNoop, "no-sk-comments", "@"),
 
533
 
 
534
  ARGPARSE_s_i (oCompletesNeeded, "completes-needed", "@"),
 
535
  ARGPARSE_s_i (oMarginalsNeeded, "marginals-needed", "@"),
 
536
  ARGPARSE_s_i (oMaxCertDepth,  "max-cert-depth", "@" ),
 
537
  ARGPARSE_s_s (oTrustedKey, "trusted-key", "@"),
 
538
 
 
539
  ARGPARSE_s_s (oLoadExtension, "load-extension", "@"),  /* Dummy.  */
 
540
 
 
541
  ARGPARSE_s_n (oGnuPG, "gnupg",   "@"),
 
542
  ARGPARSE_s_n (oGnuPG, "no-pgp2", "@"),
 
543
  ARGPARSE_s_n (oGnuPG, "no-pgp6", "@"),
 
544
  ARGPARSE_s_n (oGnuPG, "no-pgp7", "@"),
 
545
  ARGPARSE_s_n (oGnuPG, "no-pgp8", "@"),
 
546
  ARGPARSE_s_n (oRFC1991, "rfc1991", "@"),
 
547
  ARGPARSE_s_n (oRFC2440, "rfc2440", "@"),
 
548
  ARGPARSE_s_n (oRFC4880, "rfc4880", "@"),
 
549
  ARGPARSE_s_n (oOpenPGP, "openpgp", N_("use strict OpenPGP behavior")),
 
550
  ARGPARSE_s_n (oPGP2, "pgp2", "@"),
 
551
  ARGPARSE_s_n (oPGP6, "pgp6", "@"),
 
552
  ARGPARSE_s_n (oPGP7, "pgp7", "@"),
 
553
  ARGPARSE_s_n (oPGP8, "pgp8", "@"),
 
554
 
 
555
  ARGPARSE_s_n (oRFC2440Text,      "rfc2440-text", "@"),
 
556
  ARGPARSE_s_n (oNoRFC2440Text, "no-rfc2440-text", "@"),
 
557
  ARGPARSE_s_i (oS2KMode, "s2k-mode", "@"),
 
558
  ARGPARSE_s_s (oS2KDigest, "s2k-digest-algo", "@"),
 
559
  ARGPARSE_s_s (oS2KCipher, "s2k-cipher-algo", "@"),
 
560
  ARGPARSE_s_i (oS2KCount, "s2k-count", "@"),
 
561
  ARGPARSE_s_n (oSimpleSKChecksum, "simple-sk-checksum", "@"),
 
562
  ARGPARSE_s_s (oCipherAlgo, "cipher-algo", "@"),
 
563
  ARGPARSE_s_s (oDigestAlgo, "digest-algo", "@"),
 
564
  ARGPARSE_s_s (oCertDigestAlgo, "cert-digest-algo", "@"),
 
565
  ARGPARSE_s_s (oCompressAlgo,"compress-algo", "@"),
 
566
  ARGPARSE_s_s (oCompressAlgo, "compression-algo", "@"), /* Alias */
 
567
  ARGPARSE_s_n (oThrowKeyids, "throw-keyid", "@"),
 
568
  ARGPARSE_s_n (oThrowKeyids, "throw-keyids", "@"),
 
569
  ARGPARSE_s_n (oNoThrowKeyids, "no-throw-keyid", "@"),
 
570
  ARGPARSE_s_n (oNoThrowKeyids, "no-throw-keyids", "@"),
 
571
  ARGPARSE_s_n (oShowPhotos,   "show-photos", "@"),
 
572
  ARGPARSE_s_n (oNoShowPhotos, "no-show-photos", "@"),
 
573
  ARGPARSE_s_s (oPhotoViewer,  "photo-viewer", "@"),
 
574
  ARGPARSE_s_s (oSetNotation,  "set-notation", "@"),
 
575
  ARGPARSE_s_s (oSetNotation,  "notation-data", "@"), /* Alias */
 
576
  ARGPARSE_s_s (oSigNotation,  "sig-notation", "@"),
 
577
  ARGPARSE_s_s (oCertNotation, "cert-notation", "@"),
 
578
 
 
579
  ARGPARSE_group (302, N_(
553
580
  "@\n(See the man page for a complete listing of all commands and options)\n"
554
 
                      )},
 
581
                      )),
555
582
 
556
 
    { 303, NULL, 0, N_("@\nExamples:\n\n"
 
583
  ARGPARSE_group (303, N_("@\nExamples:\n\n"
557
584
    " -se -r Bob [file]          sign and encrypt for user Bob\n"
558
585
    " --clearsign [file]         make a clear text signature\n"
559
586
    " --detach-sign [file]       make a detached signature\n"
560
587
    " --list-keys [names]        show keys\n"
561
 
    " --fingerprint [names]      show fingerprints\n"  ) },
562
 
 
563
 
  /* hidden options */
564
 
    { aPrintMDs, "print-mds" , 256, "@"}, /* old */
565
 
    { aListTrustDB, "list-trustdb",0 , "@"},
566
 
    /* Not yet used */
567
 
    /* { aListTrustPath, "list-trust-path",0, "@"}, */
568
 
    { oPasswd, "passphrase",2, "@" },
569
 
    { oPasswdFD, "passphrase-fd",1, "@" },
570
 
    { oPasswdFile, "passphrase-file",2, "@" },
571
 
    { oPasswdRepeat, "passphrase-repeat", 1, "@"},
572
 
    { oCommandFD, "command-fd",1, "@" },
573
 
    { oCommandFile, "command-file",2, "@" },
574
 
    { oQuickRandom, "debug-quick-random", 0, "@"},
575
 
    { oNoVerbose, "no-verbose", 0, "@"},
576
 
    { oTrustDBName, "trustdb-name", 2, "@" },
577
 
    { oNoSecmemWarn, "no-secmem-warning", 0, "@" },
578
 
    { oRequireSecmem,"require-secmem", 0, "@" },
579
 
    { oNoRequireSecmem,"no-require-secmem", 0, "@" },
580
 
    { oNoPermissionWarn, "no-permission-warning", 0, "@" },
581
 
    { oNoMDCWarn, "no-mdc-warning", 0, "@" },
582
 
    { oNoArmor, "no-armor",   0, "@"},
583
 
    { oNoArmor, "no-armour",   0, "@"},
584
 
    { oNoDefKeyring, "no-default-keyring", 0, "@" },
585
 
    { oNoGreeting, "no-greeting", 0, "@" },
586
 
    { oNoOptions, "no-options", 0, "@" }, /* shortcut for --options /dev/null */
587
 
    { oHomedir, "homedir", 2, "@" },   /* defaults to "~/.gnupg" */
588
 
    { oNoBatch, "no-batch", 0, "@" },
589
 
    { oWithColons, "with-colons", 0, "@"},
590
 
    { oWithKeyData,"with-key-data", 0, "@"},
591
 
    { aListKeys, "list-key", 0, "@" }, /* alias */
592
 
    { aListSigs, "list-sig", 0, "@" }, /* alias */
593
 
    { aCheckKeys, "check-sig",0, "@" }, /* alias */
594
 
    { oSkipVerify, "skip-verify",0, "@" },
595
 
    { oCompressKeys, "compress-keys",0, "@"},
596
 
    { oCompressSigs, "compress-sigs",0, "@"},
597
 
    { oDefCertLevel, "default-cert-check-level", 1, "@"}, /* Old option */
598
 
    { oAlwaysTrust, "always-trust", 0, "@"},
599
 
    { oTrustModel, "trust-model", 2, "@"},
600
 
    { oForceOwnertrust, "force-ownertrust", 2, "@"},
601
 
    { oSetFilename, "set-filename", 2, "@" },
602
 
    { oForYourEyesOnly, "for-your-eyes-only", 0, "@" },
603
 
    { oNoForYourEyesOnly, "no-for-your-eyes-only", 0, "@" },
604
 
    { oSetPolicyURL, "set-policy-url", 2, "@" },
605
 
    { oSigPolicyURL, "sig-policy-url", 2, "@" },
606
 
    { oCertPolicyURL, "cert-policy-url", 2, "@" },
607
 
    { oShowPolicyURL, "show-policy-url", 0, "@" },
608
 
    { oNoShowPolicyURL, "no-show-policy-url", 0, "@" },
609
 
    { oSigKeyserverURL, "sig-keyserver-url", 2, "@" },
610
 
    { oShowNotation, "show-notation", 0, "@" },
611
 
    { oNoShowNotation, "no-show-notation", 0, "@" },
612
 
    { oComment, "comment", 2, "@" },
613
 
    { oDefaultComment, "default-comment", 0, "@" },
614
 
    { oNoComments, "no-comments", 0, "@" },
615
 
    { oEmitVersion, "emit-version", 0, "@"},
616
 
    { oNoEmitVersion, "no-emit-version", 0, "@"},
617
 
    { oNoEmitVersion, "no-version", 0, "@"}, /* alias */
618
 
    { oNotDashEscaped, "not-dash-escaped", 0, "@" },
619
 
    { oEscapeFrom, "escape-from-lines", 0, "@" },
620
 
    { oNoEscapeFrom, "no-escape-from-lines", 0, "@" },
621
 
    { oLockOnce, "lock-once", 0, "@" },
622
 
    { oLockMultiple, "lock-multiple", 0, "@" },
623
 
    { oLockNever, "lock-never", 0, "@" },
624
 
    { oLoggerFD, "logger-fd",1, "@" },
625
 
    { oLoggerFile, "log-file",2, "@" },
626
 
    { oLoggerFile, "logger-file",2, "@" },  /* For 1.4 compatibility.  */
627
 
    { oUseEmbeddedFilename, "use-embedded-filename", 0, "@" },
628
 
    { oNoUseEmbeddedFilename, "no-use-embedded-filename", 0, "@" },
629
 
    { oUtf8Strings, "utf8-strings", 0, "@" },
630
 
    { oNoUtf8Strings, "no-utf8-strings", 0, "@" },
631
 
    { oWithFingerprint, "with-fingerprint", 0, "@" },
632
 
    { oDisableCipherAlgo,  "disable-cipher-algo", 2, "@" },
633
 
    { oDisablePubkeyAlgo,  "disable-pubkey-algo", 2, "@" },
634
 
    { oAllowNonSelfsignedUID, "allow-non-selfsigned-uid", 0, "@" },
635
 
    { oNoAllowNonSelfsignedUID, "no-allow-non-selfsigned-uid", 0, "@" },
636
 
    { oAllowFreeformUID, "allow-freeform-uid", 0, "@" },
637
 
    { oNoAllowFreeformUID, "no-allow-freeform-uid", 0, "@" },
638
 
    { oNoLiteral, "no-literal", 0, "@" },
639
 
    { oSetFilesize, "set-filesize", 20, "@" },
640
 
    { oHonorHttpProxy,"honor-http-proxy", 0, "@" },
641
 
    { oFastListMode,"fast-list-mode", 0, "@" },
642
 
    { oFixedListMode,"fixed-list-mode", 0, "@" },
643
 
    { oListOnly, "list-only", 0, "@"},
644
 
    { oIgnoreTimeConflict, "ignore-time-conflict", 0, "@" },
645
 
    { oIgnoreValidFrom,    "ignore-valid-from",    0, "@" },
646
 
    { oIgnoreCrcError, "ignore-crc-error", 0,"@" },
647
 
    { oIgnoreMDCError, "ignore-mdc-error", 0,"@" },
648
 
    { oShowSessionKey, "show-session-key", 0, "@" },
649
 
    { oOverrideSessionKey, "override-session-key", 2, "@" },
650
 
    { oNoRandomSeedFile,  "no-random-seed-file", 0, "@" },
651
 
    { oAutoKeyRetrieve, "auto-key-retrieve", 0, "@" },
652
 
    { oNoAutoKeyRetrieve, "no-auto-key-retrieve", 0, "@" },
653
 
    { oNoSigCache,         "no-sig-cache", 0, "@" },
654
 
    { oNoSigCreateCheck,   "no-sig-create-check", 0, "@" },
655
 
    { oAutoCheckTrustDB, "auto-check-trustdb", 0, "@"},
656
 
    { oNoAutoCheckTrustDB, "no-auto-check-trustdb", 0, "@"},
657
 
    { oMergeOnly,         "merge-only", 0, "@" },
658
 
    { oAllowSecretKeyImport, "allow-secret-key-import", 0, "@" },
659
 
    { oTryAllSecrets,  "try-all-secrets", 0, "@" },
660
 
    { oEnableSpecialFilenames, "enable-special-filenames", 0, "@" },
661
 
    { oNoExpensiveTrustChecks, "no-expensive-trust-checks", 0, "@" },
662
 
    { aDeleteSecretAndPublicKeys, "delete-secret-and-public-keys",256, "@" },
663
 
    { aRebuildKeydbCaches, "rebuild-keydb-caches", 256, "@"},
664
 
    { oPreservePermissions, "preserve-permissions", 0, "@"},
665
 
    { oDefaultPreferenceList,  "default-preference-list", 2, "@"},
666
 
    { oDefaultKeyserverURL,  "default-keyserver-url", 2, "@"},
667
 
    { oPersonalCipherPreferences,  "personal-cipher-preferences", 2, "@"},
668
 
    { oPersonalDigestPreferences,  "personal-digest-preferences", 2, "@"},
669
 
    { oPersonalCompressPreferences,  "personal-compress-preferences", 2, "@"},
670
 
    /* Aliases.  I constantly mistype these, and assume other people
671
 
       do as well. */
672
 
    { oPersonalCipherPreferences, "personal-cipher-prefs", 2, "@"},
673
 
    { oPersonalDigestPreferences, "personal-digest-prefs", 2, "@"},
674
 
    { oPersonalCompressPreferences, "personal-compress-prefs", 2, "@"},
675
 
    { oAgentProgram, "agent-program", 2 , "@" },
676
 
    { oDisplay,    "display",     2, "@" },
677
 
    { oTTYname,    "ttyname",     2, "@" },
678
 
    { oTTYtype,    "ttytype",     2, "@" },
679
 
    { oLCctype,    "lc-ctype",    2, "@" },
680
 
    { oLCmessages, "lc-messages", 2, "@" },
681
 
    { oXauthority, "xauthority",  2, "@" },
682
 
    { oGroup,      "group",       2, "@" },
683
 
    { oUnGroup,    "ungroup",     2, "@" },
684
 
    { oNoGroups,   "no-groups",    0, "@" },
685
 
    { oStrict,     "strict",      0, "@" },
686
 
    { oNoStrict,   "no-strict",   0, "@" },
687
 
    { oMangleDosFilenames, "mangle-dos-filenames", 0, "@" },
688
 
    { oNoMangleDosFilenames, "no-mangle-dos-filenames", 0, "@" },
689
 
    { oEnableProgressFilter, "enable-progress-filter", 0, "@" },
690
 
    { oMultifile, "multifile", 0, "@" },
691
 
    { oKeyidFormat, "keyid-format", 2, "@" },
692
 
    { oExitOnStatusWriteError, "exit-on-status-write-error", 0, "@" },
693
 
    { oLimitCardInsertTries, "limit-card-insert-tries", 1, "@"},
694
 
 
695
 
    { oAllowMultisigVerification, "allow-multisig-verification", 0, "@"},
696
 
    { oEnableDSA2, "enable-dsa2", 0, "@"},
697
 
    { oDisableDSA2, "disable-dsa2", 0, "@"},
698
 
    { oAllowMultipleMessages, "allow-multiple-messages", 0, "@"},
699
 
    { oNoAllowMultipleMessages, "no-allow-multiple-messages", 0, "@"},
700
 
 
701
 
    /* These two are aliases to help users of the PGP command line
702
 
       product use gpg with minimal pain.  Many commands are common
703
 
       already as they seem to have borrowed commands from us.  Now
704
 
       I'm returning the favor. */
705
 
    { oLocalUser, "sign-with", 2, "@" },
706
 
    { oRecipient, "user", 2, "@" },
707
 
    { oRequireCrossCert, "require-backsigs", 0, "@"},
708
 
    { oRequireCrossCert, "require-cross-certification", 0, "@"},
709
 
    { oNoRequireCrossCert, "no-require-backsigs", 0, "@"},
710
 
    { oNoRequireCrossCert, "no-require-cross-certification", 0, "@"},
711
 
    { oAutoKeyLocate, "auto-key-locate", 2, "@"},
712
 
    { oNoAutoKeyLocate, "no-auto-key-locate", 0, "@"},
713
 
 
714
 
    {0,NULL,0,NULL}
 
588
    " --fingerprint [names]      show fingerprints\n")),
 
589
 
 
590
  /* More hidden commands and options. */
 
591
  ARGPARSE_c (aPrintMDs, "print-mds", "@"), /* old */
 
592
  ARGPARSE_c (aListTrustDB, "list-trustdb", "@"),
 
593
  /* Not yet used: 
 
594
     ARGPARSE_c (aListTrustPath, "list-trust-path", "@"), */
 
595
  ARGPARSE_c (aDeleteSecretAndPublicKeys,
 
596
              "delete-secret-and-public-keys", "@"),
 
597
  ARGPARSE_c (aRebuildKeydbCaches, "rebuild-keydb-caches", "@"),
 
598
 
 
599
  ARGPARSE_s_s (oPasswd, "passphrase", "@"),
 
600
  ARGPARSE_s_i (oPasswdFD, "passphrase-fd", "@"),
 
601
  ARGPARSE_s_s (oPasswdFile, "passphrase-file", "@"),
 
602
  ARGPARSE_s_i (oPasswdRepeat, "passphrase-repeat", "@"),
 
603
  ARGPARSE_s_i (oCommandFD, "command-fd", "@"),
 
604
  ARGPARSE_s_s (oCommandFile, "command-file", "@"),
 
605
  ARGPARSE_s_n (oQuickRandom, "debug-quick-random", "@"),
 
606
  ARGPARSE_s_n (oNoVerbose, "no-verbose", "@"),
 
607
  ARGPARSE_s_s (oTrustDBName, "trustdb-name", "@"),
 
608
  ARGPARSE_s_n (oNoSecmemWarn, "no-secmem-warning", "@"),
 
609
  ARGPARSE_s_n (oRequireSecmem, "require-secmem", "@"),
 
610
  ARGPARSE_s_n (oNoRequireSecmem, "no-require-secmem", "@"),
 
611
  ARGPARSE_s_n (oNoPermissionWarn, "no-permission-warning", "@"),
 
612
  ARGPARSE_s_n (oNoMDCWarn, "no-mdc-warning", "@"),
 
613
  ARGPARSE_s_n (oNoArmor, "no-armor", "@"),
 
614
  ARGPARSE_s_n (oNoArmor, "no-armour", "@"),
 
615
  ARGPARSE_s_n (oNoDefKeyring, "no-default-keyring", "@"),
 
616
  ARGPARSE_s_n (oNoGreeting, "no-greeting", "@"),
 
617
  ARGPARSE_s_n (oNoOptions, "no-options", "@"), 
 
618
  ARGPARSE_s_s (oHomedir, "homedir", "@"), 
 
619
  ARGPARSE_s_n (oNoBatch, "no-batch", "@"),
 
620
  ARGPARSE_s_n (oWithColons, "with-colons", "@"),
 
621
  ARGPARSE_s_n (oWithKeyData,"with-key-data", "@"),
 
622
  ARGPARSE_s_n (oWithSigList,"with-sig-list", "@"),
 
623
  ARGPARSE_s_n (oWithSigCheck,"with-sig-check", "@"),
 
624
  ARGPARSE_s_n (aListKeys, "list-key", "@"),   /* alias */
 
625
  ARGPARSE_s_n (aListSigs, "list-sig", "@"),   /* alias */
 
626
  ARGPARSE_s_n (aCheckKeys, "check-sig", "@"), /* alias */
 
627
  ARGPARSE_s_n (oSkipVerify, "skip-verify", "@"),
 
628
  ARGPARSE_s_n (oCompressKeys, "compress-keys", "@"),
 
629
  ARGPARSE_s_n (oCompressSigs, "compress-sigs", "@"),
 
630
  ARGPARSE_s_i (oDefCertLevel, "default-cert-check-level", "@"), /* old */
 
631
  ARGPARSE_s_n (oAlwaysTrust, "always-trust", "@"),
 
632
  ARGPARSE_s_s (oTrustModel, "trust-model", "@"),
 
633
  ARGPARSE_s_s (oForceOwnertrust, "force-ownertrust", "@"),
 
634
  ARGPARSE_s_s (oSetFilename, "set-filename", "@"),
 
635
  ARGPARSE_s_n (oForYourEyesOnly, "for-your-eyes-only", "@"),
 
636
  ARGPARSE_s_n (oNoForYourEyesOnly, "no-for-your-eyes-only", "@"),
 
637
  ARGPARSE_s_s (oSetPolicyURL,  "set-policy-url", "@"),
 
638
  ARGPARSE_s_s (oSigPolicyURL,  "sig-policy-url", "@"),
 
639
  ARGPARSE_s_s (oCertPolicyURL, "cert-policy-url", "@"),
 
640
  ARGPARSE_s_n (oShowPolicyURL,      "show-policy-url", "@"),
 
641
  ARGPARSE_s_n (oNoShowPolicyURL, "no-show-policy-url", "@"),
 
642
  ARGPARSE_s_s (oSigKeyserverURL, "sig-keyserver-url", "@"),
 
643
  ARGPARSE_s_n (oShowNotation,      "show-notation", "@"),
 
644
  ARGPARSE_s_n (oNoShowNotation, "no-show-notation", "@"),
 
645
  ARGPARSE_s_s (oComment, "comment", "@"),
 
646
  ARGPARSE_s_n (oDefaultComment, "default-comment", "@"),
 
647
  ARGPARSE_s_n (oNoComments, "no-comments", "@"),
 
648
  ARGPARSE_s_n (oEmitVersion,      "emit-version", "@"),
 
649
  ARGPARSE_s_n (oNoEmitVersion, "no-emit-version", "@"),
 
650
  ARGPARSE_s_n (oNoEmitVersion, "no-version", "@"), /* alias */
 
651
  ARGPARSE_s_n (oNotDashEscaped, "not-dash-escaped", "@"),
 
652
  ARGPARSE_s_n (oEscapeFrom,      "escape-from-lines", "@"),
 
653
  ARGPARSE_s_n (oNoEscapeFrom, "no-escape-from-lines", "@"),
 
654
  ARGPARSE_s_n (oLockOnce,     "lock-once", "@"),
 
655
  ARGPARSE_s_n (oLockMultiple, "lock-multiple", "@"),
 
656
  ARGPARSE_s_n (oLockNever,    "lock-never", "@"),
 
657
  ARGPARSE_s_i (oLoggerFD,   "logger-fd", "@"),
 
658
  ARGPARSE_s_s (oLoggerFile, "log-file", "@"),
 
659
  ARGPARSE_s_s (oLoggerFile, "logger-file", "@"),  /* 1.4 compatibility.  */
 
660
  ARGPARSE_s_n (oUseEmbeddedFilename,      "use-embedded-filename", "@"),
 
661
  ARGPARSE_s_n (oNoUseEmbeddedFilename, "no-use-embedded-filename", "@"),
 
662
  ARGPARSE_s_n (oUtf8Strings,      "utf8-strings", "@"),
 
663
  ARGPARSE_s_n (oNoUtf8Strings, "no-utf8-strings", "@"),
 
664
  ARGPARSE_s_n (oWithFingerprint, "with-fingerprint", "@"),
 
665
  ARGPARSE_s_s (oDisableCipherAlgo,  "disable-cipher-algo", "@"),
 
666
  ARGPARSE_s_s (oDisablePubkeyAlgo,  "disable-pubkey-algo", "@"),
 
667
  ARGPARSE_s_n (oAllowNonSelfsignedUID,      "allow-non-selfsigned-uid", "@"),
 
668
  ARGPARSE_s_n (oNoAllowNonSelfsignedUID, "no-allow-non-selfsigned-uid", "@"),
 
669
  ARGPARSE_s_n (oAllowFreeformUID,      "allow-freeform-uid", "@"),
 
670
  ARGPARSE_s_n (oNoAllowFreeformUID, "no-allow-freeform-uid", "@"),
 
671
  ARGPARSE_s_n (oNoLiteral, "no-literal", "@"),
 
672
  ARGPARSE_p_u (oSetFilesize, "set-filesize", "@"),
 
673
  ARGPARSE_s_n (oHonorHttpProxy, "honor-http-proxy", "@"),
 
674
  ARGPARSE_s_n (oFastListMode, "fast-list-mode", "@"),
 
675
  ARGPARSE_s_n (oFixedListMode, "fixed-list-mode", "@"),
 
676
  ARGPARSE_s_n (oListOnly, "list-only", "@"),
 
677
  ARGPARSE_s_n (oIgnoreTimeConflict, "ignore-time-conflict", "@"),
 
678
  ARGPARSE_s_n (oIgnoreValidFrom,    "ignore-valid-from", "@"),
 
679
  ARGPARSE_s_n (oIgnoreCrcError, "ignore-crc-error", "@"),
 
680
  ARGPARSE_s_n (oIgnoreMDCError, "ignore-mdc-error", "@"),
 
681
  ARGPARSE_s_n (oShowSessionKey, "show-session-key", "@"),
 
682
  ARGPARSE_s_s (oOverrideSessionKey, "override-session-key", "@"),
 
683
  ARGPARSE_s_n (oNoRandomSeedFile,  "no-random-seed-file", "@"),
 
684
  ARGPARSE_s_n (oAutoKeyRetrieve, "auto-key-retrieve", "@"),
 
685
  ARGPARSE_s_n (oNoAutoKeyRetrieve, "no-auto-key-retrieve", "@"),
 
686
  ARGPARSE_s_n (oNoSigCache,         "no-sig-cache", "@"),
 
687
  ARGPARSE_s_n (oNoSigCreateCheck,   "no-sig-create-check", "@"),
 
688
  ARGPARSE_s_n (oAutoCheckTrustDB, "auto-check-trustdb", "@"),
 
689
  ARGPARSE_s_n (oNoAutoCheckTrustDB, "no-auto-check-trustdb", "@"),
 
690
  ARGPARSE_s_n (oMergeOnly,       "merge-only", "@" ),
 
691
  ARGPARSE_s_n (oAllowSecretKeyImport, "allow-secret-key-import", "@"),
 
692
  ARGPARSE_s_n (oTryAllSecrets,  "try-all-secrets", "@"),
 
693
  ARGPARSE_s_n (oEnableSpecialFilenames, "enable-special-filenames", "@"),
 
694
  ARGPARSE_s_n (oNoExpensiveTrustChecks, "no-expensive-trust-checks", "@"),
 
695
  ARGPARSE_s_n (oPreservePermissions, "preserve-permissions", "@"),
 
696
  ARGPARSE_s_s (oDefaultPreferenceList,  "default-preference-list", "@"),
 
697
  ARGPARSE_s_s (oDefaultKeyserverURL,  "default-keyserver-url", "@"),
 
698
  ARGPARSE_s_s (oPersonalCipherPreferences, "personal-cipher-preferences","@"),
 
699
  ARGPARSE_s_s (oPersonalDigestPreferences, "personal-digest-preferences","@"),
 
700
  ARGPARSE_s_s (oPersonalCompressPreferences,
 
701
                                         "personal-compress-preferences", "@"),
 
702
 
 
703
  /* Aliases.  I constantly mistype these, and assume other people do
 
704
     as well. */
 
705
  ARGPARSE_s_s (oPersonalCipherPreferences, "personal-cipher-prefs", "@"),
 
706
  ARGPARSE_s_s (oPersonalDigestPreferences, "personal-digest-prefs", "@"),
 
707
  ARGPARSE_s_s (oPersonalCompressPreferences, "personal-compress-prefs", "@"),
 
708
  ARGPARSE_s_s (oAgentProgram, "agent-program", "@"),
 
709
  ARGPARSE_s_s (oDisplay,    "display",    "@"),
 
710
  ARGPARSE_s_s (oTTYname,    "ttyname",    "@"),
 
711
  ARGPARSE_s_s (oTTYtype,    "ttytype",    "@"),
 
712
  ARGPARSE_s_s (oLCctype,    "lc-ctype",   "@"),
 
713
  ARGPARSE_s_s (oLCmessages, "lc-messages","@"),
 
714
  ARGPARSE_s_s (oXauthority, "xauthority", "@"),
 
715
  ARGPARSE_s_s (oGroup,      "group",      "@"),
 
716
  ARGPARSE_s_s (oUnGroup,    "ungroup",    "@"),
 
717
  ARGPARSE_s_n (oNoGroups,   "no-groups",  "@"),
 
718
  ARGPARSE_s_n (oStrict,     "strict",     "@"),
 
719
  ARGPARSE_s_n (oNoStrict,   "no-strict",  "@"),
 
720
  ARGPARSE_s_n (oMangleDosFilenames,      "mangle-dos-filenames", "@"),
 
721
  ARGPARSE_s_n (oNoMangleDosFilenames, "no-mangle-dos-filenames", "@"),
 
722
  ARGPARSE_s_n (oEnableProgressFilter, "enable-progress-filter", "@"),
 
723
  ARGPARSE_s_n (oMultifile, "multifile", "@"),
 
724
  ARGPARSE_s_s (oKeyidFormat, "keyid-format", "@"),
 
725
  ARGPARSE_s_n (oExitOnStatusWriteError, "exit-on-status-write-error", "@"),
 
726
  ARGPARSE_s_i (oLimitCardInsertTries, "limit-card-insert-tries", "@"),
 
727
  
 
728
  ARGPARSE_s_n (oAllowMultisigVerification, 
 
729
                "allow-multisig-verification", "@"),
 
730
  ARGPARSE_s_n (oEnableDSA2, "enable-dsa2", "@"),
 
731
  ARGPARSE_s_n (oDisableDSA2, "disable-dsa2", "@"),
 
732
  ARGPARSE_s_n (oAllowMultipleMessages,      "allow-multiple-messages", "@"),
 
733
  ARGPARSE_s_n (oNoAllowMultipleMessages, "no-allow-multiple-messages", "@"),
 
734
 
 
735
  /* These two are aliases to help users of the PGP command line
 
736
     product use gpg with minimal pain.  Many commands are common
 
737
     already as they seem to have borrowed commands from us.  Now I'm
 
738
     returning the favor. */
 
739
  ARGPARSE_s_s (oLocalUser, "sign-with", "@"),
 
740
  ARGPARSE_s_s (oRecipient, "user", "@"),
 
741
 
 
742
  ARGPARSE_s_n (oRequireCrossCert, "require-backsigs", "@"),
 
743
  ARGPARSE_s_n (oRequireCrossCert, "require-cross-certification", "@"),
 
744
  ARGPARSE_s_n (oNoRequireCrossCert, "no-require-backsigs", "@"),
 
745
  ARGPARSE_s_n (oNoRequireCrossCert, "no-require-cross-certification", "@"),
 
746
 
 
747
  /* New options.  Fixme: Should go more to the top.  */
 
748
  ARGPARSE_s_s (oAutoKeyLocate, "auto-key-locate", "@"),
 
749
  ARGPARSE_s_n (oNoAutoKeyLocate, "no-auto-key-locate", "@"),
 
750
 
 
751
  ARGPARSE_end ()
715
752
};
716
753
 
717
754
 
729
766
 
730
767
static char *build_list( const char *text, char letter,
731
768
                         const char *(*mapf)(int), int (*chkf)(int) );
732
 
static char *build_lib_list (const char *text);
733
769
static void set_cmd( enum cmd_and_opt_values *ret_cmd,
734
770
                        enum cmd_and_opt_values new_cmd );
735
771
static void print_mds( const char *fname, int algo );
739
775
static void emergency_cleanup (void);
740
776
 
741
777
 
 
778
static char *
 
779
make_libversion (const char *libname, const char *(*getfnc)(const char*))
 
780
{
 
781
  const char *s;
 
782
  char *result;
 
783
  
 
784
  if (maybe_setuid)
 
785
    {
 
786
      gcry_control (GCRYCTL_INIT_SECMEM, 0, 0);  /* Drop setuid. */
 
787
      maybe_setuid = 0;
 
788
    }
 
789
  s = getfnc (NULL);
 
790
  result = xmalloc (strlen (libname) + 1 + strlen (s) + 1);
 
791
  strcpy (stpcpy (stpcpy (result, libname), " "), s);
 
792
  return result;
 
793
}
 
794
 
 
795
 
742
796
static const char *
743
797
my_strusage( int level )
744
798
{
745
 
  static char *digests, *pubkeys, *ciphers, *zips, *libs;
746
 
    const char *p;
 
799
  static char *digests, *pubkeys, *ciphers, *zips, *ver_gcry;
 
800
  const char *p;
 
801
 
747
802
    switch( level ) {
748
803
      case 11: p = "gpg (GnuPG)";
749
804
        break;
753
808
            _("Please report bugs to <gnupg-bugs@gnu.org>.\n");
754
809
        break;
755
810
 
 
811
    case 20:
 
812
      if (!ver_gcry)
 
813
        ver_gcry = make_libversion ("libgcrypt", gcry_check_version);
 
814
      p = ver_gcry;
 
815
      break;
 
816
 
756
817
#ifdef IS_DEVELOPMENT_VERSION
757
 
      case 20:
 
818
      case 25:
758
819
        p="NOTE: THIS IS A DEVELOPMENT VERSION!";
759
820
        break;
760
 
      case 21:
 
821
      case 26:
761
822
        p="It is only intended for test purposes and should NOT be";
762
823
        break;
763
 
      case 22:
 
824
      case 27:
764
825
        p="used in a production environment or with production keys!";
765
826
        break;
766
827
#endif
810
871
                              check_compress_algo);
811
872
        p = zips;
812
873
        break;
813
 
      case 38:
814
 
        if (!libs)
815
 
          libs = build_lib_list(_("Used libraries:"));
816
 
        p = libs;
817
 
        break;
818
874
 
819
875
      default:  p = NULL;
820
876
    }
877
933
}
878
934
 
879
935
 
880
 
static char *
881
 
build_lib_list (const char *text)
882
 
{
883
 
  struct { const char *name; const char *version; } array[3];
884
 
  int idx;
885
 
  size_t n;
886
 
  char *list, *p;
887
 
 
888
 
  if (maybe_setuid)
889
 
    gcry_control (GCRYCTL_INIT_SECMEM, 0, 0);  /* Drop setuid. */
890
 
 
891
 
  idx = 0;
892
 
  array[idx].name = "gcrypt";
893
 
  array[idx++].version = gcry_check_version (NULL);
894
 
  array[idx].name = NULL;
895
 
  array[idx++].version = NULL;
896
 
 
897
 
  n = strlen (text) + 1;
898
 
  for (idx=0; array[idx].name; idx++)
899
 
    {
900
 
      n += 2 + strlen (array[idx].name);
901
 
      if (array[idx].version)
902
 
        n += 1 + strlen (array[idx].version) + 1;
903
 
    }
904
 
  n++;
905
 
  list = xmalloc (n+1);
906
 
  p = stpcpy (stpcpy (list, text), " ");
907
 
  for (idx=0; array[idx].name; idx++)
908
 
    {
909
 
      if (idx)
910
 
        p = stpcpy (p, ", ");
911
 
      p = stpcpy (p, array[idx].name);
912
 
      if (array[idx].version)
913
 
        p = stpcpy (stpcpy (stpcpy (p, "("), array[idx].version), ")");
914
 
    }
915
 
  strcpy (p, "\n");
916
 
  return list;
917
 
}
918
 
 
919
 
 
920
936
static void
921
937
wrong_args( const char *text)
922
938
{
1020
1036
   used with --status-file etc functions.  Not generally useful but it
1021
1037
   avoids the riscos specific functions and well some Windows people
1022
1038
   might like it too.  Prints an error message and returns -1 on
1023
 
   error. On success the file descriptor is returned.  */
 
1039
   error.  On success the file descriptor is returned.  */
1024
1040
static int
1025
 
open_info_file (const char *fname, int for_write)
 
1041
open_info_file (const char *fname, int for_write, int binary)
1026
1042
{
1027
1043
#ifdef __riscos__
1028
1044
  return riscos_fdopenfile (fname, for_write);
1032
1048
     similar to the option file but in that case it is unlikely that
1033
1049
     sensitive information may be retrieved by means of error
1034
1050
     messages.  */
 
1051
  (void)fname;
 
1052
  (void)for_write;
 
1053
  (void)binary;
1035
1054
  return -1;
1036
1055
#else 
1037
1056
  int fd;
1038
1057
 
 
1058
  if (binary)
 
1059
    binary = MY_O_BINARY;
 
1060
 
1039
1061
/*   if (is_secured_filename (fname)) */
1040
1062
/*     { */
1041
1063
/*       fd = -1; */
1046
1068
      do
1047
1069
        {
1048
1070
          if (for_write)
1049
 
            fd = open (fname, O_CREAT | O_TRUNC | O_WRONLY,
 
1071
            fd = open (fname, O_CREAT | O_TRUNC | O_WRONLY | binary,
1050
1072
                        S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
1051
1073
          else
1052
 
            fd = open (fname, O_RDONLY | MY_O_BINARY);
 
1074
            fd = open (fname, O_RDONLY | binary);
1053
1075
        }
1054
1076
      while (fd == -1 && errno == EINTR);
1055
1077
/*     } */
1549
1571
  printf ("reader-port:%lu:\n", GC_OPT_FLAG_NONE);
1550
1572
  printf ("default-key:%lu:\n", GC_OPT_FLAG_NONE);
1551
1573
  printf ("encrypt-to:%lu:\n", GC_OPT_FLAG_NONE);
 
1574
  printf ("auto-key-locate:%lu:\n", GC_OPT_FLAG_NONE);
 
1575
  printf ("allow-pka-lookup:%lu:\n", GC_OPT_FLAG_NONE);
 
1576
  printf ("log-file:%lu:\n", GC_OPT_FLAG_NONE);
 
1577
  printf ("debug-level:%lu:\"none:\n", GC_OPT_FLAG_DEFAULT);
 
1578
  printf ("group:%lu:\n", GC_OPT_FLAG_NONE);
1552
1579
 
1553
1580
  xfree (configfile_esc);
1554
1581
}
1754
1781
static void
1755
1782
gpg_init_default_ctrl (ctrl_t ctrl)
1756
1783
{
 
1784
  (void)ctrl;
1757
1785
}
1758
1786
 
1759
1787
 
1762
1790
static void
1763
1791
gpg_deinit_default_ctrl (ctrl_t ctrl)
1764
1792
{
 
1793
  (void)ctrl;
1765
1794
}
1766
1795
 
1767
1796
 
1887
1916
    log_set_prefix ("gpg", 1);
1888
1917
 
1889
1918
    /* Make sure that our subsystems are ready.  */
 
1919
    i18n_init();
1890
1920
    init_common_subsystems ();
1891
1921
 
1892
1922
    /* Check that the libraries are suitable.  Do it right here because the
1906
1936
 
1907
1937
    create_dotlock(NULL); /* Register locking cleanup. */
1908
1938
 
1909
 
    i18n_init();
1910
1939
 
1911
1940
    opt.command_fd = -1; /* no command fd */
1912
1941
    opt.compress_level = -1; /* defaults to standard compress level */
2004
2033
#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
2005
2034
    /* There should be no way to get to this spot while still carrying
2006
2035
       setuid privs.  Just in case, bomb out if we are. */
2007
 
    if(getuid()!=geteuid())
2008
 
      BUG();
 
2036
    if ( getuid () != geteuid () )
 
2037
      BUG ();
2009
2038
#endif
2010
2039
    maybe_setuid = 0;
2011
2040
 
2093
2122
          case aChangePIN:
2094
2123
#endif /* ENABLE_CARD_SUPPORT*/
2095
2124
          case aListKeys: 
 
2125
          case aLocateKeys:
2096
2126
          case aListSigs: 
2097
2127
          case aExportSecret: 
2098
2128
          case aExportSecretSub: 
2192
2222
          case oDebugLevel: debug_level = pargs.r.ret_str; break;
2193
2223
 
2194
2224
          case oStatusFD:
2195
 
            set_status_fd( translate_sys2libc_fd_int (pargs.r.ret_int, 1) );
 
2225
            set_status_fd ( translate_sys2libc_fd_int (pargs.r.ret_int, 1) );
2196
2226
            break;
2197
2227
          case oStatusFile:
2198
 
            set_status_fd ( open_info_file (pargs.r.ret_str, 1) );
 
2228
            set_status_fd ( open_info_file (pargs.r.ret_str, 1, 0) );
2199
2229
            break;
2200
2230
          case oAttributeFD:
2201
 
            set_attrib_fd(translate_sys2libc_fd_int (pargs.r.ret_int, 1));
 
2231
            set_attrib_fd ( translate_sys2libc_fd_int (pargs.r.ret_int, 1) );
2202
2232
            break;
2203
2233
          case oAttributeFile:
2204
 
            set_attrib_fd ( open_info_file (pargs.r.ret_str, 1) );
 
2234
            set_attrib_fd ( open_info_file (pargs.r.ret_str, 1, 1) );
2205
2235
            break;
2206
2236
          case oLoggerFD:
2207
2237
            log_set_fd (translate_sys2libc_fd_int (pargs.r.ret_int, 1));
2258
2288
          case oNoOptions: opt.no_homedir_creation = 1; break; /* no-options */
2259
2289
          case oHomedir: break;
2260
2290
          case oNoBatch: opt.batch = 0; break;
2261
 
          case oWithKeyData: opt.with_key_data=1; /* fall thru */
 
2291
 
 
2292
          case oWithKeyData: opt.with_key_data=1; /*FALLTHRU*/
2262
2293
          case oWithColons: opt.with_colons=':'; break;
2263
2294
 
 
2295
          case oWithSigCheck: opt.check_sigs = 1; /*FALLTHRU*/
 
2296
          case oWithSigList: opt.list_sigs = 1; break;  
 
2297
 
2264
2298
          case oSkipVerify: opt.skip_verify=1; break;
2265
2299
          case oCompressKeys: opt.compress_keys = 1; break;
2266
2300
          case aListSecretKeys: set_cmd( &cmd, aListSecretKeys); break;
2494
2528
            pwfd = translate_sys2libc_fd_int (pargs.r.ret_int, 0);
2495
2529
            break;
2496
2530
          case oPasswdFile:
2497
 
            pwfd = open_info_file (pargs.r.ret_str, 0);
 
2531
            pwfd = open_info_file (pargs.r.ret_str, 0, 1);
2498
2532
            break;
2499
2533
          case oPasswdRepeat: opt.passwd_repeat=pargs.r.ret_int; break;
2500
2534
          case oCommandFD:
2501
2535
            opt.command_fd = translate_sys2libc_fd_int (pargs.r.ret_int, 0);
2502
2536
            break;
2503
2537
          case oCommandFile:
2504
 
            opt.command_fd = open_info_file (pargs.r.ret_str, 0);
 
2538
            opt.command_fd = open_info_file (pargs.r.ret_str, 0, 1);
2505
2539
            break;
2506
2540
          case oCipherAlgo: 
2507
2541
            def_cipher_string = xstrdup(pargs.r.ret_str);
2717
2751
                                   "--keyserver-options ","http-proxy");
2718
2752
                break;
2719
2753
          case oFastListMode: opt.fast_list_mode = 1; break;
2720
 
          case oFixedListMode: opt.fixed_list_mode = 1; break;
 
2754
          case oFixedListMode: /* Dummy */ break;
2721
2755
          case oListOnly: opt.list_only=1; break;
2722
2756
          case oIgnoreTimeConflict: opt.ignore_time_conflict = 1; break;
2723
2757
          case oIgnoreValidFrom: opt.ignore_valid_from = 1; break;
2861
2895
 
2862
2896
          case oNoop: break;
2863
2897
 
2864
 
          default : pargs.err = configfp? 1:2; break;
 
2898
          default: 
 
2899
            pargs.err = configfp? ARGPARSE_PRINT_WARNING:ARGPARSE_PRINT_ERROR;
 
2900
            break;
2865
2901
          }
2866
2902
      }
2867
2903
 
2900
2936
        fprintf(stderr, "%s\n", strusage(15) );
2901
2937
    }
2902
2938
#ifdef IS_DEVELOPMENT_VERSION
2903
 
    if( !opt.batch )
 
2939
    if (!opt.batch)
2904
2940
      {
2905
2941
        const char *s;
2906
2942
 
2907
 
        if((s=strusage(20)))
2908
 
          log_info("%s\n",s);
2909
 
        if((s=strusage(21)))
2910
 
          log_info("%s\n",s);
2911
 
        if((s=strusage(22)))
 
2943
        if((s=strusage(25)))
 
2944
          log_info("%s\n",s);
 
2945
        if((s=strusage(26)))
 
2946
          log_info("%s\n",s);
 
2947
        if((s=strusage(27)))
2912
2948
          log_info("%s\n",s);
2913
2949
      }
2914
2950
#endif
2932
2968
              "use!\n");
2933
2969
#endif
2934
2970
 
 
2971
    /* Older Libgcrypts fail with an assertion during DSA key
 
2972
       generation.  Better disable DSA2 entirely. */
 
2973
    if (opt.flags.dsa2 && !gcry_check_version ("1.4.0") )
 
2974
      {
 
2975
        log_info ("WARNING: "
 
2976
                  "DSA2 is only available with Libgcrypt 1.4 and later\n");
 
2977
        opt.flags.dsa2 = 0;
 
2978
      }
 
2979
 
2935
2980
    if (opt.verbose > 2)
2936
2981
        log_info ("using character set `%s'\n", get_native_charset ());
2937
2982
 
3259
3304
        set_cmd( &cmd, aListKeys);
3260
3305
    }
3261
3306
 
3262
 
    /* kludge to let -sat generate a clear text signature */
3263
 
    if( opt.textmode == 2 && !detached_sig && opt.armor && cmd == aSign )
3264
 
      {
3265
 
        log_info ("compatibility note:\n");
3266
 
        log_info ("\"-sat\" won't generate clear signed messages in "
3267
 
                  "future versions\n");
3268
 
        log_info ("Use \"--clearsign\" instead of \"-sat\"\n");
3269
 
        cmd = aClearsign;
3270
 
      }
3271
3307
 
3272
3308
    if( opt.verbose > 1 )
3273
3309
        set_packet_list_mode(1);
3285
3321
      {
3286
3322
        if (ALWAYS_ADD_KEYRINGS
3287
3323
            || (cmd != aCheckKeys && cmd != aListSigs && cmd != aListKeys
3288
 
                && cmd != aVerify && cmd != aSym))
 
3324
                && cmd != aVerify && cmd != aSym && cmd != aLocateKeys))
3289
3325
          {
3290
3326
            if (!sec_nrings || default_keyring) /* add default secret rings */
3291
3327
              keydb_add_resource ("secring" EXTSEP_S "gpg", 4, 1);
3568
3604
        sl = NULL;
3569
3605
        for( ; argc; argc--, argv++ )
3570
3606
            add_to_strlist2( &sl, *argv, utf8_strings );
3571
 
        public_key_list( sl );
 
3607
        public_key_list( sl, 0 );
3572
3608
        free_strlist(sl);
3573
3609
        break;
3574
3610
      case aListSecretKeys:
3578
3614
        secret_key_list( sl );
3579
3615
        free_strlist(sl);
3580
3616
        break;
 
3617
      case aLocateKeys:
 
3618
        sl = NULL;
 
3619
        for (; argc; argc--, argv++)
 
3620
          add_to_strlist2( &sl, *argv, utf8_strings );
 
3621
        public_key_list (sl, 1);
 
3622
        free_strlist (sl);
 
3623
        break;
3581
3624
 
3582
3625
      case aKeygen: /* generate a key */
3583
3626
        if( opt.batch ) {
4122
4165
        gcry_md_enable (md, GCRY_MD_MD5);
4123
4166
        gcry_md_enable (md, GCRY_MD_SHA1);
4124
4167
        gcry_md_enable (md, GCRY_MD_RMD160);
4125
 
        if (!openpgp_md_test_algo (DIGEST_ALGO_SHA224))
4126
 
          gcry_md_enable (md, DIGEST_ALGO_SHA224);
 
4168
        if (!openpgp_md_test_algo (GCRY_MD_SHA224))
 
4169
          gcry_md_enable (md, GCRY_MD_SHA224);
4127
4170
        if (!openpgp_md_test_algo (GCRY_MD_SHA256))
4128
4171
          gcry_md_enable (md, GCRY_MD_SHA256);
4129
4172
        if (!openpgp_md_test_algo (GCRY_MD_SHA384))
4144
4187
            else {
4145
4188
                print_hashline( md, GCRY_MD_MD5, fname );
4146
4189
                print_hashline( md, GCRY_MD_SHA1, fname );
4147
 
                print_hashline( md, GCRY_MD_RMD160, fname );
4148
 
                if (!gcry_md_test_algo (DIGEST_ALGO_SHA224))
4149
 
                    print_hashline (md, DIGEST_ALGO_SHA224, fname);
 
4190
                if (!gcry_md_test_algo (GCRY_MD_RMD160))
 
4191
                    print_hashline( md, GCRY_MD_RMD160, fname );
 
4192
                if (!gcry_md_test_algo (GCRY_MD_SHA224))
 
4193
                    print_hashline (md, GCRY_MD_SHA224, fname);
4150
4194
                if (!gcry_md_test_algo (GCRY_MD_SHA256))
4151
4195
                    print_hashline( md, GCRY_MD_SHA256, fname );
4152
4196
                if (!gcry_md_test_algo (GCRY_MD_SHA384))
4161
4205
            else {
4162
4206
                print_hex( md, GCRY_MD_MD5, fname );
4163
4207
                print_hex( md, GCRY_MD_SHA1, fname );
4164
 
                print_hex( md, GCRY_MD_RMD160, fname );
4165
 
                if (!gcry_md_test_algo (DIGEST_ALGO_SHA224))
4166
 
                    print_hex (md, DIGEST_ALGO_SHA224, fname);
 
4208
                if (!gcry_md_test_algo (GCRY_MD_RMD160))
 
4209
                    print_hex( md, GCRY_MD_RMD160, fname );
 
4210
                if (!gcry_md_test_algo (GCRY_MD_SHA224))
 
4211
                    print_hex (md, GCRY_MD_SHA224, fname);
4167
4212
                if (!gcry_md_test_algo (GCRY_MD_SHA256))
4168
4213
                    print_hex( md, GCRY_MD_SHA256, fname );
4169
4214
                if (!gcry_md_test_algo (GCRY_MD_SHA384))