Back to index

nordugrid-arc-nox  1.1.0~rc6
Proxycertinfo.h
Go to the documentation of this file.
00001 
00012 #ifndef ARC_PROXYCERTINFO_H
00013 #define ARC_PROXYCERTINFO_H
00014 
00015 #include <openssl/x509.h>
00016 #include <openssl/x509v3.h>
00017 #include <string>
00018 
00019 namespace ArcCredential {
00020 /* predefined policy language */
00021 #define ANYLANGUAGE_PROXY_OID         "1.3.6.1.5.5.7.21.0"
00022 #define ANYLANGUAGE_PROXY_SN          "ANYLANGUAGE_PROXY"      //"anyLanguage" in openssl >= 098
00023 #define ANYLANGUAGE_PROXY_LN          "anyLanguage proxy"
00024 
00025 #define IMPERSONATION_PROXY_OID         "1.3.6.1.5.5.7.21.1"
00026 #define IMPERSONATION_PROXY_SN          "IMPERSONATION_PROXY"  //"inheritAll" in openssl >= 098
00027 #define IMPERSONATION_PROXY_LN          "GSI impersonation proxy"  
00028 
00029 #define INDEPENDENT_PROXY_OID           "1.3.6.1.5.5.7.21.2"
00030 #define INDEPENDENT_PROXY_SN            "INDEPENDENT_PROXY"    //"independent" in openssl >=098
00031 #define INDEPENDENT_PROXY_LN            "GSI independent proxy"
00032 
00033 /* generic policy language */
00034 #define GLOBUS_GSI_PROXY_GENERIC_POLICY_OID "1.3.6.1.4.1.3536.1.1.1.8"
00035 
00036 #define LIMITED_PROXY_OID               "1.3.6.1.4.1.3536.1.1.1.9"
00037 #define LIMITED_PROXY_SN                "LIMITED_PROXY"
00038 #define LIMITED_PROXY_LN                "GSI limited proxy"
00039 
00040 /* error handling */
00041 #define ASN1_F_PROXYPOLICY_NEW          450
00042 #define ASN1_F_D2I_PROXYPOLICY          451
00043 #define ASN1_F_PROXYCERTINFO_NEW        430
00044 #define ASN1_F_D2I_PROXYCERTINFO        431
00045 
00046 /* Error codes for the X509V3 functions. */
00047 /* Function codes. */
00048 #define X509V3_F_PROCESS_PCI_VALUE                150
00049 #define X509V3_F_R2I_PCI                          155
00050 
00051 /* Reason Code */
00052 #define X509V3_R_INVALID_PROXY_POLICY_SETTING            153
00053 #define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED   154
00054 #define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159
00055 
00056 /* data structure */
00057 
00058 typedef struct PROXYPOLICY_st {
00059     ASN1_OBJECT *                       policy_language;
00060     ASN1_OCTET_STRING *                 policy;
00061 } PROXYPOLICY;
00062 
00063 typedef struct PROXYCERTINFO_st {
00064   ASN1_INTEGER * path_length;
00065   PROXYPOLICY * proxypolicy;
00066   int version;
00067 } PROXYCERTINFO;
00068 
00069 
00070 /* PROXYPOLICY function */
00071 
00072 /* allocating and free memory */
00073 PROXYPOLICY * PROXYPOLICY_new();
00074 void PROXYPOLICY_free(PROXYPOLICY * proxypolicy);
00075 
00076 /* duplicate */
00077 PROXYPOLICY * PROXYPOLICY_dup(PROXYPOLICY * policy);
00078 
00079 /* set policy language */
00080 int PROXYPOLICY_set_policy_language(PROXYPOLICY * policy, ASN1_OBJECT * policy_language);
00081 
00082 /* Returns newly allocated policy language object copied from policy */
00083 ASN1_OBJECT * PROXYPOLICY_get_policy_language(PROXYPOLICY * policy);
00084 
00085 /* set policy contents */
00086 int PROXYPOLICY_set_policy(PROXYPOLICY * proxypolicy, unsigned char * policy, int length);
00087 
00088 /* get policy contents */
00089 unsigned char * PROXYPOLICY_get_policy(PROXYPOLICY * policy, int * length);
00090 
00091 /* internal to der conversion */
00092 int i2d_PROXYPOLICY(PROXYPOLICY * policy, unsigned char ** pp);
00093 
00094 /* der to internal conversion */
00095 PROXYPOLICY * d2i_PROXYPOLICY(PROXYPOLICY ** policy, unsigned char ** pp, long length);
00096 
00097 X509V3_EXT_METHOD * PROXYPOLICY_x509v3_ext_meth();
00098 
00099 STACK_OF(CONF_VALUE) * i2v_PROXYPOLICY(struct v3_ext_method * method, PROXYPOLICY * ext, STACK_OF(CONF_VALUE) * extlist);
00100 
00101 /*PROXYCERTINFO function */
00102 
00103 /* allocating and free memory */
00104 PROXYCERTINFO * PROXYCERTINFO_new();
00105 void PROXYCERTINFO_free(PROXYCERTINFO * proxycertinfo);
00106 
00107 /* duplicate */
00108 PROXYCERTINFO * PROXYCERTINFO_dup(PROXYCERTINFO * proxycertinfo);
00109 
00110 int PROXYCERTINFO_print_fp(FILE* fp, PROXYCERTINFO* cert_info);
00111 
00112 /* set path_length */
00113 int PROXYCERTINFO_set_path_length(PROXYCERTINFO * proxycertinfo, long path_length);
00114 
00115 /* get ptah length */
00116 long PROXYCERTINFO_get_path_length(PROXYCERTINFO * proxycertinfo);
00117 
00118 /* set proxypolicy */
00119 int PROXYCERTINFO_set_proxypolicy(PROXYCERTINFO * proxycertinfo, PROXYPOLICY * proxypolicy);
00120 
00121 /* get proxypolicy */
00122 PROXYPOLICY * PROXYCERTINFO_get_proxypolicy(PROXYCERTINFO * proxycertinfo);
00123 
00124 /* internal to der conversion */
00125 int i2d_PROXYCERTINFO(PROXYCERTINFO * proxycertinfo, unsigned char ** pp);
00126 
00127 /* der to internal conversion */
00128 PROXYCERTINFO * d2i_PROXYCERTINFO(PROXYCERTINFO ** cert_info, unsigned char ** a, long length);
00129 
00130 int PROXYCERTINFO_set_version(PROXYCERTINFO *cert_info, int version);
00131 
00132 STACK_OF(CONF_VALUE) * i2v_PROXYCERTINFO(
00133     struct v3_ext_method *              method,
00134     PROXYCERTINFO *                     ext,
00135     STACK_OF(CONF_VALUE) *              extlist);
00136 
00137 int i2r_PROXYCERTINFO(X509V3_EXT_METHOD *method, PROXYCERTINFO *ext, BIO *out, int indent);
00138 
00139 PROXYCERTINFO *r2i_PROXYCERTINFO(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *value);
00140 
00141 X509V3_EXT_METHOD * PROXYCERTINFO_v3_x509v3_ext_meth();
00142 
00143 X509V3_EXT_METHOD * PROXYCERTINFO_v4_x509v3_ext_meth();
00144 
00145 } //namespace ArcCredential
00146 
00147 #endif