Skip to content

Most visited

Recently visited

navigation
Added in API level 1

Certificate

public abstract class Certificate
extends Object implements Serializable

java.lang.Object
   ↳ java.security.cert.Certificate
Known Direct Subclasses


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.

Summary

Nested classes

class Certificate.CertificateRep

The alternate Serializable class to be used for serialization and deserialization of Certificate objects. 

Protected constructors

Certificate(String type)

Creates a new Certificate with the specified type.

Public methods

boolean equals(Object other)

Compares the argument to the certificate, 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.

final String getType()

Returns the certificate type.

int hashCode()

Returns an integer hash code for the certificate.

abstract String toString()

Returns a string containing a concise, human-readable description of the certificate.

abstract void verify(PublicKey key, String sigProvider)

Verifies that this certificate was signed with the given public key.

abstract void verify(PublicKey key)

Verifies that this certificate was signed with the given public key.

Protected methods

Object writeReplace()

Returns an alternate object to be serialized.

Inherited methods

From class java.lang.Object

Protected constructors

Certificate

Added in API level 1
Certificate (String type)

Creates a new Certificate with the specified type.

Parameters
type String: the certificate type.

Public methods

equals

Added in API level 1
boolean equals (Object other)

Compares the argument to the certificate, 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 callee (==).

Parameters
other Object: the object to compare with this object.
Returns
boolean true if the object is the same as this object, false if it is different from this object.

See also:

getEncoded

Added in API level 1
byte[] getEncoded ()

Returns the encoded representation for this certificate.

Returns
byte[] the encoded representation for this certificate.
Throws
CertificateEncodingException if the encoding fails.

getPublicKey

Added in API level 1
PublicKey getPublicKey ()

Returns the public key corresponding to this certificate.

Returns
PublicKey the public key corresponding to this certificate.

getType

Added in API level 1
String getType ()

Returns the certificate type.

Returns
String the certificate type.

hashCode

Added in API level 1
int hashCode ()

Returns an integer hash code for the certificate. Any two objects which return true when passed to equals must return the same value for this method.

Returns
int the certificate's hash

See also:

toString

Added in API level 1
String toString ()

Returns a string containing a concise, human-readable description of the certificate.

Returns
String a printable representation for the certificate.

verify

Added in API level 1
void verify (PublicKey key, 
                String sigProvider)

Verifies that this certificate was signed with the given public key. It Uses the signature algorithm given by the provider.

Parameters
key PublicKey: PublicKey public key for which verification should be performed.
sigProvider String: 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 the specified provider does not exists.
SignatureException if signature errors are detected.

verify

Added in API level 1
void verify (PublicKey key)

Verifies that this certificate was signed with the given public key.

Parameters
key PublicKey: 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.

Protected methods

writeReplace

Added in API level 1
Object writeReplace ()

Returns an alternate object to be serialized.

Returns
Object the object to serialize.
Throws
ObjectStreamException if the creation of the alternate object fails.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.