| 1 |
// Copyright (C) 1995-1998 Eric Young ([email protected]) All rights reserved. |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
#include <openssl/asn1.h> |
| 5 |
#include <openssl/bio.h> |
| 6 |
#include <openssl/mem.h> |
| 7 |
#include <openssl/obj.h> |
| 8 |
#include <openssl/x509.h> |
| 9 |
|
| 10 |
#include "internal.h" |
| 11 |
|
| 12 |
|
| 13 |
// X509_CERT_AUX and string set routines |
| 14 |
|
| 15 |
int X509_CERT_AUX_print(BIO *out, X509_CERT_AUX *aux, int indent) { |
| 16 |
char oidstr[80], first; |
| 17 |
size_t i; |
| 18 |
int j; |
| 19 |
if (!aux) { |
| 20 |
return 1; |
| 21 |
} |
| 22 |
if (aux->trust) { |
| 23 |
first = 1; |
| 24 |
BIO_printf(out, "%*sTrusted Uses:\n%*s", indent, "", indent + 2, ""); |
| 25 |
for (i = 0; i < sk_ASN1_OBJECT_num(aux->trust); i++) { |
| 26 |
if (!first) { |
| 27 |
BIO_puts(out, ", "); |
| 28 |
} else { |
| 29 |
first = 0; |
| 30 |
} |
| 31 |
OBJ_obj2txt(oidstr, sizeof oidstr, sk_ASN1_OBJECT_value(aux->trust, i), |
| 32 |
0); |
| 33 |
BIO_puts(out, oidstr); |
| 34 |
} |
| 35 |
BIO_puts(out, "\n"); |
| 36 |
} else { |
| 37 |
BIO_printf(out, "%*sNo Trusted Uses.\n", indent, ""); |
| 38 |
} |
| 39 |
if (aux->reject) { |
| 40 |
first = 1; |
| 41 |
BIO_printf(out, "%*sRejected Uses:\n%*s", indent, "", indent + 2, ""); |
| 42 |
for (i = 0; i < sk_ASN1_OBJECT_num(aux->reject); i++) { |
| 43 |
if (!first) { |
| 44 |
BIO_puts(out, ", "); |
| 45 |
} else { |
| 46 |
first = 0; |
| 47 |
} |
| 48 |
OBJ_obj2txt(oidstr, sizeof oidstr, sk_ASN1_OBJECT_value(aux->reject, i), |
| 49 |
0); |
| 50 |
BIO_puts(out, oidstr); |
| 51 |
} |
| 52 |
BIO_puts(out, "\n"); |
| 53 |
} else { |
| 54 |
BIO_printf(out, "%*sNo Rejected Uses.\n", indent, ""); |
| 55 |
} |
| 56 |
if (aux->alias) { |
| 57 |
BIO_printf(out, "%*sAlias: %.*s\n", indent, "", aux->alias->length, |
| 58 |
aux->alias->data); |
| 59 |
} |
| 60 |
if (aux->keyid) { |
| 61 |
BIO_printf(out, "%*sKey Id: ", indent, ""); |
| 62 |
for (j = 0; j < aux->keyid->length; j++) { |
| 63 |
BIO_printf(out, "%s%02X", j ? ":" : "", aux->keyid->data[j]); |
| 64 |
} |
| 65 |
BIO_write(out, "\n", 1); |
| 66 |
} |
| 67 |
return 1; |
| 68 |
} |