Path: blob/master/src/java.base/share/classes/sun/security/x509/CertAttrSet.java
41159 views
/*1* Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.security.x509;2627import java.io.IOException;28import java.io.OutputStream;29import java.security.cert.CertificateException;30import java.util.Enumeration;3132/**33* This interface defines the methods required of a certificate attribute.34* Examples of X.509 certificate attributes are Validity, Issuer_Name, and35* Subject Name. A CertAttrSet may comprise one attribute or many36* attributes.37* <p>38* A CertAttrSet itself can also be comprised of other sub-sets.39* In the case of X.509 V3 certificates, for example, the "extensions"40* attribute has subattributes, such as those for KeyUsage and41* AuthorityKeyIdentifier.42*43* @author Amit Kapoor44* @author Hemma Prafullchandra45* @see CertificateException46*/47public interface CertAttrSet<T> {48/**49* Returns a short string describing this certificate attribute.50*51* @return value of this certificate attribute in52* printable form.53*/54String toString();5556/**57* Encodes the attribute to the output stream in a format58* that can be parsed by the <code>decode</code> method.59*60* @param out the OutputStream to encode the attribute to.61*62* @exception CertificateException on encoding or validity errors.63* @exception IOException on other errors.64*/65void encode(OutputStream out)66throws CertificateException, IOException;6768/**69* Sets an attribute value within this CertAttrSet.70*71* @param name the name of the attribute (e.g. "x509.info.key")72* @param obj the attribute object.73*74* @exception CertificateException on attribute handling errors.75* @exception IOException on other errors.76*/77void set(String name, Object obj)78throws CertificateException, IOException;7980/**81* Gets an attribute value for this CertAttrSet.82*83* @param name the name of the attribute to return.84*85* @exception CertificateException on attribute handling errors.86* @exception IOException on other errors.87*/88Object get(String name)89throws CertificateException, IOException;9091/**92* Deletes an attribute value from this CertAttrSet.93*94* @param name the name of the attribute to delete.95*96* @exception CertificateException on attribute handling errors.97* @exception IOException on other errors.98*/99void delete(String name)100throws CertificateException, IOException;101102/**103* Returns an enumeration of the names of the attributes existing within104* this attribute.105*106* @return an enumeration of the attribute names.107*/108Enumeration<T> getElements();109110/**111* Returns the name (identifier) of this CertAttrSet.112*113* @return the name of this CertAttrSet.114*/115String getName();116}117118119