1 /* $NetBSD: name.c,v 1.1.1.2 2014/04/24 12:45:42 pettai Exp $ */
4 * Copyright (c) 2004 - 2009 Kungliga Tekniska Högskolan
5 * (Royal Institute of Technology, Stockholm, Sweden).
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the Institute nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 #include <krb5/wind.h>
41 * @page page_name PKIX/X.509 Names
43 * There are several names in PKIX/X.509, GeneralName and Name.
45 * A Name consists of an ordered list of Relative Distinguished Names
46 * (RDN). Each RDN consists of an unordered list of typed strings. The
47 * types are defined by OID and have long and short description. For
48 * example id-at-commonName (2.5.4.3) have the long name CommonName
49 * and short name CN. The string itself can be of several encoding,
50 * UTF8, UTF16, Teltex string, etc. The type limit what encoding
53 * GeneralName is a broader nametype that can contains al kind of
54 * stuff like Name, IP addresses, partial Name, etc.
56 * Name is mapped into a hx509_name object.
58 * Parse and string name into a hx509_name object with hx509_parse_name(),
59 * make it back into string representation with hx509_name_to_string().
61 * Name string are defined rfc2253, rfc1779 and X.501.
63 * See the library functions here: @ref hx509_name
69 wind_profile_flags flags
;
71 { "C", &asn1_oid_id_at_countryName
, 0 },
72 { "CN", &asn1_oid_id_at_commonName
, 0 },
73 { "DC", &asn1_oid_id_domainComponent
, 0 },
74 { "L", &asn1_oid_id_at_localityName
, 0 },
75 { "O", &asn1_oid_id_at_organizationName
, 0 },
76 { "OU", &asn1_oid_id_at_organizationalUnitName
, 0 },
77 { "S", &asn1_oid_id_at_stateOrProvinceName
, 0 },
78 { "STREET", &asn1_oid_id_at_streetAddress
, 0 },
79 { "UID", &asn1_oid_id_Userid
, 0 },
80 { "emailAddress", &asn1_oid_id_pkcs9_emailAddress
, 0 },
81 { "serialNumber", &asn1_oid_id_at_serialNumber
, 0 }
85 quote_string(const char *f
, size_t len
, int flags
, size_t *rlen
)
88 const unsigned char *from
= (const unsigned char *)f
;
96 for (i
= 0, j
= 0; i
< len
; i
++) {
97 unsigned char map
= char_map
[from
[i
]] & flags
;
98 if (i
== 0 && (map
& Q_RFC2253_QUOTE_FIRST
)) {
101 } else if ((i
+ 1) == len
&& (map
& Q_RFC2253_QUOTE_LAST
)) {
105 } else if (map
& Q_RFC2253_QUOTE
) {
108 } else if (map
& Q_RFC2253_HEX
) {
109 int l
= snprintf((char *)&to
[j
], tolen
- j
- 1,
110 "#%02x", (unsigned char)from
[i
]);
124 append_string(char **str
, size_t *total_len
, const char *ss
,
125 size_t len
, int quote
)
130 qs
= quote_string(ss
, len
, Q_RFC2253
, &len
);
134 s
= realloc(*str
, len
+ *total_len
+ 1);
136 _hx509_abort("allocation failure"); /* XXX */
137 memcpy(s
+ *total_len
, qs
, len
);
140 s
[*total_len
+ len
] = '\0';
147 oidtostring(const heim_oid
*type
)
152 for (i
= 0; i
< sizeof(no
)/sizeof(no
[0]); i
++) {
153 if (der_heim_oid_cmp(no
[i
].o
, type
) == 0)
154 return strdup(no
[i
].n
);
156 if (der_print_heim_oid(type
, '.', &s
) != 0)
162 stringtooid(const char *name
, size_t len
, heim_oid
*oid
)
168 memset(oid
, 0, sizeof(*oid
));
170 for (i
= 0; i
< sizeof(no
)/sizeof(no
[0]); i
++) {
171 if (strncasecmp(no
[i
].n
, name
, len
) == 0)
172 return der_copy_oid(no
[i
].o
, oid
);
177 memcpy(s
, name
, len
);
179 ret
= der_parse_heim_oid(s
, ".", oid
);
185 * Convert the hx509 name object into a printable string.
186 * The resulting string should be freed with free().
188 * @param name name to print
189 * @param str the string to return
191 * @return An hx509 error code, see hx509_get_error_string().
193 * @ingroup hx509_name
197 hx509_name_to_string(const hx509_name name
, char **str
)
199 return _hx509_Name_to_string(&name
->der_name
, str
);
203 _hx509_Name_to_string(const Name
*n
, char **str
)
205 size_t total_len
= 0;
213 for (m
= n
->u
.rdnSequence
.len
; m
> 0; m
--) {
217 for (j
= 0; j
< n
->u
.rdnSequence
.val
[i
].len
; j
++) {
218 DirectoryString
*ds
= &n
->u
.rdnSequence
.val
[i
].val
[j
].value
;
222 oidname
= oidtostring(&n
->u
.rdnSequence
.val
[i
].val
[j
].type
);
224 switch(ds
->element
) {
225 case choice_DirectoryString_ia5String
:
226 ss
= ds
->u
.ia5String
.data
;
227 len
= ds
->u
.ia5String
.length
;
229 case choice_DirectoryString_printableString
:
230 ss
= ds
->u
.printableString
.data
;
231 len
= ds
->u
.printableString
.length
;
233 case choice_DirectoryString_utf8String
:
234 ss
= ds
->u
.utf8String
;
237 case choice_DirectoryString_bmpString
: {
238 const uint16_t *bmp
= ds
->u
.bmpString
.data
;
239 size_t bmplen
= ds
->u
.bmpString
.length
;
242 ret
= wind_ucs2utf8_length(bmp
, bmplen
, &k
);
248 _hx509_abort("allocation failure"); /* XXX */
249 ret
= wind_ucs2utf8(bmp
, bmplen
, ss
, NULL
);
258 case choice_DirectoryString_teletexString
:
259 ss
= ds
->u
.teletexString
;
262 case choice_DirectoryString_universalString
: {
263 const uint32_t *uni
= ds
->u
.universalString
.data
;
264 size_t unilen
= ds
->u
.universalString
.length
;
267 ret
= wind_ucs4utf8_length(uni
, unilen
, &k
);
273 _hx509_abort("allocation failure"); /* XXX */
274 ret
= wind_ucs4utf8(uni
, unilen
, ss
, NULL
);
284 _hx509_abort("unknown directory type: %d", ds
->element
);
287 append_string(str
, &total_len
, oidname
, strlen(oidname
), 0);
289 append_string(str
, &total_len
, "=", 1, 0);
290 append_string(str
, &total_len
, ss
, len
, 1);
291 if (ds
->element
== choice_DirectoryString_bmpString
||
292 ds
->element
== choice_DirectoryString_universalString
)
296 if (j
+ 1 < n
->u
.rdnSequence
.val
[i
].len
)
297 append_string(str
, &total_len
, "+", 1, 0);
301 append_string(str
, &total_len
, ",", 1, 0);
306 #define COPYCHARARRAY(_ds,_el,_l,_n) \
307 (_l) = strlen(_ds->u._el); \
308 (_n) = malloc((_l) * sizeof((_n)[0])); \
311 for (i = 0; i < (_l); i++) \
312 (_n)[i] = _ds->u._el[i]
315 #define COPYVALARRAY(_ds,_el,_l,_n) \
316 (_l) = _ds->u._el.length; \
317 (_n) = malloc((_l) * sizeof((_n)[0])); \
320 for (i = 0; i < (_l); i++) \
321 (_n)[i] = _ds->u._el.data[i]
323 #define COPYVOIDARRAY(_ds,_el,_l,_n) \
324 (_l) = _ds->u._el.length; \
325 (_n) = malloc((_l) * sizeof((_n)[0])); \
328 for (i = 0; i < (_l); i++) \
329 (_n)[i] = ((unsigned char *)_ds->u._el.data)[i]
334 dsstringprep(const DirectoryString
*ds
, uint32_t **rname
, size_t *rlen
)
336 wind_profile_flags flags
;
344 switch(ds
->element
) {
345 case choice_DirectoryString_ia5String
:
346 flags
= WIND_PROFILE_LDAP
;
347 COPYVOIDARRAY(ds
, ia5String
, len
, name
);
349 case choice_DirectoryString_printableString
:
350 flags
= WIND_PROFILE_LDAP
;
351 flags
|= WIND_PROFILE_LDAP_CASE_EXACT_ATTRIBUTE
;
352 COPYVOIDARRAY(ds
, printableString
, len
, name
);
354 case choice_DirectoryString_teletexString
:
355 flags
= WIND_PROFILE_LDAP_CASE
;
356 COPYCHARARRAY(ds
, teletexString
, len
, name
);
358 case choice_DirectoryString_bmpString
:
359 flags
= WIND_PROFILE_LDAP
;
360 COPYVALARRAY(ds
, bmpString
, len
, name
);
362 case choice_DirectoryString_universalString
:
363 flags
= WIND_PROFILE_LDAP
;
364 COPYVALARRAY(ds
, universalString
, len
, name
);
366 case choice_DirectoryString_utf8String
:
367 flags
= WIND_PROFILE_LDAP
;
368 ret
= wind_utf8ucs4_length(ds
->u
.utf8String
, &len
);
371 name
= malloc(len
* sizeof(name
[0]));
374 ret
= wind_utf8ucs4(ds
->u
.utf8String
, name
, &len
);
381 _hx509_abort("unknown directory type: %d", ds
->element
);
385 /* try a couple of times to get the length right, XXX gross */
386 for (i
= 0; i
< 4; i
++) {
388 *rname
= malloc(*rlen
* sizeof((*rname
)[0]));
390 ret
= wind_stringprep(name
, len
, *rname
, rlen
, flags
);
391 if (ret
== WIND_ERR_OVERRUN
) {
411 _hx509_name_ds_cmp(const DirectoryString
*ds1
,
412 const DirectoryString
*ds2
,
415 uint32_t *ds1lp
, *ds2lp
;
416 size_t ds1len
, ds2len
, i
;
419 ret
= dsstringprep(ds1
, &ds1lp
, &ds1len
);
422 ret
= dsstringprep(ds2
, &ds2lp
, &ds2len
);
428 if (ds1len
!= ds2len
)
429 *diff
= ds1len
- ds2len
;
431 for (i
= 0; i
< ds1len
; i
++) {
432 *diff
= ds1lp
[i
] - ds2lp
[i
];
444 _hx509_name_cmp(const Name
*n1
, const Name
*n2
, int *c
)
449 *c
= n1
->u
.rdnSequence
.len
- n2
->u
.rdnSequence
.len
;
453 for (i
= 0 ; i
< n1
->u
.rdnSequence
.len
; i
++) {
454 *c
= n1
->u
.rdnSequence
.val
[i
].len
- n2
->u
.rdnSequence
.val
[i
].len
;
458 for (j
= 0; j
< n1
->u
.rdnSequence
.val
[i
].len
; j
++) {
459 *c
= der_heim_oid_cmp(&n1
->u
.rdnSequence
.val
[i
].val
[j
].type
,
460 &n1
->u
.rdnSequence
.val
[i
].val
[j
].type
);
464 ret
= _hx509_name_ds_cmp(&n1
->u
.rdnSequence
.val
[i
].val
[j
].value
,
465 &n2
->u
.rdnSequence
.val
[i
].val
[j
].value
,
478 * Compare to hx509 name object, useful for sorting.
480 * @param n1 a hx509 name object.
481 * @param n2 a hx509 name object.
483 * @return 0 the objects are the same, returns > 0 is n2 is "larger"
484 * then n2, < 0 if n1 is "smaller" then n2.
486 * @ingroup hx509_name
490 hx509_name_cmp(hx509_name n1
, hx509_name n2
)
493 ret
= _hx509_name_cmp(&n1
->der_name
, &n2
->der_name
, &diff
);
501 _hx509_name_from_Name(const Name
*n
, hx509_name
*name
)
504 *name
= calloc(1, sizeof(**name
));
507 ret
= copy_Name(n
, &(*name
)->der_name
);
516 _hx509_name_modify(hx509_context context
,
522 RelativeDistinguishedName
*rdn
;
526 ptr
= realloc(name
->u
.rdnSequence
.val
,
527 sizeof(name
->u
.rdnSequence
.val
[0]) *
528 (name
->u
.rdnSequence
.len
+ 1));
530 hx509_set_error_string(context
, 0, ENOMEM
, "Out of memory");
533 name
->u
.rdnSequence
.val
= ptr
;
536 rdn
= &name
->u
.rdnSequence
.val
[name
->u
.rdnSequence
.len
];
538 memmove(&name
->u
.rdnSequence
.val
[1],
539 &name
->u
.rdnSequence
.val
[0],
540 name
->u
.rdnSequence
.len
*
541 sizeof(name
->u
.rdnSequence
.val
[0]));
543 rdn
= &name
->u
.rdnSequence
.val
[0];
545 rdn
->val
= malloc(sizeof(rdn
->val
[0]));
546 if (rdn
->val
== NULL
)
549 ret
= der_copy_oid(oid
, &rdn
->val
[0].type
);
552 rdn
->val
[0].value
.element
= choice_DirectoryString_utf8String
;
553 rdn
->val
[0].value
.u
.utf8String
= strdup(str
);
554 if (rdn
->val
[0].value
.u
.utf8String
== NULL
)
556 name
->u
.rdnSequence
.len
+= 1;
562 * Parse a string into a hx509 name object.
564 * @param context A hx509 context.
565 * @param str a string to parse.
566 * @param name the resulting object, NULL in case of error.
568 * @return An hx509 error code, see hx509_get_error_string().
570 * @ingroup hx509_name
574 hx509_parse_name(hx509_context context
, const char *str
, hx509_name
*name
)
583 n
= calloc(1, sizeof(*n
));
585 hx509_set_error_string(context
, 0, ENOMEM
, "out of memory");
589 n
->der_name
.element
= choice_Name_rdnSequence
;
593 while (p
!= NULL
&& *p
!= '\0') {
608 ret
= HX509_PARSING_NAME_FAILED
;
609 hx509_set_error_string(context
, 0, ret
, "missing = in %s", p
);
613 ret
= HX509_PARSING_NAME_FAILED
;
614 hx509_set_error_string(context
, 0, ret
,
615 "missing name before = in %s", p
);
619 if ((size_t)(q
- p
) > len
) {
620 ret
= HX509_PARSING_NAME_FAILED
;
621 hx509_set_error_string(context
, 0, ret
, " = after , in %s", p
);
625 ret
= stringtooid(p
, q
- p
, &oid
);
627 ret
= HX509_PARSING_NAME_FAILED
;
628 hx509_set_error_string(context
, 0, ret
,
629 "unknown type: %.*s", (int)(q
- p
), p
);
634 size_t pstr_len
= len
- (q
- p
) - 1;
635 const char *pstr
= p
+ (q
- p
) + 1;
638 r
= malloc(pstr_len
+ 1);
642 hx509_set_error_string(context
, 0, ret
, "out of memory");
645 memcpy(r
, pstr
, pstr_len
);
648 ret
= _hx509_name_modify(context
, &n
->der_name
, 0, &oid
, r
);
662 return HX509_NAME_MALFORMED
;
666 * Copy a hx509 name object.
668 * @param context A hx509 cotext.
669 * @param from the name to copy from
670 * @param to the name to copy to
672 * @return An hx509 error code, see hx509_get_error_string().
674 * @ingroup hx509_name
678 hx509_name_copy(hx509_context context
, const hx509_name from
, hx509_name
*to
)
682 *to
= calloc(1, sizeof(**to
));
685 ret
= copy_Name(&from
->der_name
, &(*to
)->der_name
);
695 * Convert a hx509_name into a Name.
697 * @param from the name to copy from
698 * @param to the name to copy to
700 * @return An hx509 error code, see hx509_get_error_string().
702 * @ingroup hx509_name
706 hx509_name_to_Name(const hx509_name from
, Name
*to
)
708 return copy_Name(&from
->der_name
, to
);
712 hx509_name_normalize(hx509_context context
, hx509_name name
)
718 * Expands variables in the name using env. Variables are on the form
719 * ${name}. Useful when dealing with certificate templates.
721 * @param context A hx509 cotext.
722 * @param name the name to expand.
723 * @param env environment variable to expand.
725 * @return An hx509 error code, see hx509_get_error_string().
727 * @ingroup hx509_name
731 hx509_name_expand(hx509_context context
,
735 Name
*n
= &name
->der_name
;
741 if (n
->element
!= choice_Name_rdnSequence
) {
742 hx509_set_error_string(context
, 0, EINVAL
, "RDN not of supported type");
746 for (i
= 0 ; i
< n
->u
.rdnSequence
.len
; i
++) {
747 for (j
= 0; j
< n
->u
.rdnSequence
.val
[i
].len
; j
++) {
748 /** Only UTF8String rdnSequence names are allowed */
750 THIS SHOULD REALLY BE:
751 COMP = n->u.rdnSequence.val[i].val[j];
752 normalize COMP to utf8
753 check if there are variables
755 convert back to orignal format, store in COMP
756 free normalized utf8 string
758 DirectoryString
*ds
= &n
->u
.rdnSequence
.val
[i
].val
[j
].value
;
760 struct rk_strpool
*strpool
= NULL
;
762 if (ds
->element
!= choice_DirectoryString_utf8String
) {
763 hx509_set_error_string(context
, 0, EINVAL
, "unsupported type");
766 p
= strstr(ds
->u
.utf8String
, "${");
768 strpool
= rk_strpoolprintf(strpool
, "%.*s",
769 (int)(p
- ds
->u
.utf8String
),
771 if (strpool
== NULL
) {
772 hx509_set_error_string(context
, 0, ENOMEM
, "out of memory");
777 /* expand variables */
781 hx509_set_error_string(context
, 0, EINVAL
, "missing }");
782 rk_strpoolfree(strpool
);
786 value
= hx509_env_lfind(context
, env
, p
, p2
- p
);
788 hx509_set_error_string(context
, 0, EINVAL
,
789 "variable %.*s missing",
791 rk_strpoolfree(strpool
);
794 strpool
= rk_strpoolprintf(strpool
, "%s", value
);
795 if (strpool
== NULL
) {
796 hx509_set_error_string(context
, 0, ENOMEM
, "out of memory");
801 p
= strstr(p2
, "${");
803 strpool
= rk_strpoolprintf(strpool
, "%.*s",
806 strpool
= rk_strpoolprintf(strpool
, "%s", p2
);
807 if (strpool
== NULL
) {
808 hx509_set_error_string(context
, 0, ENOMEM
, "out of memory");
813 free(ds
->u
.utf8String
);
814 ds
->u
.utf8String
= rk_strpoolcollect(strpool
);
815 if (ds
->u
.utf8String
== NULL
) {
816 hx509_set_error_string(context
, 0, ENOMEM
, "out of memory");
826 * Free a hx509 name object, upond return *name will be NULL.
828 * @param name a hx509 name object to be freed.
830 * @ingroup hx509_name
834 hx509_name_free(hx509_name
*name
)
836 free_Name(&(*name
)->der_name
);
837 memset(*name
, 0, sizeof(**name
));
843 * Convert a DER encoded name info a string.
845 * @param data data to a DER/BER encoded name
846 * @param length length of data
847 * @param str the resulting string, is NULL on failure.
849 * @return An hx509 error code, see hx509_get_error_string().
851 * @ingroup hx509_name
855 hx509_unparse_der_name(const void *data
, size_t length
, char **str
)
862 ret
= decode_Name(data
, length
, &name
, NULL
);
865 ret
= _hx509_Name_to_string(&name
, str
);
871 * Convert a hx509_name object to DER encoded name.
873 * @param name name to concert
874 * @param os data to a DER encoded name, free the resulting octet
875 * string with hx509_xfree(os->data).
877 * @return An hx509 error code, see hx509_get_error_string().
879 * @ingroup hx509_name
883 hx509_name_binary(const hx509_name name
, heim_octet_string
*os
)
888 ASN1_MALLOC_ENCODE(Name
, os
->data
, os
->length
, &name
->der_name
, &size
, ret
);
891 if (os
->length
!= size
)
892 _hx509_abort("internal ASN.1 encoder error");
898 _hx509_unparse_Name(const Name
*aname
, char **str
)
903 ret
= _hx509_name_from_Name(aname
, &name
);
907 ret
= hx509_name_to_string(name
, str
);
908 hx509_name_free(&name
);
913 * Unparse the hx509 name in name into a string.
915 * @param name the name to check if its empty/null.
917 * @return non zero if the name is empty/null.
919 * @ingroup hx509_name
923 hx509_name_is_null_p(const hx509_name name
)
925 return name
->der_name
.u
.rdnSequence
.len
== 0;
929 * Unparse the hx509 name in name into a string.
931 * @param name the name to print
932 * @param str an allocated string returns the name in string form
934 * @return An hx509 error code, see hx509_get_error_string().
936 * @ingroup hx509_name
940 hx509_general_name_unparse(GeneralName
*name
, char **str
)
942 struct rk_strpool
*strpool
= NULL
;
946 switch (name
->element
) {
947 case choice_GeneralName_otherName
: {
949 hx509_oid_sprint(&name
->u
.otherName
.type_id
, &oid
);
952 strpool
= rk_strpoolprintf(strpool
, "otherName: %s", oid
);
956 case choice_GeneralName_rfc822Name
:
957 strpool
= rk_strpoolprintf(strpool
, "rfc822Name: %.*s\n",
958 (int)name
->u
.rfc822Name
.length
,
959 (char *)name
->u
.rfc822Name
.data
);
961 case choice_GeneralName_dNSName
:
962 strpool
= rk_strpoolprintf(strpool
, "dNSName: %.*s\n",
963 (int)name
->u
.dNSName
.length
,
964 (char *)name
->u
.dNSName
.data
);
966 case choice_GeneralName_directoryName
: {
970 memset(&dir
, 0, sizeof(dir
));
971 dir
.element
= name
->u
.directoryName
.element
;
972 dir
.u
.rdnSequence
= name
->u
.directoryName
.u
.rdnSequence
;
973 ret
= _hx509_unparse_Name(&dir
, &s
);
976 strpool
= rk_strpoolprintf(strpool
, "directoryName: %s", s
);
980 case choice_GeneralName_uniformResourceIdentifier
:
981 strpool
= rk_strpoolprintf(strpool
, "URI: %.*s",
982 (int)name
->u
.uniformResourceIdentifier
.length
,
983 (char *)name
->u
.uniformResourceIdentifier
.data
);
985 case choice_GeneralName_iPAddress
: {
986 unsigned char *a
= name
->u
.iPAddress
.data
;
988 strpool
= rk_strpoolprintf(strpool
, "IPAddress: ");
991 if (name
->u
.iPAddress
.length
== 4)
992 strpool
= rk_strpoolprintf(strpool
, "%d.%d.%d.%d",
993 a
[0], a
[1], a
[2], a
[3]);
994 else if (name
->u
.iPAddress
.length
== 16)
995 strpool
= rk_strpoolprintf(strpool
,
996 "%02X:%02X:%02X:%02X:"
997 "%02X:%02X:%02X:%02X:"
998 "%02X:%02X:%02X:%02X:"
999 "%02X:%02X:%02X:%02X",
1000 a
[0], a
[1], a
[2], a
[3],
1001 a
[4], a
[5], a
[6], a
[7],
1002 a
[8], a
[9], a
[10], a
[11],
1003 a
[12], a
[13], a
[14], a
[15]);
1005 strpool
= rk_strpoolprintf(strpool
,
1006 "unknown IP address of length %lu",
1007 (unsigned long)name
->u
.iPAddress
.length
);
1010 case choice_GeneralName_registeredID
: {
1012 hx509_oid_sprint(&name
->u
.registeredID
, &oid
);
1015 strpool
= rk_strpoolprintf(strpool
, "registeredID: %s", oid
);
1022 if (strpool
== NULL
)
1025 *str
= rk_strpoolcollect(strpool
);