src/java.base/share/classes/sun/security/x509/X400Address.java
author igerasim
Tue, 02 Oct 2018 10:19:07 -0700
changeset 51986 c1db377f6300
parent 47216 71c04702a3d5
child 53082 4c539cb11633
permissions -rw-r--r--
8200381: Typos in javadoc - missing verb "be" and alike Reviewed-by: lancea, darcy, wetmore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.security.x509;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import sun.security.util.DerValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import sun.security.util.DerOutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * This class defines the X400Address of the GeneralName choice.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * The ASN.1 syntax for this is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * ORAddress ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *    built-in-standard-attributes BuiltInStandardAttributes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *    built-in-domain-defined-attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *                         BuiltInDomainDefinedAttributes OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *    -- see also teletex-domain-defined-attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *    extension-attributes ExtensionAttributes OPTIONAL }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * --      The OR-address is semantically absent from the OR-name if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * --      built-in-standard-attribute sequence is empty and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * --      built-in-domain-defined-attributes and extension-attributes are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * --      both omitted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * --      Built-in Standard Attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * BuiltInStandardAttributes ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *    country-name CountryName OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *    administration-domain-name AdministrationDomainName OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *    network-address      [0] NetworkAddress OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *    -- see also extended-network-address
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *    terminal-identifier  [1] TerminalIdentifier OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *    private-domain-name  [2] PrivateDomainName OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *    organization-name    [3] OrganizationName OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *    -- see also teletex-organization-name
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *    numeric-user-identifier      [4] NumericUserIdentifier OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *    personal-name        [5] PersonalName OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *    -- see also teletex-personal-name
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *    organizational-unit-names    [6] OrganizationalUnitNames OPTIONAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 *    -- see also teletex-organizational-unit-names -- }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * CountryName ::= [APPLICATION 1] CHOICE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 *    x121-dcc-code NumericString
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *                 (SIZE (ub-country-name-numeric-length)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *    iso-3166-alpha2-code PrintableString
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *                 (SIZE (ub-country-name-alpha-length)) }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * AdministrationDomainName ::= [APPLICATION 2] CHOICE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 *    numeric NumericString (SIZE (0..ub-domain-name-length)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *    printable PrintableString (SIZE (0..ub-domain-name-length)) }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * NetworkAddress ::= X121Address  -- see also extended-network-address
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * X121Address ::= NumericString (SIZE (1..ub-x121-address-length))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * TerminalIdentifier ::= PrintableString (SIZE (1..ub-terminal-id-length))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * PrivateDomainName ::= CHOICE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 *    numeric NumericString (SIZE (1..ub-domain-name-length)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *    printable PrintableString (SIZE (1..ub-domain-name-length)) }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * OrganizationName ::= PrintableString
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 *                             (SIZE (1..ub-organization-name-length))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * -- see also teletex-organization-name
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * NumericUserIdentifier ::= NumericString
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 *                             (SIZE (1..ub-numeric-user-id-length))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * PersonalName ::= SET {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 *    surname [0] PrintableString (SIZE (1..ub-surname-length)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 *    given-name [1] PrintableString
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 *                         (SIZE (1..ub-given-name-length)) OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 *    initials [2] PrintableString (SIZE (1..ub-initials-length)) OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 *    generation-qualifier [3] PrintableString
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 *                 (SIZE (1..ub-generation-qualifier-length)) OPTIONAL }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * -- see also teletex-personal-name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * OrganizationalUnitNames ::= SEQUENCE SIZE (1..ub-organizational-units)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 *                                         OF OrganizationalUnitName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * -- see also teletex-organizational-unit-names
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * OrganizationalUnitName ::= PrintableString (SIZE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 *                         (1..ub-organizational-unit-name-length))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 * --      Built-in Domain-defined Attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * BuiltInDomainDefinedAttributes ::= SEQUENCE SIZE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 *                                 (1..ub-domain-defined-attributes) OF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 *                                 BuiltInDomainDefinedAttribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * BuiltInDomainDefinedAttribute ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 *    type PrintableString (SIZE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 *                         (1..ub-domain-defined-attribute-type-length)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 *    value PrintableString (SIZE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 *                         (1..ub-domain-defined-attribute-value-length))}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 * --      Extension Attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 * ExtensionAttributes ::= SET SIZE (1..ub-extension-attributes) OF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 *                         ExtensionAttribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * ExtensionAttribute ::=  SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 *    extension-attribute-type [0] INTEGER (0..ub-extension-attributes),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 *    extension-attribute-value [1]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 *                         ANY DEFINED BY extension-attribute-type }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 * -- Extension types and attribute values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 * --
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 * common-name INTEGER ::= 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 * CommonName ::= PrintableString (SIZE (1..ub-common-name-length))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 * teletex-common-name INTEGER ::= 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 * TeletexCommonName ::= TeletexString (SIZE (1..ub-common-name-length))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 * teletex-organization-name INTEGER ::= 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 * TeletexOrganizationName ::=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 *                 TeletexString (SIZE (1..ub-organization-name-length))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 * teletex-personal-name INTEGER ::= 4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 * TeletexPersonalName ::= SET {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 *    surname [0] TeletexString (SIZE (1..ub-surname-length)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 *    given-name [1] TeletexString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 *                 (SIZE (1..ub-given-name-length)) OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 *    initials [2] TeletexString (SIZE (1..ub-initials-length)) OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 *    generation-qualifier [3] TeletexString (SIZE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 *                 (1..ub-generation-qualifier-length)) OPTIONAL }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 * teletex-organizational-unit-names INTEGER ::= 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 * TeletexOrganizationalUnitNames ::= SEQUENCE SIZE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 *         (1..ub-organizational-units) OF TeletexOrganizationalUnitName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
 * TeletexOrganizationalUnitName ::= TeletexString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 *                         (SIZE (1..ub-organizational-unit-name-length))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 * pds-name INTEGER ::= 7
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 * PDSName ::= PrintableString (SIZE (1..ub-pds-name-length))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 * physical-delivery-country-name INTEGER ::= 8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 * PhysicalDeliveryCountryName ::= CHOICE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 *    x121-dcc-code NumericString (SIZE (ub-country-name-numeric-length)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 *    iso-3166-alpha2-code PrintableString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 *                         (SIZE (ub-country-name-alpha-length)) }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 * postal-code INTEGER ::= 9
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
 * PostalCode ::= CHOICE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
 *    numeric-code NumericString (SIZE (1..ub-postal-code-length)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
 *    printable-code PrintableString (SIZE (1..ub-postal-code-length)) }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 * physical-delivery-office-name INTEGER ::= 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 * PhysicalDeliveryOfficeName ::= PDSParameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 * physical-delivery-office-number INTEGER ::= 11
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 * PhysicalDeliveryOfficeNumber ::= PDSParameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
 * extension-OR-address-components INTEGER ::= 12
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
 * ExtensionORAddressComponents ::= PDSParameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
 * physical-delivery-personal-name INTEGER ::= 13
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
 * PhysicalDeliveryPersonalName ::= PDSParameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
 * physical-delivery-organization-name INTEGER ::= 14
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
 * PhysicalDeliveryOrganizationName ::= PDSParameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
 * extension-physical-delivery-address-components INTEGER ::= 15
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
 * ExtensionPhysicalDeliveryAddressComponents ::= PDSParameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
 * unformatted-postal-address INTEGER ::= 16
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
 * UnformattedPostalAddress ::= SET {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
 *    printable-address SEQUENCE SIZE (1..ub-pds-physical-address-lines) OF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
 *            PrintableString (SIZE (1..ub-pds-parameter-length)) OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
 *    teletex-string TeletexString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
 *          (SIZE (1..ub-unformatted-address-length)) OPTIONAL }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
 * street-address INTEGER ::= 17
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
 * StreetAddress ::= PDSParameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
 * post-office-box-address INTEGER ::= 18
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
 * PostOfficeBoxAddress ::= PDSParameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
 * poste-restante-address INTEGER ::= 19
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
 * PosteRestanteAddress ::= PDSParameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
 * unique-postal-name INTEGER ::= 20
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
 * UniquePostalName ::= PDSParameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
 * local-postal-attributes INTEGER ::= 21
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
 * LocalPostalAttributes ::= PDSParameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
 * PDSParameter ::= SET {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
 *    printable-string PrintableString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
 *                 (SIZE(1..ub-pds-parameter-length)) OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
 *    teletex-string TeletexString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
 *                 (SIZE(1..ub-pds-parameter-length)) OPTIONAL }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
 * extended-network-address INTEGER ::= 22
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
 * ExtendedNetworkAddress ::= CHOICE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
 *    e163-4-address SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
 *         number [0] NumericString (SIZE (1..ub-e163-4-number-length)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
 *         sub-address [1] NumericString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
 *                 (SIZE (1..ub-e163-4-sub-address-length)) OPTIONAL },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
 *    psap-address [0] PresentationAddress }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
 * PresentationAddress ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
 *         pSelector       [0] EXPLICIT OCTET STRING OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
 *         sSelector       [1] EXPLICIT OCTET STRING OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
 *         tSelector       [2] EXPLICIT OCTET STRING OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
 *         nAddresses      [3] EXPLICIT SET SIZE (1..MAX) OF OCTET STRING }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
 * terminal-type  INTEGER ::= 23
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
 * TerminalType ::= INTEGER {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
 *    telex (3),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
 *    teletex (4),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
 *    g3-facsimile (5),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
 *    g4-facsimile (6),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
 *    ia5-terminal (7),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
 *    videotex (8) } (0..ub-integer-options)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
 * --      Extension Domain-defined Attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
 * teletex-domain-defined-attributes INTEGER ::= 6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
 * TeletexDomainDefinedAttributes ::= SEQUENCE SIZE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
 *    (1..ub-domain-defined-attributes) OF TeletexDomainDefinedAttribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
 * TeletexDomainDefinedAttribute ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
 *         type TeletexString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
 *                (SIZE (1..ub-domain-defined-attribute-type-length)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
 *         value TeletexString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
 *                (SIZE (1..ub-domain-defined-attribute-value-length)) }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
 * --  specifications of Upper Bounds shall be regarded as mandatory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
 * --  from Annex B of ITU-T X.411 Reference Definition of MTS Parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
 * --  Upper Bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
 * --      Upper Bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
 * ub-name INTEGER ::=     32768
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
 * ub-common-name  INTEGER ::=     64
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
 * ub-locality-name        INTEGER ::=     128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
 * ub-state-name   INTEGER ::=     128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
 * ub-organization-name    INTEGER ::=     64
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
 * ub-organizational-unit-name     INTEGER ::=     64
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
 * ub-title        INTEGER ::=     64
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
 * ub-match        INTEGER ::=     128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
 * ub-emailaddress-length INTEGER ::= 128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
 * ub-common-name-length INTEGER ::= 64
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
 * ub-country-name-alpha-length INTEGER ::= 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
 * ub-country-name-numeric-length INTEGER ::= 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
 * ub-domain-defined-attributes INTEGER ::= 4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
 * ub-domain-defined-attribute-type-length INTEGER ::= 8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
 * ub-domain-defined-attribute-value-length INTEGER ::= 128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
 * ub-domain-name-length INTEGER ::= 16
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
 * ub-extension-attributes INTEGER ::= 256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
 * ub-e163-4-number-length INTEGER ::= 15
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
 * ub-e163-4-sub-address-length INTEGER ::= 40
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
 * ub-generation-qualifier-length INTEGER ::= 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
 * ub-given-name-length INTEGER ::= 16
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
 * ub-initials-length INTEGER ::= 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
 * ub-integer-options INTEGER ::= 256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
 * ub-numeric-user-id-length INTEGER ::= 32
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
 * ub-organization-name-length INTEGER ::= 64
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
 * ub-organizational-unit-name-length INTEGER ::= 32
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
 * ub-organizational-units INTEGER ::= 4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
 * ub-pds-name-length INTEGER ::= 16
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
 * ub-pds-parameter-length INTEGER ::= 30
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
 * ub-pds-physical-address-lines INTEGER ::= 6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
 * ub-postal-code-length INTEGER ::= 16
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
 * ub-surname-length INTEGER ::= 40
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
 * ub-terminal-id-length INTEGER ::= 24
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
 * ub-unformatted-address-length INTEGER ::= 180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
 * ub-x121-address-length INTEGER ::= 16
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
 * -- Note - upper bounds on string types, such as TeletexString, are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
 * -- measured in characters.  Excepting PrintableString or IA5String, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
 * -- significantly greater number of octets will be required to hold
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
 * -- such a value.  As a minimum, 16 octets, or twice the specified upper
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
 * -- bound, whichever is the larger, should be allowed for TeletexString.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
 * -- For UTF8String or UniversalString at least four times the upper
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
 * -- bound should be allowed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
 * @author Anne Anderson
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
 * @since       1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
 * @see GeneralName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
 * @see GeneralNames
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
 * @see GeneralNameInterface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
