/** * @ingroup proxypolicy * * Prints the PROXYPOLICY struct using the BIO stream * * @param bp the BIO stream to print to * @param policy the PROXYPOLICY to print * * @return 1 on success, 0 on error */ int PROXYPOLICY_print( BIO * bp, PROXYPOLICY * policy) { STACK_OF(CONF_VALUE) * values = NULL; values = i2v_PROXYPOLICY(PROXYPOLICY_x509v3_ext_meth(), policy, values); X509V3_EXT_val_prn(bp, values, 0, 1); sk_CONF_VALUE_pop_free(values, X509V3_conf_free); return 1; }
int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a) { int v; ASN1_OBJECT *policy_id; const ASN1_INTEGER *serial; const ASN1_GENERALIZEDTIME *gtime; TS_ACCURACY *accuracy; const ASN1_INTEGER *nonce; GENERAL_NAME *tsa_name; if (a == NULL) return 0; /* Print version. */ v = TS_TST_INFO_get_version(a); BIO_printf(bio, "Version: %d\n", v); /* Print policy id. */ BIO_printf(bio, "Policy OID: "); policy_id = TS_TST_INFO_get_policy_id(a); TS_OBJ_print_bio(bio, policy_id); /* Print message imprint. */ TS_MSG_IMPRINT_print_bio(bio, TS_TST_INFO_get_msg_imprint(a)); /* Print serial number. */ BIO_printf(bio, "Serial number: "); serial = TS_TST_INFO_get_serial(a); if (serial == NULL) BIO_printf(bio, "unspecified"); else TS_ASN1_INTEGER_print_bio(bio, serial); BIO_write(bio, "\n", 1); /* Print time stamp. */ BIO_printf(bio, "Time stamp: "); gtime = TS_TST_INFO_get_time(a); ASN1_GENERALIZEDTIME_print(bio, gtime); BIO_write(bio, "\n", 1); /* Print accuracy. */ BIO_printf(bio, "Accuracy: "); accuracy = TS_TST_INFO_get_accuracy(a); if (accuracy == NULL) BIO_printf(bio, "unspecified"); else TS_ACCURACY_print_bio(bio, accuracy); BIO_write(bio, "\n", 1); /* Print ordering. */ BIO_printf(bio, "Ordering: %s\n", TS_TST_INFO_get_ordering(a) ? "yes" : "no"); /* Print nonce. */ BIO_printf(bio, "Nonce: "); nonce = TS_TST_INFO_get_nonce(a); if (nonce == NULL) BIO_printf(bio, "unspecified"); else TS_ASN1_INTEGER_print_bio(bio, nonce); BIO_write(bio, "\n", 1); /* Print TSA name. */ BIO_printf(bio, "TSA: "); tsa_name = TS_TST_INFO_get_tsa(a); if (tsa_name == NULL) BIO_printf(bio, "unspecified"); else { STACK_OF(CONF_VALUE) *nval; if ((nval = i2v_GENERAL_NAME(NULL, tsa_name, NULL))) X509V3_EXT_val_prn(bio, nval, 0, 0); sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); } BIO_write(bio, "\n", 1); /* Print extensions. */ TS_ext_print_bio(bio, TS_TST_INFO_get_exts(a)); return 1; }
int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a) { int v; if (a == NULL) return 0; /* Print version. */ v = ASN1_INTEGER_get(a->version); BIO_printf(bio, "Version: %d\n", v); /* Print policy id. */ BIO_printf(bio, "Policy OID: "); TS_OBJ_print_bio(bio, a->policy_id); /* Print message imprint. */ TS_MSG_IMPRINT_print_bio(bio, a->msg_imprint); /* Print serial number. */ BIO_printf(bio, "Serial number: "); if (a->serial == NULL) BIO_printf(bio, "unspecified"); else TS_ASN1_INTEGER_print_bio(bio, a->serial); BIO_write(bio, "\n", 1); /* Print time stamp. */ BIO_printf(bio, "Time stamp: "); ASN1_GENERALIZEDTIME_print(bio, a->time); BIO_write(bio, "\n", 1); /* Print accuracy. */ BIO_printf(bio, "Accuracy: "); if (a->accuracy == NULL) BIO_printf(bio, "unspecified"); else ts_ACCURACY_print_bio(bio, a->accuracy); BIO_write(bio, "\n", 1); /* Print ordering. */ BIO_printf(bio, "Ordering: %s\n", a->ordering ? "yes" : "no"); /* Print nonce. */ BIO_printf(bio, "Nonce: "); if (a->nonce == NULL) BIO_printf(bio, "unspecified"); else TS_ASN1_INTEGER_print_bio(bio, a->nonce); BIO_write(bio, "\n", 1); /* Print TSA name. */ BIO_printf(bio, "TSA: "); if (a->tsa == NULL) BIO_printf(bio, "unspecified"); else { STACK_OF(CONF_VALUE) *nval; if ((nval = i2v_GENERAL_NAME(NULL, a->tsa, NULL))) X509V3_EXT_val_prn(bio, nval, 0, 0); sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); } BIO_write(bio, "\n", 1); /* Print extensions. */ TS_ext_print_bio(bio, a->extensions); return 1; }