1 package org.bouncycastle.asn1.x509;
3 import org.bouncycastle.asn1.*;
7 * GeneralName ::= CHOICE {
8 * otherName [0] OtherName,
9 * rfc822Name [1] IA5String,
10 * dNSName [2] IA5String,
11 * x400Address [3] ORAddress,
12 * directoryName [4] Name,
13 * ediPartyName [5] EDIPartyName,
14 * uniformResourceIdentifier [6] IA5String,
15 * iPAddress [7] OCTET STRING,
16 * registeredID [8] OBJECT IDENTIFIER}
18 * OtherName ::= SEQUENCE {
19 * type-id OBJECT IDENTIFIER,
20 * value [0] EXPLICIT ANY DEFINED BY type-id }
22 * EDIPartyName ::= SEQUENCE {
23 * nameAssigner [0] DirectoryString OPTIONAL,
24 * partyName [1] DirectoryString }
27 public class GeneralName
28 implements DEREncodable
32 boolean isInsideImplicit = false; // if we are in an implicitly tagged object
35 X509Name directoryName)
37 this.obj = directoryName;
42 * When the subjectAltName extension contains an Internet mail address,
43 * the address MUST be included as an rfc822Name. The format of an
44 * rfc822Name is an "addr-spec" as defined in RFC 822 [RFC 822].
46 * When the subjectAltName extension contains a domain name service
47 * label, the domain name MUST be stored in the dNSName (an IA5String).
48 * The name MUST be in the "preferred name syntax," as specified by RFC
51 * When the subjectAltName extension contains a URI, the name MUST be
52 * stored in the uniformResourceIdentifier (an IA5String). The name MUST
53 * be a non-relative URL, and MUST follow the URL syntax and encoding
54 * rules specified in [RFC 1738]. The name must include both a scheme
55 * (e.g., "http" or "ftp") and a scheme-specific-part. The scheme-
56 * specific-part must include a fully qualified domain name or IP
57 * address as the host.
59 * When the subjectAltName extension contains a iPAddress, the address
60 * MUST be stored in the octet string in "network byte order," as
61 * specified in RFC 791 [RFC 791]. The least significant bit (LSB) of
62 * each octet is the LSB of the corresponding byte in the network
63 * address. For IP Version 4, as specified in RFC 791, the octet string
64 * MUST contain exactly four octets. For IP Version 6, as specified in
65 * RFC 1883, the octet string MUST contain exactly sixteen octets [RFC
69 DERObject name, int tag)
76 * mark whether or not we are contained inside an implicitly tagged
80 public void markInsideImplicit(
81 boolean isInsideImplicit)
83 this.isInsideImplicit = isInsideImplicit;
86 public DERObject getDERObject()
88 if (obj.getDERObject() instanceof ASN1Sequence)
90 return new DERTaggedObject(true, tag, obj);
94 return new DERTaggedObject(false, tag, obj);