Adapt the code to support SAN types: uniformResourceIdentifier, dNSName and IPAddress
According to documentation OPCUA requires: uniformResourceIdentifier, dNSName and IPAddress https://reference.opcfoundation.org/Core/Part6/v105/docs/6.2 Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
6b108606fa
commit
18904acc93
1 changed files with 19 additions and 10 deletions
|
@ -128,16 +128,25 @@ int mbedtls_x509write_csr_set_subject_alternative_name(mbedtls_x509write_csr *ct
|
|||
cur = san_list;
|
||||
len = 0;
|
||||
while (cur != NULL) {
|
||||
MBEDTLS_ASN1_CHK_ADD(len,
|
||||
mbedtls_asn1_write_raw_buffer(&p, buf,
|
||||
(const unsigned char *) cur->node.name,
|
||||
cur->node.len));
|
||||
MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(&p, buf, cur->node.len));
|
||||
MBEDTLS_ASN1_CHK_ADD(len,
|
||||
mbedtls_asn1_write_tag(&p, buf,
|
||||
MBEDTLS_ASN1_CONTEXT_SPECIFIC |
|
||||
cur->node.type));
|
||||
|
||||
switch (cur->node.type) {
|
||||
case MBEDTLS_X509_SAN_DNS_NAME:
|
||||
case MBEDTLS_X509_SAN_UNIFORM_RESOURCE_IDENTIFIER:
|
||||
case MBEDTLS_X509_SAN_IP_ADDRESS:
|
||||
MBEDTLS_ASN1_CHK_ADD(len,
|
||||
mbedtls_asn1_write_raw_buffer(&p, buf,
|
||||
(const unsigned char *) cur->node
|
||||
.name,
|
||||
cur->node.len));
|
||||
MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(&p, buf, cur->node.len));
|
||||
MBEDTLS_ASN1_CHK_ADD(len,
|
||||
mbedtls_asn1_write_tag(&p, buf,
|
||||
MBEDTLS_ASN1_CONTEXT_SPECIFIC |
|
||||
cur->node.type));
|
||||
break;
|
||||
default:
|
||||
/* Skip unsupported names. */
|
||||
break;
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue