Path: blob/master/src/java.base/share/classes/sun/security/x509/GeneralNameInterface.java
41159 views
/*1* Copyright (c) 1997, 2000, 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;2829import sun.security.util.*;3031/**32* This interface specifies the abstract methods which have to be33* implemented by all the members of the GeneralNames ASN.1 object.34*35* @author Amit Kapoor36* @author Hemma Prafullchandra37*/38public interface GeneralNameInterface {39/**40* The list of names supported.41*/42public static final int NAME_ANY = 0;43public static final int NAME_RFC822 = 1;44public static final int NAME_DNS = 2;45public static final int NAME_X400 = 3;46public static final int NAME_DIRECTORY = 4;47public static final int NAME_EDI = 5;48public static final int NAME_URI = 6;49public static final int NAME_IP = 7;50public static final int NAME_OID = 8;5152/**53* The list of constraint results.54*/55public static final int NAME_DIFF_TYPE = -1; /* input name is different type from name (i.e. does not constrain) */56public static final int NAME_MATCH = 0; /* input name matches name */57public static final int NAME_NARROWS = 1; /* input name narrows name */58public static final int NAME_WIDENS = 2; /* input name widens name */59public static final int NAME_SAME_TYPE = 3; /* input name does not match, narrow, or widen, but is same type */6061/**62* Return the type of the general name, as63* defined above.64*/65int getType();6667/**68* Encode the name to the specified DerOutputStream.69*70* @param out the DerOutputStream to encode the GeneralName to.71* @exception IOException thrown if the GeneralName could not be72* encoded.73*/74void encode(DerOutputStream out) throws IOException;7576/**77* Return type of constraint inputName places on this name:<ul>78* <li>NAME_DIFF_TYPE = -1: input name is different type from name (i.e. does not constrain).79* <li>NAME_MATCH = 0: input name matches name.80* <li>NAME_NARROWS = 1: input name narrows name (is lower in the naming subtree)81* <li>NAME_WIDENS = 2: input name widens name (is higher in the naming subtree)82* <li>NAME_SAME_TYPE = 3: input name does not match or narrow name, but is same type.83* </ul>. These results are used in checking NameConstraints during84* certification path verification.85*86* @param inputName to be checked for being constrained87* @return constraint type above88* @throws UnsupportedOperationException if name is same type, but comparison operations are89* not supported for this name type.90*/91int constrains(GeneralNameInterface inputName) throws UnsupportedOperationException;9293/**94* Return subtree depth of this name for purposes of determining95* NameConstraints minimum and maximum bounds and for calculating96* path lengths in name subtrees.97*98* @return distance of name from root99* @throws UnsupportedOperationException if not supported for this name type100*/101int subtreeDepth() throws UnsupportedOperationException;102}103104105