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