/src/boringssl/crypto/x509/t_x509a.cc
Line | Count | Source |
1 | | // Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | // you may not use this file except in compliance with the License. |
5 | | // You may obtain a copy of the License at |
6 | | // |
7 | | // https://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software |
10 | | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | // See the License for the specific language governing permissions and |
13 | | // limitations under the License. |
14 | | |
15 | | #include <openssl/asn1.h> |
16 | | #include <openssl/bio.h> |
17 | | #include <openssl/mem.h> |
18 | | #include <openssl/obj.h> |
19 | | #include <openssl/x509.h> |
20 | | |
21 | | #include "internal.h" |
22 | | |
23 | | |
24 | | // X509_CERT_AUX and string set routines |
25 | | |
26 | 2.54k | int X509_CERT_AUX_print(BIO *out, X509_CERT_AUX *aux, int indent) { |
27 | 2.54k | char oidstr[80], first; |
28 | 2.54k | size_t i; |
29 | 2.54k | int j; |
30 | 2.54k | if (!aux) { |
31 | 2.54k | return 1; |
32 | 2.54k | } |
33 | 0 | if (aux->trust) { |
34 | 0 | first = 1; |
35 | 0 | BIO_printf(out, "%*sTrusted Uses:\n%*s", indent, "", indent + 2, ""); |
36 | 0 | for (i = 0; i < sk_ASN1_OBJECT_num(aux->trust); i++) { |
37 | 0 | if (!first) { |
38 | 0 | BIO_puts(out, ", "); |
39 | 0 | } else { |
40 | 0 | first = 0; |
41 | 0 | } |
42 | 0 | OBJ_obj2txt(oidstr, sizeof oidstr, sk_ASN1_OBJECT_value(aux->trust, i), |
43 | 0 | 0); |
44 | 0 | BIO_puts(out, oidstr); |
45 | 0 | } |
46 | 0 | BIO_puts(out, "\n"); |
47 | 0 | } else { |
48 | 0 | BIO_printf(out, "%*sNo Trusted Uses.\n", indent, ""); |
49 | 0 | } |
50 | 0 | if (aux->reject) { |
51 | 0 | first = 1; |
52 | 0 | BIO_printf(out, "%*sRejected Uses:\n%*s", indent, "", indent + 2, ""); |
53 | 0 | for (i = 0; i < sk_ASN1_OBJECT_num(aux->reject); i++) { |
54 | 0 | if (!first) { |
55 | 0 | BIO_puts(out, ", "); |
56 | 0 | } else { |
57 | 0 | first = 0; |
58 | 0 | } |
59 | 0 | OBJ_obj2txt(oidstr, sizeof oidstr, sk_ASN1_OBJECT_value(aux->reject, i), |
60 | 0 | 0); |
61 | 0 | BIO_puts(out, oidstr); |
62 | 0 | } |
63 | 0 | BIO_puts(out, "\n"); |
64 | 0 | } else { |
65 | 0 | BIO_printf(out, "%*sNo Rejected Uses.\n", indent, ""); |
66 | 0 | } |
67 | 0 | if (aux->alias) { |
68 | 0 | BIO_printf(out, "%*sAlias: %.*s\n", indent, "", aux->alias->length, |
69 | 0 | aux->alias->data); |
70 | 0 | } |
71 | 0 | if (aux->keyid) { |
72 | 0 | BIO_printf(out, "%*sKey Id: ", indent, ""); |
73 | 0 | for (j = 0; j < aux->keyid->length; j++) { |
74 | 0 | BIO_printf(out, "%s%02X", j ? ":" : "", aux->keyid->data[j]); |
75 | 0 | } |
76 | 0 | BIO_write(out, "\n", 1); |
77 | 0 | } |
78 | 0 | return 1; |
79 | 2.54k | } |