001/*
002 * Copyright 2017-2024 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2017-2024 Ping Identity Corporation
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020/*
021 * Copyright (C) 2017-2024 Ping Identity Corporation
022 *
023 * This program is free software; you can redistribute it and/or modify
024 * it under the terms of the GNU General Public License (GPLv2 only)
025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
026 * as published by the Free Software Foundation.
027 *
028 * This program is distributed in the hope that it will be useful,
029 * but WITHOUT ANY WARRANTY; without even the implied warranty of
030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
031 * GNU General Public License for more details.
032 *
033 * You should have received a copy of the GNU General Public License
034 * along with this program; if not, see <http://www.gnu.org/licenses>.
035 */
036package com.unboundid.util.ssl.cert;
037
038
039
040import com.unboundid.util.NotMutable;
041import com.unboundid.util.NotNull;
042import com.unboundid.util.OID;
043import com.unboundid.util.ThreadSafety;
044import com.unboundid.util.ThreadSafetyLevel;
045
046import static com.unboundid.util.ssl.cert.CertMessages.*;
047
048
049
050/**
051 * This class provides an implementation of the issuer alternative name X.509
052 * certificate extension as described in
053 * <A HREF="https://www.ietf.org/rfc/rfc5280.txt">RFC 5280</A> section 4.2.1.7.
054 * It can provide additional information about the issuer for a certificate, but
055 * this information is generally not used in the course of validating a
056 * certification path.
057 * <BR><BR>
058 * The OID for this extension is 2.5.29.18.  See the
059 * {@link GeneralAlternativeNameExtension} class for implementation details and
060 * the value encoding.
061 */
062@NotMutable()
063@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
064public final class IssuerAlternativeNameExtension
065       extends GeneralAlternativeNameExtension
066{
067  /**
068   * The OID (2.5.29.18) for issuer alternative name extensions.
069   */
070  @NotNull public static final OID ISSUER_ALTERNATIVE_NAME_OID =
071       new OID("2.5.29.18");
072
073
074
075  /**
076   * The serial version UID for this serializable class.
077   */
078  private static final long serialVersionUID = -1448132657790331913L;
079
080
081
082  /**
083   * Creates a new issuer alternative name extension with the provided
084   * information.
085   *
086   * @param  isCritical    Indicates whether this extension should be considered
087   *                       critical.
088   * @param  generalNames  The set of names to include in this extension.  This
089   *                       must not be {@code null}.
090   *
091   * @throws  CertException  If a problem occurs while trying to encode the
092   *                         value.
093   */
094  IssuerAlternativeNameExtension(final boolean isCritical,
095                                 @NotNull final GeneralNames generalNames)
096       throws CertException
097  {
098    super(ISSUER_ALTERNATIVE_NAME_OID, isCritical, generalNames);
099  }
100
101
102
103  /**
104   * Creates a new issuer alternative name extension from the provided generic
105   * extension.
106   *
107   * @param  extension  The extension to decode as a issuer alternative name
108   *                    extension.
109   *
110   * @throws  CertException  If the provided extension cannot be decoded as a
111   *                         issuer alternative name extension.
112   */
113  IssuerAlternativeNameExtension(
114       @NotNull final X509CertificateExtension extension)
115       throws CertException
116  {
117    super(extension);
118  }
119
120
121
122  /**
123   * {@inheritDoc}
124   */
125  @Override()
126  @NotNull()
127  public String getExtensionName()
128  {
129    return INFO_ISSUER_ALT_NAME_EXTENSION_NAME.get();
130  }
131
132
133
134  /**
135   * {@inheritDoc}
136   */
137  @Override()
138  public void toString(@NotNull final StringBuilder buffer)
139  {
140    toString("IssuerAlternativeNameExtension", buffer);
141  }
142}