set pgp_verify_key_command="pgp -kcc +language=mutt %r"
# read in the public key ring
-set pgp_list_pubring_command="pgpring -k $PGPPATH/pubring.pgp %r"
+set pgp_list_pubring_command="pgpring -2 %r"
# read in the secret key ring
-set pgp_list_secring_command="pgpring -k $PGPPATH/secring.pgp %r"
-
+set pgp_list_secring_command="pgpring -s -2 %r"
set pgp_verify_key_command="pgpk -c +batchmode +language=mutt --OutputInformationFD=1 %r"
# read in the public key ring
-set pgp_list_pubring_command="pgpring -k $PGPPATH/pubring.pkr %r"
+set pgp_list_pubring_command="pgpring -5 %r"
# read in the secret key ring
-set pgp_list_secring_command="pgpring -k $PGPPATH/secring.skr %r"
+set pgp_list_secring_command="pgpring -5 -s %r"
{
int c;
+ short version = 2;
+ short secring = 0;
+
+ const char *_kring = NULL;
+ char *env_pgppath, *env_home;
+
+ char pgppath[_POSIX_PATH_MAX];
char kring[_POSIX_PATH_MAX];
- char *pgppath;
- if ((pgppath = getenv ("PGPPATH")))
- snprintf (kring, sizeof (kring), "%s/%s", pgppath, "pubring.pgp");
+ while ((c = getopt (argc, argv, "25sk:")) != EOF)
+ {
+ switch (c)
+ {
+ case 'k':
+ {
+ _kring = optarg;
+ break;
+ }
+
+ case '2': case '5':
+ {
+ version = 'c' - '0';
+ break;
+ }
+
+ case 's':
+ {
+ secring = 1;
+ break;
+ }
+
+ default:
+ {
+ fprintf (stderr, "usage: %s [-k <key ring> | [-2 | -5] [ -s]] [hints]\n",
+ argv[0]);
+ exit (1);
+ }
+ }
+ }
+
+ if (_kring)
+ strfcpy (kring, _kring, sizeof (kring));
else
- *kring = '\0';
-
- while ((c = getopt (argc, argv, "k:")) != EOF)
{
- if (c == 'k')
- strfcpy (kring, optarg, sizeof (kring));
+ if ((env_pgppath = getenv ("PGPPATH")))
+ strfcpy (pgppath, env_pgppath, sizeof (pgppath));
+ else if ((env_home = getenv ("HOME")))
+ snprintf (pgppath, sizeof (pgppath), "%s/.pgp", env_home);
else
{
- fprintf (stderr, "usage: %s [-k key ring] [hints]\n",
- argv[0]);
+ fprintf (stderr, "%s: Can't determine your PGPPATH.\n", argv[0]);
exit (1);
}
+
+ if (secring)
+ snprintf (kring, sizeof (kring), "%s/secring.%s", pgppath, version == 2 ? "pgp" : "skr");
+ else
+ snprintf (kring, sizeof (kring), "%s/pubring.%s", pgppath, version == 2 ? "pgp" : "pkr");
}
pgpring_find_candidates (kring, argv + optind, argc - optind);
return 0;
}
-
+/* The actual key ring parser */
enum packet_tags
{