001/* 002 * Copyright 2017-2020 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2017-2020 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-2020 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.OID; 042import com.unboundid.util.ThreadSafety; 043import com.unboundid.util.ThreadSafetyLevel; 044 045import static com.unboundid.util.ssl.cert.CertMessages.*; 046 047 048 049/** 050 * This class provides an implementation of the issuer alternative name X.509 051 * certificate extension as described in 052 * <A HREF="https://www.ietf.org/rfc/rfc5280.txt">RFC 5280</A> section 4.2.1.7. 053 * It can provide additional information about the issuer for a certificate, but 054 * this information is generally not used in the course of validating a 055 * certification path. 056 * <BR><BR> 057 * The OID for this extension is 2.5.29.18. See the 058 * {@link GeneralAlternativeNameExtension} class for implementation details and 059 * the value encoding. 060 */ 061@NotMutable() 062@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 063public final class IssuerAlternativeNameExtension 064 extends GeneralAlternativeNameExtension 065{ 066 /** 067 * The OID (2.5.29.18) for issuer alternative name extensions. 068 */ 069 public static final OID ISSUER_ALTERNATIVE_NAME_OID = new OID("2.5.29.18"); 070 071 072 073 /** 074 * The serial version UID for this serializable class. 075 */ 076 private static final long serialVersionUID = -1448132657790331913L; 077 078 079 080 /** 081 * Creates a new issuer alternative name extension with the provided 082 * information. 083 * 084 * @param isCritical Indicates whether this extension should be considered 085 * critical. 086 * @param generalNames The set of names to include in this extension. This 087 * must not be {@code null}. 088 * 089 * @throws CertException If a problem occurs while trying to encode the 090 * value. 091 */ 092 IssuerAlternativeNameExtension(final boolean isCritical, 093 final GeneralNames generalNames) 094 throws CertException 095 { 096 super(ISSUER_ALTERNATIVE_NAME_OID, isCritical, generalNames); 097 } 098 099 100 101 /** 102 * Creates a new issuer alternative name extension from the provided generic 103 * extension. 104 * 105 * @param extension The extension to decode as a issuer alternative name 106 * extension. 107 * 108 * @throws CertException If the provided extension cannot be decoded as a 109 * issuer alternative name extension. 110 */ 111 IssuerAlternativeNameExtension(final X509CertificateExtension extension) 112 throws CertException 113 { 114 super(extension); 115 } 116 117 118 119 /** 120 * {@inheritDoc} 121 */ 122 @Override() 123 public String getExtensionName() 124 { 125 return INFO_ISSUER_ALT_NAME_EXTENSION_NAME.get(); 126 } 127 128 129 130 /** 131 * {@inheritDoc} 132 */ 133 @Override() 134 public void toString(final StringBuilder buffer) 135 { 136 toString("IssuerAlternativeNameExtension", buffer); 137 } 138}