summaryrefslogtreecommitdiff
path: root/trust/extract.h
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2013-08-28 10:37:44 +0200
committerStef Walter <stef@thewalter.net>2013-08-29 10:31:38 +0200
commitb693517966b1cbe5b81e39aeefad7b52b6f10492 (patch)
tree4a31899267b6c37ee7ff778b92510f3be1f68add /trust/extract.h
parent714e4a22a82295c41360fbfa6019a31b1e2a0f30 (diff)
downloadp11-kit-b693517966b1cbe5b81e39aeefad7b52b6f10492.tar.gz
trust: Refactor enumeration of certificates to extract
Because we want to use this same logic for listing trust
Diffstat (limited to 'trust/extract.h')
-rw-r--r--trust/extract.h84
1 files changed, 17 insertions, 67 deletions
diff --git a/trust/extract.h b/trust/extract.h
index 7db61c1..1bd8e4a 100644
--- a/trust/extract.h
+++ b/trust/extract.h
@@ -37,87 +37,37 @@
#ifndef P11_EXTRACT_H_
#define P11_EXTRACT_H_
-#include "array.h"
-#include "asn1.h"
-#include "dict.h"
-#include "iter.h"
+#include "enumerate.h"
#include "pkcs11.h"
enum {
/* These overlap with the flags in save.h, so start higher */
P11_EXTRACT_COMMENT = 1 << 10,
- P11_EXTRACT_ANCHORS = 1 << 11,
- P11_EXTRACT_BLACKLIST = 1 << 12,
- P11_EXTRACT_COLLAPSE = 1 << 13,
};
-typedef struct {
- p11_dict *asn1_defs;
- p11_dict *limit_to_purposes;
- p11_dict *already_seen;
- char *destination;
- int flags;
+typedef bool (* p11_extract_func) (p11_enumerate *ex,
+ const char *destination);
- /*
- * Stuff below is parsed info for the current iteration.
- * Currently this information is generally all relevant
- * just for certificates.
- */
+bool p11_extract_x509_file (p11_enumerate *ex,
+ const char *destination);
- CK_OBJECT_CLASS klass;
- CK_ATTRIBUTE *attrs;
+bool p11_extract_x509_directory (p11_enumerate *ex,
+ const char *destination);
- /* Pre-parsed data for certificates */
- node_asn *cert_asn;
- const unsigned char *cert_der;
- size_t cert_len;
+bool p11_extract_pem_bundle (p11_enumerate *ex,
+ const char *destination);
- /* DER OID -> CK_ATTRIBUTE list */
- p11_dict *stapled;
+bool p11_extract_pem_directory (p11_enumerate *ex,
+ const char *destination);
- /* Set of OID purposes as strings */
- p11_array *purposes;
-} p11_extract_info;
+bool p11_extract_jks_cacerts (p11_enumerate *ex,
+ const char *destination);
-void p11_extract_info_init (p11_extract_info *ex);
+bool p11_extract_openssl_bundle (p11_enumerate *ex,
+ const char *destination);
-CK_RV p11_extract_info_load_filter (P11KitIter *iter,
- CK_BBOOL *matches,
- void *data);
-
-void p11_extract_info_limit_purpose (p11_extract_info *ex,
- const char *purpose);
-
-void p11_extract_info_cleanup (p11_extract_info *ex);
-
-char * p11_extract_info_filename (p11_extract_info *ex);
-
-char * p11_extract_info_comment (p11_extract_info *ex,
- bool first);
-
-typedef bool (* p11_extract_func) (P11KitIter *iter,
- p11_extract_info *ex);
-
-bool p11_extract_x509_file (P11KitIter *iter,
- p11_extract_info *ex);
-
-bool p11_extract_x509_directory (P11KitIter *iter,
- p11_extract_info *ex);
-
-bool p11_extract_pem_bundle (P11KitIter *iter,
- p11_extract_info *ex);
-
-bool p11_extract_pem_directory (P11KitIter *iter,
- p11_extract_info *ex);
-
-bool p11_extract_jks_cacerts (P11KitIter *iter,
- p11_extract_info *ex);
-
-bool p11_extract_openssl_bundle (P11KitIter *iter,
- p11_extract_info *ex);
-
-bool p11_extract_openssl_directory (P11KitIter *iter,
- p11_extract_info *ex);
+bool p11_extract_openssl_directory (p11_enumerate *ex,
+ const char *destination);
int p11_trust_extract (int argc,
char **argv);