x509: Add support for IP address nameConstraints

According to RFC 5280, section 4.2.1.10, these are encoded as address
followed by a network mask of the same length.
This commit is contained in:
Tobias Brunner
2023-11-13 12:23:33 +01:00
parent f781b9d326
commit ede96fe3db
@@ -483,9 +483,15 @@ static identification_t *parse_generalName(chunk_t blob, int level0)
case 4:
id_type = ID_IPV4_ADDR;
break;
case 8:
id_type = ID_IPV4_ADDR_SUBNET;
break;
case 16:
id_type = ID_IPV6_ADDR;
break;
case 32:
id_type = ID_IPV6_ADDR_SUBNET;
break;
default:
break;
}
@@ -2065,6 +2071,8 @@ static chunk_t build_generalName(identification_t *id)
break;
case ID_IPV4_ADDR:
case ID_IPV6_ADDR:
case ID_IPV4_ADDR_SUBNET:
case ID_IPV6_ADDR_SUBNET:
context = ASN1_CONTEXT_S_7;
break;
default: