Define OpenPGP constants and use them rather than magic numbers
[onak.git] / openpgp.h
diff --git a/openpgp.h b/openpgp.h
new file mode 100644 (file)
index 0000000..7ccf133
--- /dev/null
+++ b/openpgp.h
@@ -0,0 +1,45 @@
+/*
+ * openpgp.h - Defines directly related to OpenPGP RFC 4880
+ *
+ * Copyright 2011 Jonathan McDowell <noodles@earth.li>
+ */
+
+#ifndef __OPENPGP_H__
+#define __OPENPGP_H__
+
+#define OPENPGP_PKALGO_RSA             1
+#define OPENPGP_PKALGO_ELGAMAL         16
+#define OPENPGP_PKALGO_DSA             17
+#define OPENPGP_PKALGO_ELGAMAL_SIGN    20
+
+#define OPENPGP_HASH_MD5               1
+#define OPENPGP_HASH_SHA1              2
+#define OPENPGP_HASH_RIPEMD160         3
+#define OPENPGP_HASH_SHA256            8
+#define OPENPGP_HASH_SHA384            9
+#define OPENPGP_HASH_SHA512            10
+#define OPENPGP_HASH_SHA224            11
+
+#define OPENPGP_PACKET_SIGNATURE       2
+#define OPENPGP_PACKET_PUBLICKEY       6
+#define OPENPGP_PACKET_TRUST           12
+#define OPENPGP_PACKET_UID             13
+#define OPENPGP_PACKET_PUBLICSUBKEY    14
+#define OPENPGP_PACKET_UAT             17
+
+#define OPENPGP_SIGTYPE_BINARY         0x00
+#define OPENPGP_SIGTYPE_TEXT           0x01
+#define OPENPGP_SIGTYPE_KEY_REV                0x20
+#define OPENPGP_SIGTYPE_SUBKEY_REV     0x28
+#define OPENPGP_SIGTYPE_CERT_REV       0x30
+
+#define OPENPGP_SIGSUB_CREATION                2
+#define OPENPGP_SIGSUB_EXPIRY          3
+#define OPENPGP_SIGSUB_REGEX           6
+#define OPENPGP_SIGSUB_ISSUER          16
+#define OPENPGP_SIGSUB_NOTATION                20
+#define OPENPGP_SIGSUB_KEYSERVER       23
+#define OPENPGP_SIGSUB_PRIMARYUID      25
+#define OPENPGP_SIGSUB_POLICYURI       26
+
+#endif /* __OPENPGP_H__ */