public class X400Address implements GeneralNameInterface {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    // Private data members
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    byte[] nameValue = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * Create the X400Address object from the specified byte array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     *
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   343
     * @param value value of the name as a byte array
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    public X400Address(byte[] value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
        nameValue = value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * Create the X400Address object from the passed encoded Der value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * @param derValue the encoded DER X400Address.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * @exception IOException on error.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    public X400Address(DerValue derValue) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
        nameValue = derValue.toByteArray();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * Return the type of the GeneralName.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
    public int getType() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        return (GeneralNameInterface.NAME_X400);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * Encode the X400 name into the DerOutputStream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * @param out the DER stream to encode the X400Address to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * @exception IOException on encoding errors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    public void encode(DerOutputStream out) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        DerValue derValue = new DerValue(nameValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        out.putDerValue(derValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * Return the printable string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        return ("X400Address: <DER-encoded value>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * Return type of constraint inputName places on this name:<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     *   <li>NAME_DIFF_TYPE = -1: input name is different type from name (i.e. does not constrain).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     *   <li>NAME_MATCH = 0: input name matches name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     *   <li>NAME_NARROWS = 1: input name narrows name (is lower in the naming subtree)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     *   <li>NAME_WIDENS = 2: input name widens name (is higher in the naming subtree)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     *   <li>NAME_SAME_TYPE = 3: input name does not match or narrow name, but is same type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * </ul>.  These results are used in checking NameConstraints during
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * certification path verification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * @param inputName to be checked for being constrained
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   395
     * @return constraint type above
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * @throws UnsupportedOperationException if name is same type, but comparison operations are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     *          not supported for this name type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    public int constrains(GeneralNameInterface inputName) throws UnsupportedOperationException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        int constraintType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        if (inputName == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
            constraintType = NAME_DIFF_TYPE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        else if (inputName.getType() != NAME_X400)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
            constraintType = NAME_DIFF_TYPE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
            //Narrowing, widening, and match constraints not defined in rfc2459 for X400Address
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
            throw new UnsupportedOperationException("Narrowing, widening, and match are not supported for X400Address.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
        return constraintType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * Return subtree depth of this name for purposes of determining
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * NameConstraints minimum and maximum bounds and for calculating
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * path lengths in name subtrees.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     *
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   416
     * @return distance of name from root
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * @throws UnsupportedOperationException if not supported for this name type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
    public int subtreeDepth() throws UnsupportedOperationException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        throw new UnsupportedOperationException("subtreeDepth not supported for X400Address");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
}