Closed onalante-msft closed 1 year ago
I wonder if it'd be more appropriate to split at graphemes (
unicode-segmentation
) instead of codepoints.
The specification says the length is measured in "characters", but I assume this means code points: see the bottom of page 124 here. This is not a particularly performance-sensitive code path, so I will just do a .chars().take(64).collect::<String>()
.
String::truncate
panics when the truncation point is not at a valid UTF-8 character boundary. To fix this, take at most 64 characters from the parsed CN string before setting the X509 CN field.