Sam Lang
|
|||||
|
Creates an ASN1_METHOD structure, which contains pointers to routines that convert any PROXYPOLICY structure to its associated ASN1 DER encoded form and vice-versa.
Definition at line 40 of file proxypolicy.c. References d2i_PROXYPOLICY(), i2d_PROXYPOLICY(), PROXYPOLICY_free(), and PROXYPOLICY_new().
00041 {
00042 static ASN1_METHOD proxypolicy_asn1_meth =
00043 {
00044 (int (*)()) i2d_PROXYPOLICY,
00045 (char *(*)()) d2i_PROXYPOLICY,
00046 (char *(*)()) PROXYPOLICY_new,
00047 (void (*)()) PROXYPOLICY_free
00048 };
00049 return (&proxypolicy_asn1_meth);
00050 }
|
|
|||||
|
Allocates and initializes a new PROXYPOLICY structure.
Definition at line 65 of file proxypolicy.c. References ASN1_F_PROXYPOLICY_NEW, IMPERSONATION_PROXY_SN, PROXYPOLICY_st::policy, PROXYPOLICY_st::policy_language, and PROXYPOLICY. Referenced by d2i_PROXYPOLICY(), PROXYCERTINFO_new(), PROXYPOLICY_asn1_meth(), and PROXYPOLICY_x509v3_ext_meth().
00066 {
00067 ASN1_CTX c;
00068 PROXYPOLICY * ret;
00069
00070 ret = NULL;
00071
00072 M_ASN1_New_Malloc(ret, PROXYPOLICY);
00073 ret->policy_language = OBJ_nid2obj(OBJ_sn2nid(IMPERSONATION_PROXY_SN));
00074 ret->policy = NULL;
00075 return (ret);
00076 M_ASN1_New_Error(ASN1_F_PROXYPOLICY_NEW);
00077 }
|
|
|||||||
|
Frees a PROXYPOLICY
Definition at line 93 of file proxypolicy.c. References PROXYPOLICY_st::policy, PROXYPOLICY_st::policy_language, and PROXYPOLICY. Referenced by d2i_PROXYPOLICY(), PROXYPOLICY_asn1_meth(), and PROXYPOLICY_x509v3_ext_meth().
00095 {
00096 if(policy == NULL) return;
00097 ASN1_OBJECT_free(policy->policy_language);
00098 M_ASN1_OCTET_STRING_free(policy->policy);
00099 OPENSSL_free(policy);
00100 }
|
|
|||||||
|
Makes a copy of the proxypolicy - this function allocates space for a new PROXYPOLICY, so the returned PROXYPOLICY must be freed when its no longer needed
Definition at line 121 of file proxypolicy.c. References d2i_PROXYPOLICY(), i2d_PROXYPOLICY(), and PROXYPOLICY. Referenced by PROXYCERTINFO_set_policy().
00123 {
00124 return ((PROXYPOLICY *) ASN1_dup((int (*)())i2d_PROXYPOLICY,
00125 (char *(*)())d2i_PROXYPOLICY,
00126 (char *)policy));
00127 }
|
|
|||||||||
|
Compares two PROXYPOLICY structs for equality This function first compares the policy language numeric id's, if they're equal, it then compares the two policies.
Definition at line 145 of file proxypolicy.c. References PROXYPOLICY_st::policy, PROXYPOLICY_st::policy_language, and PROXYPOLICY. Referenced by PROXYCERTINFO_cmp().
00148 {
00149
00150 if((a->policy_language->nid != b->policy_language->nid) ||
00151 ASN1_STRING_cmp((ASN1_STRING *)a->policy, (ASN1_STRING *)b->policy))
00152 {
00153 return 1;
00154 }
00155 return 0;
00156 }
|
|
|||||||||
|
Prints the PROXYPOLICY struct using the BIO stream
Definition at line 174 of file proxypolicy.c. References PROXYPOLICY, PROXYPOLICY_x509v3_ext_meth(), and STACK_OF(). Referenced by PROXYPOLICY_print_fp().
00177 {
00178 STACK_OF(CONF_VALUE) * values = NULL;
00179
00180 values = i2v_PROXYPOLICY(PROXYPOLICY_x509v3_ext_meth(),
00181 policy,
00182 values);
00183
00184 X509V3_EXT_val_prn(bp, values, 0, 1);
00185
00186 sk_CONF_VALUE_pop_free(values, X509V3_conf_free);
00187 return 1;
00188 }
|
|
|||||||||
|
Prints the PROXYPOLICY to the file stream FILE*
Definition at line 206 of file proxypolicy.c. References PROXYPOLICY, and PROXYPOLICY_print().
00209 {
00210 int ret;
00211
00212 BIO * bp = BIO_new(BIO_s_file());
00213 BIO_set_fp(bp, fp, BIO_NOCLOSE);
00214 ret = PROXYPOLICY_print(bp, policy);
00215 BIO_free(bp);
00216
00217 return (ret);
00218 }
|
|
|||||||||
|
Sets the policy language of the PROXYPOLICY
Definition at line 236 of file proxypolicy.c. References PROXYPOLICY_st::policy_language, and PROXYPOLICY.
00239 {
00240 if(policy_language != NULL)
00241 {
00242 ASN1_OBJECT_free(policy->policy_language);
00243 policy->policy_language = OBJ_dup(policy_language);
00244 return 1;
00245 }
00246 return 0;
00247 }
|
|
|||||||
|
Gets the policy language of the PROXYPOLICY
Definition at line 264 of file proxypolicy.c. References PROXYPOLICY_st::policy_language, and PROXYPOLICY. Referenced by STACK_OF().
00266 {
00267 return policy->policy_language;
00268 }
|
|
||||||||||||
|
Sets the policy of the PROXYPOLICY
Definition at line 286 of file proxypolicy.c. References PROXYPOLICY_st::policy, and PROXYPOLICY.
00290 {
00291 if(policy != NULL)
00292 {
00293 unsigned char * copy = malloc(length);
00294 memcpy(copy, policy, length);
00295
00296 if(!proxypolicy->policy)
00297 {
00298 proxypolicy->policy = ASN1_OCTET_STRING_new();
00299 }
00300
00301 ASN1_OCTET_STRING_set(proxypolicy->policy, copy, length);
00302
00303 }
00304 else
00305 {
00306 if(proxypolicy->policy)
00307 {
00308 ASN1_OCTET_STRING_free(proxypolicy->policy);
00309 }
00310 }
00311
00312 return 1;
00313 }
|
|
|||||||||
|
Gets the policy of a PROXYPOLICY
Definition at line 332 of file proxypolicy.c. References PROXYPOLICY_st::policy, and PROXYPOLICY. Referenced by STACK_OF().
00335 {
00336 if(policy->policy)
00337 {
00338 (*length) = policy->policy->length;
00339 if(*length > 0 && policy->policy->data)
00340 {
00341 unsigned char * copy = malloc(*length);
00342 memcpy(copy, policy->policy->data, *length);
00343 return copy;
00344 }
00345 }
00346
00347 return NULL;
00348 }
|
|
|||||||||
|
Converts a PROXYPOLICY from its internal structure to a DER encoded form
Definition at line 367 of file proxypolicy.c. References PROXYPOLICY_st::policy, PROXYPOLICY_st::policy_language, and PROXYPOLICY. Referenced by i2d_PROXYCERTINFO(), i2d_PROXYCERTINFO_OLD(), PROXYPOLICY_asn1_meth(), PROXYPOLICY_dup(), and PROXYPOLICY_x509v3_ext_meth().
00370 {
00371 M_ASN1_I2D_vars(a);
00372
00373 M_ASN1_I2D_len(a->policy_language, i2d_ASN1_OBJECT);
00374
00375 if(a->policy)
00376 {
00377 M_ASN1_I2D_len(a->policy, i2d_ASN1_OCTET_STRING);
00378 }
00379
00380 M_ASN1_I2D_seq_total();
00381 M_ASN1_I2D_put(a->policy_language, i2d_ASN1_OBJECT);
00382 if(a->policy)
00383 {
00384 M_ASN1_I2D_put(a->policy, i2d_ASN1_OCTET_STRING);
00385 }
00386 M_ASN1_I2D_finish();
00387 }
|
|
||||||||||||
|
Converts the PROXYPOLICY from its DER encoded form to an internal PROXYPOLICY structure
Definition at line 409 of file proxypolicy.c. References ASN1_F_D2I_PROXYPOLICY, PROXYPOLICY, PROXYPOLICY_free(), and PROXYPOLICY_new(). Referenced by d2i_PROXYCERTINFO(), d2i_PROXYCERTINFO_OLD(), PROXYPOLICY_asn1_meth(), PROXYPOLICY_dup(), and PROXYPOLICY_x509v3_ext_meth().
00413 {
00414 M_ASN1_D2I_vars(a, PROXYPOLICY *, PROXYPOLICY_new);
00415
00416 M_ASN1_D2I_Init();
00417 M_ASN1_D2I_start_sequence();
00418 M_ASN1_D2I_get(ret->policy_language, d2i_ASN1_OBJECT);
00419
00420 /* need to try getting the policy using
00421 * a) a call expecting no tags
00422 * b) a call expecting tags
00423 * one of which should succeed
00424 */
00425
00426 M_ASN1_D2I_get_opt(ret->policy,
00427 d2i_ASN1_OCTET_STRING,
00428 V_ASN1_OCTET_STRING);
00429
00430 M_ASN1_D2I_get_IMP_opt(ret->policy,
00431 d2i_ASN1_OCTET_STRING,
00432 0,
00433 V_ASN1_OCTET_STRING);
00434
00435 M_ASN1_D2I_Finish(a,
00436 PROXYPOLICY_free,
00437 ASN1_F_D2I_PROXYPOLICY);
00438 }
|
about globus |
grid research |
globus toolkit |
software development
Comments? webmaster@globus.org