All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.security.cert.Certificate Maven / Gradle / Ivy

/*

This is not an official specification document, and usage is restricted.

NOTICE


(c) 2005-2007 Sun Microsystems, Inc. All Rights Reserved.

Neither this file nor any files generated from it describe a complete specification, and they may only be used as described below. For example, no permission is given for you to incorporate this file, in whole or in part, in an implementation of a Java specification.

Sun Microsystems Inc. owns the copyright in this file and it is provided to you for informative, as opposed to normative, use. The file and any files generated from it may be used to generate other informative documentation, such as a unified set of documents of API signatures for a platform that includes technologies expressed as Java APIs. The file may also be used to produce "compilation stubs," which allow applications to be compiled and validated for such platforms.

Any work generated from this file, such as unified javadocs or compiled stub files, must be accompanied by this notice in its entirety.

This work corresponds to the API signatures of CDC Security (Java Secure Socket Extension - JSSE) Optional Package interfaces and modules. */ /* * @(#)Certificate.java 1.6 05/03/12 */ /* * NOTE: * Because of various external restrictions (i.e. US export * regulations, etc.), the actual source code can not be provided * at this time. This file represents the skeleton of the source * file, so that javadocs of the API can be created. */ package javax.security.cert; import java.security.PublicKey; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.InvalidKeyException; import java.security.SignatureException; /** *

Abstract class for managing a variety of identity certificates. * An identity certificate is a guarantee by a principal that * a public key is that of another principal. (A principal represents * an entity such as an individual user, a group, or a corporation.) *

* This class is an abstraction for certificates that have different * formats but important common uses. For example, different types of * certificates, such as X.509 and PGP, share general certificate * functionality (like encoding and verifying) and * some types of information (like a public key). *

* X.509, PGP, and SDSI certificates can all be implemented by * subclassing the Certificate class, even though they contain different * sets of information, and they store and retrieve the information in * different ways. * *

Note: The classes in the package javax.security.cert * exist for compatibility with earlier versions of the * Java Secure Sockets Extension (JSSE). New applications should instead * use the standard J2SE certificate classes located in * java.security.cert.

* * @since 1.4 * @see X509Certificate * * @author Hemma Prafullchandra * @version 1.15 */ public abstract class Certificate { public Certificate() { } /** * Compares this certificate for equality with the specified * object. If the other object is an * instanceof Certificate, then * its encoded form is retrieved and compared with the * encoded form of this certificate. * * @param other the object to test for equality with this certificate. * @return true if the encoded forms of the two certificates * match, false otherwise. */ public boolean equals(Object other) { return false; } /** * Returns a hashcode value for this certificate from its * encoded form. * * @return the hashcode value. */ public int hashCode() { return 0; } /** * Returns the encoded form of this certificate. It is * assumed that each certificate type would have only a single * form of encoding; for example, X.509 certificates would * be encoded as ASN.1 DER. * * @return encoded form of this certificate * @exception CertificateEncodingException on internal certificate * encoding failure */ public abstract byte[] getEncoded() throws CertificateEncodingException; /** * Verifies that this certificate was signed using the * private key that corresponds to the specified public key. * * @param key the PublicKey used to carry out the verification. * * @exception NoSuchAlgorithmException on unsupported signature * algorithms. * @exception InvalidKeyException on incorrect key. * @exception NoSuchProviderException if there's no default provider. * @exception SignatureException on signature errors. * @exception CertificateException on encoding errors. */ public abstract void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException; /** * Verifies that this certificate was signed using the * private key that corresponds to the specified public key. * This method uses the signature verification engine * supplied by the specified provider. * * @param key the PublicKey used to carry out the verification. * @param sigProvider the name of the signature provider. * @exception NoSuchAlgorithmException on unsupported signature algorithms. * @exception InvalidKeyException on incorrect key. * @exception NoSuchProviderException on incorrect provider. * @exception SignatureException on signature errors. * @exception CertificateException on encoding errors. */ public abstract void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException; /** * Returns a string representation of this certificate. * * @return a string representation of this certificate. */ public abstract String toString(); /** * Gets the public key from this certificate. * * @return the public key. */ public abstract PublicKey getPublicKey(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy