2 * Copyright (c) 2004 - 2009 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * @page page_name PKIX/X.509 Names
41 * There are several names in PKIX/X.509, GeneralName and Name.
43 * A Name consists of an ordered list of Relative Distinguished Names
44 * (RDN). Each RDN consists of an unordered list of typed strings. The
45 * types are defined by OID and have long and short description. For
46 * example id-at-commonName (2.5.4.3) have the long name CommonName
47 * and short name CN. The string itself can be of several encoding,
48 * UTF8, UTF16, Teltex string, etc. The type limit what encoding
51 * GeneralName is a broader nametype that can contains al kind of
52 * stuff like Name, IP addresses, partial Name, etc.
54 * Name is mapped into a hx509_name object.
56 * Parse and string name into a hx509_name object with hx509_parse_name(),
57 * make it back into string representation with hx509_name_to_string().
59 * Name string are defined rfc2253, rfc1779 and X.501.
61 * See the library functions here: @ref hx509_name
67 wind_profile_flags flags
;
69 { "C", &asn1_oid_id_at_countryName
, 0 },
70 { "CN", &asn1_oid_id_at_commonName
, 0 },
71 { "DC", &asn1_oid_id_domainComponent
, 0 },
72 { "L", &asn1_oid_id_at_localityName
, 0 },
73 { "O", &asn1_oid_id_at_organizationName
, 0 },
74 { "OU", &asn1_oid_id_at_organizationalUnitName
, 0 },
75 { "S", &asn1_oid_id_at_stateOrProvinceName
, 0 },
76 { "STREET", &asn1_oid_id_at_streetAddress
, 0 },
77 { "UID", &asn1_oid_id_Userid
, 0 },
78 { "emailAddress", &asn1_oid_id_pkcs9_emailAddress
, 0 },
79 { "serialNumber", &asn1_oid_id_at_serialNumber
, 0 }
83 quote_string(const char *f
, size_t len
, int flags
, size_t *rlen
)
86 const unsigned char *from
= (const unsigned char *)f
;
94 for (i
= 0, j
= 0; i
< len
; i
++) {
95 unsigned char map
= char_map
[from
[i
]] & flags
;
96 if (i
== 0 && (map
& Q_RFC2253_QUOTE_FIRST
)) {
99 } else if ((i
+ 1) == len
&& (map
& Q_RFC2253_QUOTE_LAST
)) {
103 } else if (map
& Q_RFC2253_QUOTE
) {
106 } else if (map
& Q_RFC2253_HEX
) {
107 int l
= snprintf((char *)&to
[j
], tolen
- j
- 1,
108 "#%02x", (unsigned char)from
[i
]);
122 append_string(char **str
, size_t *total_len
, const char *ss
,
123 size_t len
, int quote
)
128 qs
= quote_string(ss
, len
, Q_RFC2253
, &len
);
132 s
= realloc(*str
, len
+ *total_len
+ 1);
134 _hx509_abort("allocation failure"); /* XXX */
135 memcpy(s
+ *total_len
, qs
, len
);
138 s
[*total_len
+ len
] = '\0';
145 oidtostring(const heim_oid
*type
)
150 for (i
= 0; i
< sizeof(no
)/sizeof(no
[0]); i
++) {
151 if (der_heim_oid_cmp(no
[i
].o
, type
) == 0)
152 return strdup(no
[i
].n
);
154 if (der_print_heim_oid(type
, '.', &s
) != 0)
160 stringtooid(const char *name
, size_t len
, heim_oid
*oid
)
166 memset(oid
, 0, sizeof(*oid
));
168 for (i
= 0; i
< sizeof(no
)/sizeof(no
[0]); i
++) {
169 if (strncasecmp(no
[i
].n
, name
, len
) == 0)
170 return der_copy_oid(no
[i
].o
, oid
);
175 memcpy(s
, name
, len
);
177 ret
= der_parse_heim_oid(s
, ".", oid
);
183 * Convert the hx509 name object into a printable string.
184 * The resulting string should be freed with free().
186 * @param name name to print
187 * @param str the string to return
189 * @return An hx509 error code, see hx509_get_error_string().
191 * @ingroup hx509_name
195 hx509_name_to_string(const hx509_name name
, char **str
)
197 return _hx509_Name_to_string(&name
->der_name
, str
);
201 _hx509_Name_to_string(const Name
*n
, char **str
)
203 size_t total_len
= 0;
211 for (m
= n
->u
.rdnSequence
.len
; m
> 0; m
--) {
215 for (j
= 0; j
< n
->u
.rdnSequence
.val
[i
].len
; j
++) {
216 DirectoryString
*ds
= &n
->u
.rdnSequence
.val
[i
].val
[j
].value
;
220 oidname
= oidtostring(&n
->u
.rdnSequence
.val
[i
].val
[j
].type
);
222 switch(ds
->element
) {
223 case choice_DirectoryString_ia5String
:
224 ss
= ds
->u
.ia5String
.data
;
225 len
= ds
->u
.ia5String
.length
;
227 case choice_DirectoryString_printableString
:
228 ss
= ds
->u
.printableString
.data
;
229 len
= ds
->u
.printableString
.length
;
231 case choice_DirectoryString_utf8String
:
232 ss
= ds
->u
.utf8String
;
235 case choice_DirectoryString_bmpString
: {
236 const uint16_t *bmp
= ds
->u
.bmpString
.data
;
237 size_t bmplen
= ds
->u
.bmpString
.length
;
240 ret
= wind_ucs2utf8_length(bmp
, bmplen
, &k
);
248 _hx509_abort("allocation failure"); /* XXX */
249 ret
= wind_ucs2utf8(bmp
, bmplen
, ss
, NULL
);
259 case choice_DirectoryString_teletexString
:
260 ss
= ds
->u
.teletexString
;
263 case choice_DirectoryString_universalString
: {
264 const uint32_t *uni
= ds
->u
.universalString
.data
;
265 size_t unilen
= ds
->u
.universalString
.length
;
268 ret
= wind_ucs4utf8_length(uni
, unilen
, &k
);
276 _hx509_abort("allocation failure"); /* XXX */
277 ret
= wind_ucs4utf8(uni
, unilen
, ss
, NULL
);
288 _hx509_abort("unknown directory type: %d", ds
->element
);
291 append_string(str
, &total_len
, oidname
, strlen(oidname
), 0);
293 append_string(str
, &total_len
, "=", 1, 0);
294 append_string(str
, &total_len
, ss
, len
, 1);
295 if (ds
->element
== choice_DirectoryString_bmpString
||
296 ds
->element
== choice_DirectoryString_universalString
)
300 if (j
+ 1 < n
->u
.rdnSequence
.val
[i
].len
)
301 append_string(str
, &total_len
, "+", 1, 0);
305 append_string(str
, &total_len
, ",", 1, 0);
310 #define COPYCHARARRAY(_ds,_el,_l,_n) \
311 (_l) = strlen(_ds->u._el); \
312 (_n) = malloc((_l) * sizeof((_n)[0])); \
315 for (i = 0; i < (_l); i++) \
316 (_n)[i] = _ds->u._el[i]
319 #define COPYVALARRAY(_ds,_el,_l,_n) \
320 (_l) = _ds->u._el.length; \
321 (_n) = malloc((_l) * sizeof((_n)[0])); \
324 for (i = 0; i < (_l); i++) \
325 (_n)[i] = _ds->u._el.data[i]
327 #define COPYVOIDARRAY(_ds,_el,_l,_n) \
328 (_l) = _ds->u._el.length; \
329 (_n) = malloc((_l) * sizeof((_n)[0])); \
332 for (i = 0; i < (_l); i++) \
333 (_n)[i] = ((unsigned char *)_ds->u._el.data)[i]
338 dsstringprep(const DirectoryString
*ds
, uint32_t **rname
, size_t *rlen
)
340 wind_profile_flags flags
;
348 switch(ds
->element
) {
349 case choice_DirectoryString_ia5String
:
350 flags
= WIND_PROFILE_LDAP
;
351 COPYVOIDARRAY(ds
, ia5String
, len
, name
);
353 case choice_DirectoryString_printableString
:
354 flags
= WIND_PROFILE_LDAP
;
355 flags
|= WIND_PROFILE_LDAP_CASE_EXACT_ATTRIBUTE
;
356 COPYVOIDARRAY(ds
, printableString
, len
, name
);
358 case choice_DirectoryString_teletexString
:
359 flags
= WIND_PROFILE_LDAP_CASE
;
360 COPYCHARARRAY(ds
, teletexString
, len
, name
);
362 case choice_DirectoryString_bmpString
:
363 flags
= WIND_PROFILE_LDAP
;
364 COPYVALARRAY(ds
, bmpString
, len
, name
);
366 case choice_DirectoryString_universalString
:
367 flags
= WIND_PROFILE_LDAP
;
368 COPYVALARRAY(ds
, universalString
, len
, name
);
370 case choice_DirectoryString_utf8String
:
371 flags
= WIND_PROFILE_LDAP
;
372 ret
= wind_utf8ucs4_length(ds
->u
.utf8String
, &len
);
375 name
= malloc(len
* sizeof(name
[0]));
378 ret
= wind_utf8ucs4(ds
->u
.utf8String
, name
, &len
);
385 _hx509_abort("unknown directory type: %d", ds
->element
);
389 /* try a couple of times to get the length right, XXX gross */
390 for (i
= 0; i
< 4; i
++) {
392 *rname
= malloc(*rlen
* sizeof((*rname
)[0]));
394 ret
= wind_stringprep(name
, len
, *rname
, rlen
, flags
);
395 if (ret
== WIND_ERR_OVERRUN
) {
415 _hx509_name_ds_cmp(const DirectoryString
*ds1
,
416 const DirectoryString
*ds2
,
419 uint32_t *ds1lp
, *ds2lp
;
420 size_t ds1len
, ds2len
, i
;
423 ret
= dsstringprep(ds1
, &ds1lp
, &ds1len
);
426 ret
= dsstringprep(ds2
, &ds2lp
, &ds2len
);
432 if (ds1len
!= ds2len
)
433 *diff
= ds1len
- ds2len
;
435 for (i
= 0; i
< ds1len
; i
++) {
436 *diff
= ds1lp
[i
] - ds2lp
[i
];
448 _hx509_name_cmp(const Name
*n1
, const Name
*n2
, int *c
)
453 *c
= n1
->u
.rdnSequence
.len
- n2
->u
.rdnSequence
.len
;
457 for (i
= 0 ; i
< n1
->u
.rdnSequence
.len
; i
++) {
458 *c
= n1
->u
.rdnSequence
.val
[i
].len
- n2
->u
.rdnSequence
.val
[i
].len
;
462 for (j
= 0; j
< n1
->u
.rdnSequence
.val
[i
].len
; j
++) {
463 *c
= der_heim_oid_cmp(&n1
->u
.rdnSequence
.val
[i
].val
[j
].type
,
464 &n1
->u
.rdnSequence
.val
[i
].val
[j
].type
);
468 ret
= _hx509_name_ds_cmp(&n1
->u
.rdnSequence
.val
[i
].val
[j
].value
,
469 &n2
->u
.rdnSequence
.val
[i
].val
[j
].value
,
482 * Compare to hx509 name object, useful for sorting.
484 * @param n1 a hx509 name object.
485 * @param n2 a hx509 name object.
487 * @return 0 the objects are the same, returns > 0 is n2 is "larger"
488 * then n2, < 0 if n1 is "smaller" then n2.
490 * @ingroup hx509_name
494 hx509_name_cmp(hx509_name n1
, hx509_name n2
)
497 ret
= _hx509_name_cmp(&n1
->der_name
, &n2
->der_name
, &diff
);
505 _hx509_name_from_Name(const Name
*n
, hx509_name
*name
)
508 *name
= calloc(1, sizeof(**name
));
511 ret
= copy_Name(n
, &(*name
)->der_name
);
520 _hx509_name_modify(hx509_context context
,
526 RelativeDistinguishedName
*rdn
;
530 ptr
= realloc(name
->u
.rdnSequence
.val
,
531 sizeof(name
->u
.rdnSequence
.val
[0]) *
532 (name
->u
.rdnSequence
.len
+ 1));
534 hx509_set_error_string(context
, 0, ENOMEM
, "Out of memory");
537 name
->u
.rdnSequence
.val
= ptr
;
540 rdn
= &name
->u
.rdnSequence
.val
[name
->u
.rdnSequence
.len
];
542 memmove(&name
->u
.rdnSequence
.val
[1],
543 &name
->u
.rdnSequence
.val
[0],
544 name
->u
.rdnSequence
.len
*
545 sizeof(name
->u
.rdnSequence
.val
[0]));
547 rdn
= &name
->u
.rdnSequence
.val
[0];
549 rdn
->val
= malloc(sizeof(rdn
->val
[0]));
550 if (rdn
->val
== NULL
)
553 ret
= der_copy_oid(oid
, &rdn
->val
[0].type
);
556 rdn
->val
[0].value
.element
= choice_DirectoryString_utf8String
;
557 rdn
->val
[0].value
.u
.utf8String
= strdup(str
);
558 if (rdn
->val
[0].value
.u
.utf8String
== NULL
)
560 name
->u
.rdnSequence
.len
+= 1;
566 * Parse a string into a hx509 name object.
568 * @param context A hx509 context.
569 * @param str a string to parse.
570 * @param name the resulting object, NULL in case of error.
572 * @return An hx509 error code, see hx509_get_error_string().
574 * @ingroup hx509_name
578 hx509_parse_name(hx509_context context
, const char *str
, hx509_name
*name
)
587 n
= calloc(1, sizeof(*n
));
589 hx509_set_error_string(context
, 0, ENOMEM
, "out of memory");
593 n
->der_name
.element
= choice_Name_rdnSequence
;
597 while (p
!= NULL
&& *p
!= '\0') {
612 ret
= HX509_PARSING_NAME_FAILED
;
613 hx509_set_error_string(context
, 0, ret
, "missing = in %s", p
);
617 ret
= HX509_PARSING_NAME_FAILED
;
618 hx509_set_error_string(context
, 0, ret
,
619 "missing name before = in %s", p
);
623 if ((size_t)(q
- p
) > len
) {
624 ret
= HX509_PARSING_NAME_FAILED
;
625 hx509_set_error_string(context
, 0, ret
, " = after , in %s", p
);
629 ret
= stringtooid(p
, q
- p
, &oid
);
631 ret
= HX509_PARSING_NAME_FAILED
;
632 hx509_set_error_string(context
, 0, ret
,
633 "unknown type: %.*s", (int)(q
- p
), p
);
638 size_t pstr_len
= len
- (q
- p
) - 1;
639 const char *pstr
= p
+ (q
- p
) + 1;
642 r
= malloc(pstr_len
+ 1);
646 hx509_set_error_string(context
, 0, ret
, "out of memory");
649 memcpy(r
, pstr
, pstr_len
);
652 ret
= _hx509_name_modify(context
, &n
->der_name
, 0, &oid
, r
);
666 return HX509_NAME_MALFORMED
;
670 * Copy a hx509 name object.
672 * @param context A hx509 cotext.
673 * @param from the name to copy from
674 * @param to the name to copy to
676 * @return An hx509 error code, see hx509_get_error_string().
678 * @ingroup hx509_name
682 hx509_name_copy(hx509_context context
, const hx509_name from
, hx509_name
*to
)
686 *to
= calloc(1, sizeof(**to
));
689 ret
= copy_Name(&from
->der_name
, &(*to
)->der_name
);
699 * Convert a hx509_name into a Name.
701 * @param from the name to copy from
702 * @param to the name to copy to
704 * @return An hx509 error code, see hx509_get_error_string().
706 * @ingroup hx509_name
710 hx509_name_to_Name(const hx509_name from
, Name
*to
)
712 return copy_Name(&from
->der_name
, to
);
716 hx509_name_normalize(hx509_context context
, hx509_name name
)
722 * Expands variables in the name using env. Variables are on the form
723 * ${name}. Useful when dealing with certificate templates.
725 * @param context A hx509 cotext.
726 * @param name the name to expand.
727 * @param env environment variable to expand.
729 * @return An hx509 error code, see hx509_get_error_string().
731 * @ingroup hx509_name
735 hx509_name_expand(hx509_context context
,
739 Name
*n
= &name
->der_name
;
745 if (n
->element
!= choice_Name_rdnSequence
) {
746 hx509_set_error_string(context
, 0, EINVAL
, "RDN not of supported type");
750 for (i
= 0 ; i
< n
->u
.rdnSequence
.len
; i
++) {
751 for (j
= 0; j
< n
->u
.rdnSequence
.val
[i
].len
; j
++) {
752 /** Only UTF8String rdnSequence names are allowed */
754 THIS SHOULD REALLY BE:
755 COMP = n->u.rdnSequence.val[i].val[j];
756 normalize COMP to utf8
757 check if there are variables
759 convert back to orignal format, store in COMP
760 free normalized utf8 string
762 DirectoryString
*ds
= &n
->u
.rdnSequence
.val
[i
].val
[j
].value
;
764 struct rk_strpool
*strpool
= NULL
;
766 if (ds
->element
!= choice_DirectoryString_utf8String
) {
767 hx509_set_error_string(context
, 0, EINVAL
, "unsupported type");
770 p
= strstr(ds
->u
.utf8String
, "${");
772 strpool
= rk_strpoolprintf(strpool
, "%.*s",
773 (int)(p
- ds
->u
.utf8String
),
775 if (strpool
== NULL
) {
776 hx509_set_error_string(context
, 0, ENOMEM
, "out of memory");
781 /* expand variables */
785 hx509_set_error_string(context
, 0, EINVAL
, "missing }");
786 rk_strpoolfree(strpool
);
790 value
= hx509_env_lfind(context
, env
, p
, p2
- p
);
792 hx509_set_error_string(context
, 0, EINVAL
,
793 "variable %.*s missing",
795 rk_strpoolfree(strpool
);
798 strpool
= rk_strpoolprintf(strpool
, "%s", value
);
799 if (strpool
== NULL
) {
800 hx509_set_error_string(context
, 0, ENOMEM
, "out of memory");
805 p
= strstr(p2
, "${");
807 strpool
= rk_strpoolprintf(strpool
, "%.*s",
810 strpool
= rk_strpoolprintf(strpool
, "%s", p2
);
811 if (strpool
== NULL
) {
812 hx509_set_error_string(context
, 0, ENOMEM
, "out of memory");
817 free(ds
->u
.utf8String
);
818 ds
->u
.utf8String
= rk_strpoolcollect(strpool
);
819 if (ds
->u
.utf8String
== NULL
) {
820 hx509_set_error_string(context
, 0, ENOMEM
, "out of memory");
830 * Free a hx509 name object, upond return *name will be NULL.
832 * @param name a hx509 name object to be freed.
834 * @ingroup hx509_name
838 hx509_name_free(hx509_name
*name
)
840 free_Name(&(*name
)->der_name
);
841 memset(*name
, 0, sizeof(**name
));
847 * Convert a DER encoded name info a string.
849 * @param data data to a DER/BER encoded name
850 * @param length length of data
851 * @param str the resulting string, is NULL on failure.
853 * @return An hx509 error code, see hx509_get_error_string().
855 * @ingroup hx509_name
859 hx509_unparse_der_name(const void *data
, size_t length
, char **str
)
866 ret
= decode_Name(data
, length
, &name
, NULL
);
869 ret
= _hx509_Name_to_string(&name
, str
);
875 * Convert a hx509_name object to DER encoded name.
877 * @param name name to concert
878 * @param os data to a DER encoded name, free the resulting octet
879 * string with hx509_xfree(os->data).
881 * @return An hx509 error code, see hx509_get_error_string().
883 * @ingroup hx509_name
887 hx509_name_binary(const hx509_name name
, heim_octet_string
*os
)
892 ASN1_MALLOC_ENCODE(Name
, os
->data
, os
->length
, &name
->der_name
, &size
, ret
);
895 if (os
->length
!= size
)
896 _hx509_abort("internal ASN.1 encoder error");
902 _hx509_unparse_Name(const Name
*aname
, char **str
)
907 ret
= _hx509_name_from_Name(aname
, &name
);
911 ret
= hx509_name_to_string(name
, str
);
912 hx509_name_free(&name
);
917 * Unparse the hx509 name in name into a string.
919 * @param name the name to check if its empty/null.
921 * @return non zero if the name is empty/null.
923 * @ingroup hx509_name
927 hx509_name_is_null_p(const hx509_name name
)
929 return name
->der_name
.u
.rdnSequence
.len
== 0;
933 * Unparse the hx509 name in name into a string.
935 * @param name the name to print
936 * @param str an allocated string returns the name in string form
938 * @return An hx509 error code, see hx509_get_error_string().
940 * @ingroup hx509_name
944 hx509_general_name_unparse(GeneralName
*name
, char **str
)
946 struct rk_strpool
*strpool
= NULL
;
950 switch (name
->element
) {
951 case choice_GeneralName_otherName
: {
953 hx509_oid_sprint(&name
->u
.otherName
.type_id
, &oid
);
956 strpool
= rk_strpoolprintf(strpool
, "otherName: %s", oid
);
960 case choice_GeneralName_rfc822Name
:
961 strpool
= rk_strpoolprintf(strpool
, "rfc822Name: %.*s\n",
962 (int)name
->u
.rfc822Name
.length
,
963 (char *)name
->u
.rfc822Name
.data
);
965 case choice_GeneralName_dNSName
:
966 strpool
= rk_strpoolprintf(strpool
, "dNSName: %.*s\n",
967 (int)name
->u
.dNSName
.length
,
968 (char *)name
->u
.dNSName
.data
);
970 case choice_GeneralName_directoryName
: {
974 memset(&dir
, 0, sizeof(dir
));
975 dir
.element
= (enum Name_enum
)name
->u
.directoryName
.element
;
976 dir
.u
.rdnSequence
= name
->u
.directoryName
.u
.rdnSequence
;
977 ret
= _hx509_unparse_Name(&dir
, &s
);
980 strpool
= rk_strpoolprintf(strpool
, "directoryName: %s", s
);
984 case choice_GeneralName_uniformResourceIdentifier
:
985 strpool
= rk_strpoolprintf(strpool
, "URI: %.*s",
986 (int)name
->u
.uniformResourceIdentifier
.length
,
987 (char *)name
->u
.uniformResourceIdentifier
.data
);
989 case choice_GeneralName_iPAddress
: {
990 unsigned char *a
= name
->u
.iPAddress
.data
;
992 strpool
= rk_strpoolprintf(strpool
, "IPAddress: ");
995 if (name
->u
.iPAddress
.length
== 4)
996 strpool
= rk_strpoolprintf(strpool
, "%d.%d.%d.%d",
997 a
[0], a
[1], a
[2], a
[3]);
998 else if (name
->u
.iPAddress
.length
== 16)
999 strpool
= rk_strpoolprintf(strpool
,
1000 "%02X:%02X:%02X:%02X:"
1001 "%02X:%02X:%02X:%02X:"
1002 "%02X:%02X:%02X:%02X:"
1003 "%02X:%02X:%02X:%02X",
1004 a
[0], a
[1], a
[2], a
[3],
1005 a
[4], a
[5], a
[6], a
[7],
1006 a
[8], a
[9], a
[10], a
[11],
1007 a
[12], a
[13], a
[14], a
[15]);
1009 strpool
= rk_strpoolprintf(strpool
,
1010 "unknown IP address of length %lu",
1011 (unsigned long)name
->u
.iPAddress
.length
);
1014 case choice_GeneralName_registeredID
: {
1016 hx509_oid_sprint(&name
->u
.registeredID
, &oid
);
1019 strpool
= rk_strpoolprintf(strpool
, "registeredID: %s", oid
);
1026 if (strpool
== NULL
)
1029 *str
= rk_strpoolcollect(strpool
);