parse_attribute_value_hex_der_encoded() function
Parse a hexstring containing a DER-encoded string.
Syntax
static int parse_attribute_value_hex_der_encoded(const char *s,
size_t len,
unsigned char *data,
size_t data_size,
size_t *data_len,
int *tag);
Arguments
s
A string of \p len bytes hexadecimal digits.
len
Number of bytes to read from \p s.
data
Output buffer of size \p data_size. On success, it contains the payload that's DER-encoded in the input (content without the tag and length). If the DER tag is a string tag, the payload is guaranteed not to contain null bytes.
data_size
Length of the \p data buffer.
data_len
On success, the length of the parsed string. It is guaranteed to be less than #MBEDTLS_X509_MAX_DN_NAME_SIZE.
tag
The ASN.1 tag that the payload in \p data is encoded in.
Return value
0 on success. #MBEDTLS_ERR_X509_INVALID_NAME if \p s does not contain a valid hexstring, or if the decoded hexstring is not valid DER, or if the payload does not fit in \p data, or if the payload is more than #MBEDTLS_X509_MAX_DN_NAME_SIZE bytes, of if \p *tag is an ASN.1 string tag and the payload contains a null byte. #MBEDTLS_ERR_X509_ALLOC_FAILED on low memory.
parse_attribute_value_hex_der_encoded() is called by 1 function and calls 4 functions:
![]()
parse_attribute_value_hex_der_encoded()
parse_attribute_value_hex_der_encoded():
![]()
parse_attribute_value_hex_der_encoded()