2
2
* $Id: conftype.h 1155 2008-08-21 18:33:21Z hubert@u.washington.edu $
4
4
* ========================================================================
5
* Copyright 2013-2015 Eduardo Chappa
5
6
* Copyright 2006-2008 University of Washington
6
* Copyright 2013 Eduardo Chappa
8
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
9
* you may not use this file except in compliance with the License.
670
673
typedef enum {Directory, Container, Keychain, Nada} SmimeHolderType;
675
typedef enum {Public, Private, CACert} WhichCerts;
677
typedef struct certdata {
678
unsigned deleted:1; /* certificate is marked deleted */
679
unsigned renew:1; /* we must renew this list, set at top cert */
680
char *date_from; /* date from which certificate is valid */
681
char *date_to; /* date certificate expires */
682
char *md5; /* MD5 Hash */
672
685
typedef struct certlist {
674
687
void *x509_cert; /* this is type (X509 *) */
675
689
struct certlist *next;
678
692
typedef struct smime_stuff {
679
693
unsigned inited:1;
683
697
unsigned entered_passphrase:1; /* user entered a passphrase */
684
698
unsigned already_auto_asked:1; /* asked for passphrase automatically, not again */
685
699
volatile char passphrase[100]; /* storage for the entered passphrase */
686
char *passphrase_emailaddr; /* pointer to allocated storage */
700
char **passphrase_emailaddr; /* pointer to allocated storage */
689
703
* If we are using the Container type it is easiest if we
690
704
* read in and maintain a list of certs and then write them
691
705
* out all at once. For Directory type we just leave the data
692
* in the individual files and read or write the individual
693
* files when needed, so we don't have a list of all the certs.
706
* in the individual files and read the list of files in the
695
709
SmimeHolderType publictype;
696
710
char *publicpath;
697
711
char *publiccontent;
698
712
CertList *publiccertlist;
713
CertList *backuppubliccertlist;
700
715
SmimeHolderType privatetype;
701
716
char *privatepath;
702
717
char *privatecontent;
703
void *personal_certs; /* this is type (PERSONAL_CERT *) */
718
CertList *privatecertlist;
719
CertList *backupprivatecertlist;
720
void *backuppersonal_certs; /* this is type (PERSONAL_CERT *) */
721
void *personal_certs; /* this is type (PERSONAL_CERT *) */
705
723
SmimeHolderType catype;
726
CertList *cacertlist;
727
CertList *backupcacertlist;
731
#define BACKUPDATACERT(X) (((X) == Public ? ps_global->smime->backuppubliccertlist \
732
: ((X) == Private ? ps_global->smime->backupprivatecertlist \
733
: ps_global->smime->backupcacertlist)))
735
#define DATACERT(X) (((X) == Public ? ps_global->smime->publiccertlist \
736
: ((X) == Private ? ps_global->smime->privatecertlist \
737
: ps_global->smime->cacertlist)))
739
#define PATHCERTDIR(X) (((X) == Public ? ps_global->smime->publicpath \
740
: ((X) == Private ? ps_global->smime->privatepath \
741
: ((X) == CACert ? ps_global->smime->capath : NULL))))
743
#define CONTENTCERTLIST(X) (((X) == Public ? ps_global->smime->publiccontent \
744
: ((X) == Private ? ps_global->smime->privatecontent \
745
: ((X) == CACert ? ps_global->smime->cacontent : NULL))))
747
#define SMHOLDERTYPE(X) (((X) == Public ? ps_global->smime->publictype \
748
: ((X) == Private ? ps_global->smime->privatetype \
749
: ((X) == CACert ? ps_global->smime->catype : Nada))))
751
#define EXTCERT(X) (((X) == Public ? ".crt" \
752
: ((X) == Private ? ".key" \
753
: ((X) == CACert ? ".crt" : ""))))
755
#define DELETEDCERT(X) ((X)->data.deleted)
756
#define RENEWCERT(X) ((X)->data.renew)
757
#define DATEFROMCERT(X) ((X)->data.date_from)
758
#define DATETOCERT(X) ((X)->data.date_to)
759
#define MD5CERT(X) ((X)->data.md5)
711
761
#endif /* SMIME */