summaryrefslogtreecommitdiffstats
path: root/pgplib.h
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1999-06-03 07:27:43 +0000
committerThomas Roessler <roessler@does-not-exist.org>1999-06-03 07:27:43 +0000
commitdddad7c776881afcb79b627c5e423b4dd1ac8959 (patch)
tree9fabe2dc0b83076a387de99fc0572b7eb902cb02 /pgplib.h
parentb5eae58059edb774a743a4c7f66229f7124ad5ab (diff)
Experimental: New PGP invocation interface. The invocations are done
through formats, so all this should fit more cleanly into mutt now.
Diffstat (limited to 'pgplib.h')
-rw-r--r--pgplib.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/pgplib.h b/pgplib.h
new file mode 100644
index 00000000..2f4c5bfd
--- /dev/null
+++ b/pgplib.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 1996,1997 Michael R. Elkins <me@cs.hmc.edu>
+ * Copyright (C) 1999 Thoms Roessler <roessler@guug.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifdef _PGPPATH
+
+#define PGPENCRYPT 1
+#define PGPSIGN 2
+#define PGPKEY 4
+
+#define KEYFLAG_CANSIGN (1 << 0)
+#define KEYFLAG_CANENCRYPT (1 << 1)
+#define KEYFLAG_SECRET (1 << 7)
+#define KEYFLAG_EXPIRED (1 << 8)
+#define KEYFLAG_REVOKED (1 << 9)
+#define KEYFLAG_DISABLED (1 << 10)
+#define KEYFLAG_SUBKEY (1 << 11)
+#define KEYFLAG_CRITICAL (1 << 12)
+#define KEYFLAG_PREFER_ENCRYPTION (1 << 13)
+#define KEYFLAG_PREFER_SIGNING (1 << 14)
+
+#define KEYFLAG_CANTUSE (KEYFLAG_DISABLED|KEYFLAG_REVOKED|KEYFLAG_EXPIRED)
+#define KEYFLAG_RESTRICTIONS (KEYFLAG_CANTUSE|KEYFLAG_CRITICAL)
+
+#define KEYFLAG_ABILITIES (KEYFLAG_CANSIGN|KEYFLAG_CANENCRYPT|KEYFLAG_PREFER_ENCRYPTION|KEYFLAG_PREFER_SIGNING)
+
+typedef struct pgp_keyinfo
+{
+ char *keyid;
+ struct pgp_uid *address;
+ int flags;
+ short keylen;
+ time_t gen_time;
+ int numalg;
+ const char *algorithm;
+ struct pgp_keyinfo *parent;
+ struct pgp_keyinfo *next;
+}
+pgp_key_t;
+
+typedef struct pgp_uid
+{
+ char *addr;
+ short trust;
+ struct pgp_keyinfo *parent;
+ struct pgp_uid *next;
+}
+pgp_uid_t;
+
+enum pgp_version
+{
+ PGP_V2,
+ PGP_V3,
+ PGP_GPG,
+ PGP_UNKNOWN
+};
+
+enum pgp_ring
+{
+ PGP_PUBRING,
+ PGP_SECRING
+};
+
+typedef enum pgp_ring pgp_ring_t;
+
+/* prototypes */
+
+const char *pgp_pkalg_to_mic (const char *);
+const char *pgp_pkalgbytype (unsigned char);
+
+pgp_key_t *pgp_remove_key (pgp_key_t **, pgp_key_t *);
+pgp_uid_t *pgp_copy_uids (pgp_uid_t *, pgp_key_t *);
+
+short pgp_canencrypt (unsigned char);
+short pgp_cansign (unsigned char);
+short pgp_get_abilities (unsigned char);
+
+void pgp_free_key (pgp_key_t **kpp);
+
+#define pgp_new_keyinfo() safe_calloc (sizeof (pgp_key_t), 1)
+
+#endif /* _PGPPATH */