/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This class defines the Extensions attribute for the Certificate.
*
* @author Amit Kapoor
* @author Hemma Prafullchandra
* @see CertAttrSet
*/
/**
* Identifier for this attribute, to be used with the
* get, set, delete methods of Certificate, x509 type.
*/
/**
* name
*/
private boolean unsupportedCritExt = false;
/**
* Default constructor.
*/
public CertificateExtensions() { }
/**
* Create the object, decoding the values from the passed DER stream.
*
* @param in the DerInputStream to read the Extension from.
* @exception IOException on decoding errors.
*/
}
// helper routine
}
}
// Parse the encoded extension
try {
if (ext.isCritical()) {
unsupportedCritExt = true;
}
return;
} else {
throw new IOException("Duplicate extensions not allowed");
}
}
ext.getExtensionValue()};
throw new IOException("Duplicate extensions not allowed");
}
} catch (InvocationTargetException invk) {
if (ext.isCritical() == false) {
// ignore errors parsing non-critical extensions
if (unparseableExtensions == null) {
}
new UnparseableExtension(ext, e));
e.printStackTrace();
HexDumpEncoder h = new HexDumpEncoder();
}
return;
}
if (e instanceof IOException) {
throw (IOException)e;
} else {
}
} catch (IOException e) {
throw e;
} catch (Exception e) {
}
}
/**
* Encode the extensions in DER form to the stream, setting
* the context specific tag as needed in the X.509 v3 certificate.
*
* @param out the DerOutputStream to marshal the contents to.
* @exception CertificateException on encoding errors.
* @exception IOException on errors.
*/
throws CertificateException, IOException {
}
/**
* Encode the extensions in DER form to the stream.
*
* @param out the DerOutputStream to marshal the contents to.
* @param isCertReq if true then no context specific tag is added.
* @exception CertificateException on encoding errors.
* @exception IOException on errors.
*/
throws CertificateException, IOException {
if (objs[i] instanceof CertAttrSet)
else
throw new CertificateException("Illegal extension object");
}
if (!isCertReq) { // certificate
tmp = new DerOutputStream();
seq);
} else
}
/**
* Set the attribute value.
* @param name the extension name used in the cache.
* @param obj the object to set.
* @exception IOException if the object could not be cached.
*/
} else {
throw new IOException("Unknown extension type.");
}
}
/**
* Get the attribute value.
* @param name the extension name used in the lookup.
* @exception IOException if named extension is not found.
*/
}
return (obj);
}
// Similar to get(String), but throw no exception, might return null.
// Used in X509CertImpl::getExtension(OID).
}
/**
* Delete the attribute value.
* @param name the extension name used in the lookup.
* @exception IOException if named extension is not found.
*/
}
}
return name;
}
}
return null;
}
/**
* Return an enumeration of names of attributes existing within this
* attribute.
*/
}
/**
* Return a collection view of the extensions.
* @return a collection view of the extensions in this Certificate.
*/
}
if (unparseableExtensions == null) {
return Collections.emptyMap();
} else {
return unparseableExtensions;
}
}
/**
* Return the name of this attribute.
*/
return NAME;
}
/**
* Return true if a critical extension is found that is
* not supported, otherwise return false.
*/
public boolean hasUnsupportedCriticalExtension() {
return unsupportedCritExt;
}
/**
* Compares this CertificateExtensions for equality with the specified
* object. If the <code>other</code> object is an
* <code>instanceof</code> <code>CertificateExtensions</code>, then
* all the entries are compared with the entries from this.
*
* @param other the object to test for equality with this
* CertificateExtensions.
* @return true iff all the entries match that of the Other,
* false otherwise.
*/
if (this == other)
return true;
if (!(other instanceof CertificateExtensions))
return false;
return false;
for (int i = 0; i < len; i++) {
if (objs[i] instanceof CertAttrSet)
return false;
return false;
}
return this.getUnparseableExtensions().equals(
}
/**
* Returns a hashcode value for this CertificateExtensions.
*
* @return the hashcode value.
*/
public int hashCode() {
}
/**
* Returns a string representation of this <tt>CertificateExtensions</tt>
* object in the form of a set of entries, enclosed in braces and separated
* by the ASCII characters "<tt>, </tt>" (comma and space).
* <p>Overrides to <tt>toString</tt> method of <tt>Object</tt>.
*
* @return a string representation of this CertificateExtensions.
*/
}
}
super(ext);
name = "";
try {
}
} catch (Exception e) {
// If we cannot find the name, just ignore it
}
}
return super.toString() +
}
}