Udostępnij za pośrednictwem


X509CertSelector.AddSubjectAlternativeName Method

Definition

Overloads

AddSubjectAlternativeName(Int32, Byte[])

Adds a name to the subjectAlternativeNames criterion.

AddSubjectAlternativeName(Int32, String)

Adds a name to the subjectAlternativeNames criterion.

AddSubjectAlternativeName(Int32, Byte[])

Adds a name to the subjectAlternativeNames criterion.

[Android.Runtime.Register("addSubjectAlternativeName", "(I[B)V", "GetAddSubjectAlternativeName_IarrayBHandler")]
public virtual void AddSubjectAlternativeName (int type, byte[]? name);
[<Android.Runtime.Register("addSubjectAlternativeName", "(I[B)V", "GetAddSubjectAlternativeName_IarrayBHandler")>]
abstract member AddSubjectAlternativeName : int * byte[] -> unit
override this.AddSubjectAlternativeName : int * byte[] -> unit

Parameters

type
Int32

the name type (0-8, as listed above)

name
Byte[]

a byte array containing the name in ASN.1 DER encoded form

Attributes

Exceptions

if the decoding of the name fails.

Remarks

Adds a name to the subjectAlternativeNames criterion. The X509Certificate must contain all or at least one of the specified subjectAlternativeNames, depending on the value of the matchAllNames flag (see #setMatchAllSubjectAltNames setMatchAllSubjectAltNames).

This method allows the caller to add a name to the set of subject alternative names. The specified name is added to any previous value for the subjectAlternativeNames criterion. If the specified name is a duplicate, it may be ignored.

The name is provided as a byte array. This byte array should contain the DER encoded name, as it would appear in the GeneralName structure defined in RFC 5280 and X.509. The encoded byte array should only contain the encoded value of the name, and should not include the tag associated with the name in the GeneralName structure. The ASN.1 definition of this structure appears below.

{@code
             GeneralName ::= CHOICE {
                  otherName                       [0]     OtherName,
                  rfc822Name                      [1]     IA5String,
                  dNSName                         [2]     IA5String,
                  x400Address                     [3]     ORAddress,
                  directoryName                   [4]     Name,
                  ediPartyName                    [5]     EDIPartyName,
                  uniformResourceIdentifier       [6]     IA5String,
                  iPAddress                       [7]     OCTET STRING,
                  registeredID                    [8]     OBJECT IDENTIFIER}
            }

Note that the byte array supplied here is cloned to protect against subsequent modifications.

Java documentation for java.security.cert.X509CertSelector.addSubjectAlternativeName(int, byte[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

AddSubjectAlternativeName(Int32, String)

Adds a name to the subjectAlternativeNames criterion.

[Android.Runtime.Register("addSubjectAlternativeName", "(ILjava/lang/String;)V", "GetAddSubjectAlternativeName_ILjava_lang_String_Handler")]
public virtual void AddSubjectAlternativeName (int type, string? name);
[<Android.Runtime.Register("addSubjectAlternativeName", "(ILjava/lang/String;)V", "GetAddSubjectAlternativeName_ILjava_lang_String_Handler")>]
abstract member AddSubjectAlternativeName : int * string -> unit
override this.AddSubjectAlternativeName : int * string -> unit

Parameters

type
Int32

the name type (0-8, as specified in RFC 5280, section 4.2.1.6)

name
String

the name in string form (not null)

Attributes

Exceptions

if parsing the name fails.

Remarks

Adds a name to the subjectAlternativeNames criterion. The X509Certificate must contain all or at least one of the specified subjectAlternativeNames, depending on the value of the matchAllNames flag (see #setMatchAllSubjectAltNames setMatchAllSubjectAltNames).

This method allows the caller to add a name to the set of subject alternative names. The specified name is added to any previous value for the subjectAlternativeNames criterion. If the specified name is a duplicate, it may be ignored.

The name is provided in string format. RFC 822, DNS, and URI names use the well-established string formats for those types (subject to the restrictions included in RFC 5280). IPv4 address names are supplied using dotted quad notation. OID address names are represented as a series of nonnegative integers separated by periods. And directory names (distinguished names) are supplied in RFC 2253 format. No standard string format is defined for otherNames, X.400 names, EDI party names, IPv6 address names, or any other type of names. They should be specified using the #addSubjectAlternativeName(int type, byte [] name) addSubjectAlternativeName(int type, byte [] name) method.

<strong>Note:</strong> for distinguished names, use #addSubjectAlternativeName(int, byte[]) instead. This method should not be relied on as it can fail to match some certificates because of a loss of encoding information in the RFC 2253 String form of some distinguished names.

Java documentation for java.security.cert.X509CertSelector.addSubjectAlternativeName(int, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to