0N/A/*
2362N/A * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.security;
0N/A
0N/Aimport java.io.*;
0N/Aimport java.util.Date;
0N/A
0N/A/**
0N/A * <p>This is an interface of abstract methods for managing a
0N/A * variety of identity certificates.
0N/A * An identity certificate is a guarantee by a principal that
0N/A * a public key is that of another principal. (A principal represents
0N/A * an entity such as an individual user, a group, or a corporation.)
0N/A *
0N/A * <p>In particular, this interface is intended to be a common
0N/A * abstraction for constructs that have different formats but
0N/A * important common uses. For example, different types of
0N/A * certificates, such as X.509 certificates and PGP certificates,
0N/A * share general certificate functionality (the need to encode and
0N/A * decode certificates) and some types of information, such as a
0N/A * public key, the principal whose key it is, and the guarantor
0N/A * guaranteeing that the public key is that of the specified
0N/A * principal. So an implementation of X.509 certificates and an
0N/A * implementation of PGP certificates can both utilize the Certificate
0N/A * interface, even though their formats and additional types and
0N/A * amounts of information stored are different.
0N/A *
0N/A * <p><b>Important</b>: This interface is useful for cataloging and
0N/A * grouping objects sharing certain common uses. It does not have any
0N/A * semantics of its own. In particular, a Certificate object does not
0N/A * make any statement as to the <i>validity</i> of the binding. It is
0N/A * the duty of the application implementing this interface to verify
0N/A * the certificate and satisfy itself of its validity.
0N/A *
0N/A * @author Benjamin Renaud
0N/A * @deprecated A new certificate handling package is created in the Java platform.
0N/A * This Certificate interface is entirely deprecated and
0N/A * is here to allow for a smooth transition to the new
0N/A * package.
0N/A * @see java.security.cert.Certificate
0N/A */
0N/A@Deprecated
0N/Apublic interface Certificate {
0N/A
0N/A /**
0N/A * Returns the guarantor of the certificate, that is, the principal
0N/A * guaranteeing that the public key associated with this certificate
0N/A * is that of the principal associated with this certificate. For X.509
0N/A * certificates, the guarantor will typically be a Certificate Authority
0N/A * (such as the United States Postal Service or Verisign, Inc.).
0N/A *
0N/A * @return the guarantor which guaranteed the principal-key
0N/A * binding.
0N/A */
0N/A public abstract Principal getGuarantor();
0N/A
0N/A /**
0N/A * Returns the principal of the principal-key pair being guaranteed by
0N/A * the guarantor.
0N/A *
0N/A * @return the principal to which this certificate is bound.
0N/A */
0N/A public abstract Principal getPrincipal();
0N/A
0N/A /**
0N/A * Returns the key of the principal-key pair being guaranteed by
0N/A * the guarantor.
0N/A *
0N/A * @return the public key that this certificate certifies belongs
0N/A * to a particular principal.
0N/A */
0N/A public abstract PublicKey getPublicKey();
0N/A
0N/A /**
0N/A * Encodes the certificate to an output stream in a format that can
0N/A * be decoded by the <code>decode</code> method.
0N/A *
0N/A * @param stream the output stream to which to encode the
0N/A * certificate.
0N/A *
0N/A * @exception KeyException if the certificate is not
0N/A * properly initialized, or data is missing, etc.
0N/A *
0N/A * @exception IOException if a stream exception occurs while
0N/A * trying to output the encoded certificate to the output stream.
0N/A *
0N/A * @see #decode
0N/A * @see #getFormat
0N/A */
0N/A public abstract void encode(OutputStream stream)
0N/A throws KeyException, IOException;
0N/A
0N/A /**
0N/A * Decodes a certificate from an input stream. The format should be
0N/A * that returned by <code>getFormat</code> and produced by
0N/A * <code>encode</code>.
0N/A *
0N/A * @param stream the input stream from which to fetch the data
0N/A * being decoded.
0N/A *
0N/A * @exception KeyException if the certificate is not properly initialized,
0N/A * or data is missing, etc.
0N/A *
0N/A * @exception IOException if an exception occurs while trying to input
0N/A * the encoded certificate from the input stream.
0N/A *
0N/A * @see #encode
0N/A * @see #getFormat
0N/A */
0N/A public abstract void decode(InputStream stream)
0N/A throws KeyException, IOException;
0N/A
0N/A
0N/A /**
0N/A * Returns the name of the coding format. This is used as a hint to find
0N/A * an appropriate parser. It could be "X.509", "PGP", etc. This is
0N/A * the format produced and understood by the <code>encode</code>
0N/A * and <code>decode</code> methods.
0N/A *
0N/A * @return the name of the coding format.
0N/A */
0N/A public abstract String getFormat();
0N/A
0N/A /**
0N/A * Returns a string that represents the contents of the certificate.
0N/A *
0N/A * @param detailed whether or not to give detailed information
0N/A * about the certificate
0N/A *
0N/A * @return a string representing the contents of the certificate
0N/A */
0N/A public String toString(boolean detailed);
0N/A}