The name constraints extension provides permitted and excluded subtrees that place restrictions on names that may be included within a certificate issued by a given CA. Restrictions may apply to the subject distinguished name or subject alternative names. Any name matching a restriction in the excluded subtrees field is invalid regardless of information appearing in the permitted subtrees.
The ASN.1 syntax for this is:
NameConstraints ::= SEQUENCE {
permittedSubtrees [0] GeneralSubtrees OPTIONAL,
excludedSubtrees [1] GeneralSubtrees OPTIONAL
}
GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree
Extension
| Modifier and Type | Field and Description |
|---|---|
| private GeneralSubtrees | |
| private boolean | |
| private boolean | |
| private boolean | |
| public static final String | |
| private GeneralSubtrees | |
| private static final byte | |
| private static final byte |
| Access | Constructor and Description |
|---|---|
| public | NameConstraintsExtension(GeneralSubtrees
the permitted GeneralSubtrees (null for optional). permitted, GeneralSubtrees the excluded GeneralSubtrees (null for optional). excluded)The default constructor for this class. |
| public | NameConstraintsExtension(Boolean
true if the extension is to be treated as critical. critical, Object an array of DER encoded bytes of the actual value. value)Create the extension from the passed DER encoded value. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public Object | clone()
Overrides java. Clone all objects that may be modified during certificate validation. |
| public void | encode(DerOutputStream
the DerOutputStream to write the extension to. out)Overrides sun. Implements sun. Write the extension to the OutputStream. |
| private void | |
| public GeneralSubtrees | |
| public String | |
| public GeneralSubtrees | |
| private static boolean | |
| public void | merge(NameConstraintsExtension
additional NameConstraints to be applied newConstraints)Merge additional name constraints with existing ones. |
| public String | |
| public boolean | Returns: true if certificate verifies successfullyX509Certificate to be verified cert)check whether a certificate conforms to these NameConstraints. |
| public boolean | Returns: true if certificate verifies successfullyGeneralNameInterface name to be verified name)check whether a name conforms to these NameConstraints. |
| excluded | back to summary |
|---|---|
| private GeneralSubtrees excluded | |
| hasMax | back to summary |
|---|---|
| private boolean hasMax | |
| hasMin | back to summary |
|---|---|
| private boolean hasMin | |
| minMaxValid | back to summary |
|---|---|
| private boolean minMaxValid | |
| NAME | back to summary |
|---|---|
| public static final String NAME | |
| permitted | back to summary |
|---|---|
| private GeneralSubtrees permitted | |
| TAG_EXCLUDED | back to summary |
|---|---|
| private static final byte TAG_EXCLUDED | |
| TAG_PERMITTED | back to summary |
|---|---|
| private static final byte TAG_PERMITTED | |
| NameConstraintsExtension | back to summary |
|---|---|
| public NameConstraintsExtension(GeneralSubtrees permitted, GeneralSubtrees excluded) The default constructor for this class. Both parameters are optional but at least one should be non null. The extension criticality is set to true.
| |
| NameConstraintsExtension | back to summary |
|---|---|
| public NameConstraintsExtension(Boolean critical, Object value) throws IOException Create the extension from the passed DER encoded value.
| |
| calcMinMax | back to summary |
|---|---|
| private void calcMinMax() | |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Clone all objects that may be modified during certificate validation. | |
| encode | back to summary |
|---|---|
| public void encode(DerOutputStream out) Overrides sun. Implements sun. Write the extension to the OutputStream.
| |
| encodeThis | back to summary |
|---|---|
| private void encodeThis() | |
| getExcludedSubtrees | back to summary |
|---|---|
| public GeneralSubtrees getExcludedSubtrees() | |
| getName | back to summary |
|---|---|
| public String getName() Overrides sun. Return the name of this extension.
| |
| getPermittedSubtrees | back to summary |
|---|---|
| public GeneralSubtrees getPermittedSubtrees() | |
| hasNameType | back to summary |
|---|---|
| private static boolean hasNameType(GeneralNames names, int type) | |
| merge | back to summary |
|---|---|
| public void merge(NameConstraintsExtension newConstraints) throws IOException Merge additional name constraints with existing ones. This function is used in certification path processing to accumulate name constraints from successive certificates in the path. Note that NameConstraints can never be expanded by a merge, just remain constant or become more limiting. IETF RFC 5280 specifies the processing of Name Constraints as follows: (j) If permittedSubtrees is present in the certificate, set the constrained subtrees state variable to the intersection of its previous value and the value indicated in the extension field. (k) If excludedSubtrees is present in the certificate, set the excluded subtrees state variable to the union of its previous value and the value indicated in the extension field.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides sun. Return the printable string. | |
| verify | back to summary |
|---|---|
| public boolean verify(X509Certificate cert) throws IOException check whether a certificate conforms to these NameConstraints. This involves verifying that the subject name and subjectAltName extension (critical or noncritical) is consistent with the permitted subtrees state variables. Also verify that the subject name and subjectAltName extension (critical or noncritical) is consistent with the excluded subtrees state variables.
| |
| verify | back to summary |
|---|---|
| public boolean verify(GeneralNameInterface name) throws IOException check whether a name conforms to these NameConstraints. This involves verifying that the name is consistent with the permitted and excluded subtrees variables.
| |