Build 1.0_r1(from source)

java.security.cert
Class Certificate

java.lang.Object
  extended by java.security.cert.Certificate
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
X509Certificate

public abstract class Certificate
extends Object
implements Serializable

Abstract class to represent identity certificates. It represents a way to verify the binding of a Principal and its public key. Examples are X.509, PGP, and SDSI.

See Also:
Serialized Form

Nested Class Summary
protected static class Certificate.CertificateRep
           
 
Constructor Summary
protected Certificate(String type)
           
 
Method Summary
 boolean equals(Object other)
          Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
abstract  byte[] getEncoded()
          Returns the encoded representation for this certificate.
abstract  PublicKey getPublicKey()
          Returns the public key corresponding to this certificate.
 String getType()
          Returns the certificate type represented by the receiver.
 int hashCode()
          Returns an integer hash code for the receiver.
abstract  String toString()
          Returns a string containing a concise, human-readable description of the receiver.
abstract  void verify(PublicKey key)
          Verifies that this certificate was signed with the given public key.
abstract  void verify(PublicKey key, String sigProvider)
          Verifies that this certificate was signed with the given public key.
protected  Object writeReplace()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Certificate

protected Certificate(String type)
Method Detail

getType

public final String getType()
Returns the certificate type represented by the receiver.

Returns:
the certificate type represented by the receiver.

equals

public boolean equals(Object other)
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. The implementation in Object returns true only if the argument is the exact same object as the receiver (==).

Overrides:
equals in class Object
Parameters:
other - the object to compare with this object
Returns:
true if the object is the same as this object false if it is different from this object
See Also:
hashCode()

hashCode

public int hashCode()
Returns an integer hash code for the receiver. Any two objects which answer true when passed to equals must answer the same value for this method.

Overrides:
hashCode in class Object
Returns:
the receiver's hash
See Also:
equals(java.lang.Object)

getEncoded

public abstract byte[] getEncoded()
                           throws CertificateEncodingException
Returns the encoded representation for this certificate.

Returns:
the encoded representation for this certificate.
Throws:
CertificateEncodingException

verify

public abstract void verify(PublicKey key)
                     throws CertificateException,
                            NoSuchAlgorithmException,
                            InvalidKeyException,
                            NoSuchProviderException,
                            SignatureException
Verifies that this certificate was signed with the given public key.

Parameters:
key - PublicKey public key for which verification should be performed.
Throws:
CertificateException - if encoding errors are detected
NoSuchAlgorithmException - if an unsupported algorithm is detected
InvalidKeyException - if an invalid key is detected
NoSuchProviderException - if there is no default provider
SignatureException - if signature errors are detected

verify

public abstract void verify(PublicKey key,
                            String sigProvider)
                     throws CertificateException,
                            NoSuchAlgorithmException,
                            InvalidKeyException,
                            NoSuchProviderException,
                            SignatureException
Verifies that this certificate was signed with the given public key. Uses the signature algorithm given by the provider.

Parameters:
key - PublicKey public key for which verification should be performed.
sigProvider - String the name of the signature provider.
Throws:
CertificateException - if encoding errors are detected
NoSuchAlgorithmException - if an unsupported algorithm is detected
InvalidKeyException - if an invalid key is detected
NoSuchProviderException - if there is no default provider
SignatureException - if signature errors are detected

toString

public abstract String toString()
Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
a printable representation for the receiver.

getPublicKey

public abstract PublicKey getPublicKey()
Returns the public key corresponding to this certificate.

Returns:
the public key corresponding to this certificate.

writeReplace

protected Object writeReplace()
                       throws ObjectStreamException
Throws:
ObjectStreamException

Build 1.0_r1(from source)

Please submit a feedback, bug or feature