1 #ifndef __ARC_CERTUTIL_H__
2 #define __ARC_CERTUTIL_H__
5 #include <openssl/pem.h>
6 #include <openssl/x509.h>
7 #include <openssl/stack.h>
9 #include <arc/credential/Proxycertinfo.h>
11 namespace ArcCredential {
13 #define PROXYCERTINFO_V3 "1.3.6.1.4.1.3536.1.222"
14 #ifdef HAVE_OPENSSL_PROXY
15 #define PROXYCERTINFO_V4 "1.3.6.1.5.5.7.1.1400"
17 #define PROXYCERTINFO_V4 "1.3.6.1.5.5.7.1.14"
19 #define PROXYCERTINFO_OPENSSL "1.3.6.1.5.5.7.1.14"
54 #define CERT_IS_PROXY(cert_type) \
55 (cert_type == CERT_TYPE_GSI_3_IMPERSONATION_PROXY || \
56 cert_type == CERT_TYPE_GSI_3_INDEPENDENT_PROXY || \
57 cert_type == CERT_TYPE_GSI_3_LIMITED_PROXY || \
58 cert_type == CERT_TYPE_GSI_3_RESTRICTED_PROXY || \
59 cert_type == CERT_TYPE_RFC_IMPERSONATION_PROXY || \
60 cert_type == CERT_TYPE_RFC_INDEPENDENT_PROXY || \
61 cert_type == CERT_TYPE_RFC_LIMITED_PROXY || \
62 cert_type == CERT_TYPE_RFC_RESTRICTED_PROXY || \
63 cert_type == CERT_TYPE_RFC_ANYLANGUAGE_PROXY || \
64 cert_type == CERT_TYPE_GSI_2_PROXY || \
65 cert_type == CERT_TYPE_GSI_2_LIMITED_PROXY)
68 #define CERT_IS_RFC_PROXY(cert_type) \
69 (cert_type == CERT_TYPE_RFC_IMPERSONATION_PROXY || \
70 cert_type == CERT_TYPE_RFC_INDEPENDENT_PROXY || \
71 cert_type == CERT_TYPE_RFC_LIMITED_PROXY || \
72 cert_type == CERT_TYPE_RFC_RESTRICTED_PROXY || \
73 cert_type == CERT_TYPE_RFC_ANYLANGUAGE_PROXY)
76 #define CERT_IS_GSI_3_PROXY(cert_type) \
77 (cert_type == CERT_TYPE_GSI_3_IMPERSONATION_PROXY || \
78 cert_type == CERT_TYPE_GSI_3_INDEPENDENT_PROXY || \
79 cert_type == CERT_TYPE_GSI_3_LIMITED_PROXY || \
80 cert_type == CERT_TYPE_GSI_3_RESTRICTED_PROXY)
83 #define CERT_IS_GSI_2_PROXY(cert_type) \
84 (cert_type == CERT_TYPE_GSI_2_PROXY || \
85 cert_type == CERT_TYPE_GSI_2_LIMITED_PROXY)
87 #define CERT_IS_INDEPENDENT_PROXY(cert_type) \
88 (cert_type == CERT_TYPE_RFC_INDEPENDENT_PROXY || \
89 cert_type == CERT_TYPE_GSI_3_INDEPENDENT_PROXY)
91 #define CERT_IS_RESTRICTED_PROXY(cert_type) \
92 (cert_type == CERT_TYPE_RFC_RESTRICTED_PROXY || \
93 cert_type == CERT_TYPE_GSI_3_RESTRICTED_PROXY)
95 #define CERT_IS_LIMITED_PROXY(cert_type) \
96 (cert_type == CERT_TYPE_RFC_LIMITED_PROXY || \
97 cert_type == CERT_TYPE_GSI_3_LIMITED_PROXY || \
98 cert_type == CERT_TYPE_GSI_2_LIMITED_PROXY)
100 #define CERT_IS_IMPERSONATION_PROXY(cert_type) \
101 (cert_type == CERT_TYPE_RFC_IMPERSONATION_PROXY || \
102 cert_type == CERT_TYPE_RFC_LIMITED_PROXY || \
103 cert_type == CERT_TYPE_GSI_3_IMPERSONATION_PROXY || \
104 cert_type == CERT_TYPE_GSI_3_LIMITED_PROXY || \
105 cert_type == CERT_TYPE_GSI_2_PROXY || \
106 cert_type == CERT_TYPE_GSI_2_LIMITED_PROXY)
112 #define VERIFY_CTX_STORE_EX_DATA_IDX 1
116 X509_STORE_CTX * cert_store;
122 STACK_OF(X509) * cert_chain;
125 std::string proxy_policy;
129 bool check_cert_type(X509* cert,
certType& type);
130 const char* certTypeToString(
certType type);
134 #endif // __ARC_CERTUTIL_H__