Convert ASN.1 string to a pool-allocated char * string, escaping * control characters. If raw is zero, convert to UTF-8, otherwise * unchanged from the character set. */
| 203 | * control characters. If raw is zero, convert to UTF-8, otherwise |
| 204 | * unchanged from the character set. */ |
| 205 | char *modssl_ASN1_STRING_convert(apr_pool_t *p, const ASN1_STRING *asn1str, int raw) |
| 206 | { |
| 207 | BIO *bio; |
| 208 | int flags = ASN1_STRFLGS_ESC_CTRL; |
| 209 | |
| 210 | if ((bio = BIO_new(BIO_s_mem())) == NULL) |
| 211 | return NULL; |
| 212 | |
| 213 | if (!raw) flags |= ASN1_STRFLGS_UTF8_CONVERT; |
| 214 | |
| 215 | ASN1_STRING_print_ex(bio, asn1str, flags); |
| 216 | |
| 217 | return modssl_bio_free_read(p, bio); |
| 218 | } |
| 219 | |
| 220 | #define asn1_string_to_utf8(p, a) modssl_ASN1_STRING_convert(p, a, 0) |
| 221 |
no test coverage detected