Android APIs
public abstract class

Certificate

extends Object
implements Serializable
java.lang.Object
   ↳ java.security.cert.Certificate
Known Direct Subclasses

Class Overview

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.
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected Certificate (String type)

Added in API level 1

Creates a new Certificate with the specified type.

Parameters
type the certificate type.

Public Methods

public boolean equals (Object other)

Added in API level 1

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 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

public abstract byte[] getEncoded ()

Added in API level 1

Returns the encoded representation for this certificate.

Returns
  • the encoded representation for this certificate.
Throws
CertificateEncodingException if the encoding fails.

public abstract PublicKey getPublicKey ()

Added in API level 1

Returns the public key corresponding to this certificate.

Returns
  • the public key corresponding to this certificate.

public final String getType ()

Added in API level 1

Returns the certificate type.

Returns
  • the certificate type.

public int hashCode ()

Added in API level 1

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
  • the certificate's hash
See Also

public abstract String toString ()

Added in API level 1

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

Returns
  • a printable representation for the certificate.

public abstract void verify (PublicKey key, String sigProvider)

Added in API level 1

Verifies that this certificate was signed with the given public key. It 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 the specified provider does not exists.
SignatureException if signature errors are detected.

public abstract void verify (PublicKey key)

Added in API level 1

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.

Protected Methods

protected Object writeReplace ()

Added in API level 1

Returns an alternate object to be serialized.

Returns
  • the object to serialize.
Throws
ObjectStreamException if the creation of the alternate object fails.