Android APIs
public abstract class

Certificate

extends Object
java.lang.Object
   ↳ javax.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.

Note: This package is provided only for compatibility reasons. It contains a simplified version of the java.security.cert package that was previously used by JSSE (Java SSL package). All applications that do not have to be compatible with older versions of JSSE (that is before Java SDK 1.5) should only use java.security.cert.

Summary

Public Constructors
Certificate()
Creates a new Certificate.
Public Methods
boolean equals(Object obj)
Compares the argument to this Certificate.
abstract byte[] getEncoded()
Returns the encoded representation for this certificate.
abstract PublicKey getPublicKey()
Returns the public key corresponding to this certificate.
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, 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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Certificate ()

Added in API level 1

Creates a new Certificate.

Public Methods

public boolean equals (Object obj)

Added in API level 1

Compares the argument to this Certificate. If both have the same bytes they are assumed to be equal.

Parameters
obj Object: the Certificate to compare with this object
Returns
boolean true if obj is the same as this Certificate, false otherwise

See also:

public abstract byte[] getEncoded ()

Added in API level 1

Returns the encoded representation for this certificate.

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

public abstract PublicKey getPublicKey ()

Added in API level 1

Returns the public key corresponding to this certificate.

Returns
PublicKey the public key corresponding to this certificate.

public int hashCode ()

Added in API level 1

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

Returns
int the receiver's hash

See also:

public abstract String toString ()

Added in API level 1

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

Returns
String a printable representation for the receiver.

public abstract void verify (PublicKey key, String sigProvider)

Added in API level 1

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