to top
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 ()

Since: API Level 1

Creates a new Certificate.

Public Methods

public boolean equals (Object obj)

Since: API Level 1

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

Parameters
obj the Certificate to compare with this object
Returns
  • true if obj is the same as this Certificate, false otherwise
See Also

public abstract byte[] getEncoded ()

Since: API Level 1

Returns the encoded representation for this certificate.

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

public abstract PublicKey getPublicKey ()

Since: API Level 1

Returns the public key corresponding to this certificate.

Returns
  • the public key corresponding to this certificate.

public int hashCode ()

Since: 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
  • the receiver's hash
See Also

public abstract String toString ()

Since: API Level 1

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

Returns
  • a printable representation for the receiver.

public abstract void verify (PublicKey key, String sigProvider)

Since: API Level 1

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

Parameters
key public key for which verification should be performed.
sigProvider 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)

Since: API Level 1

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

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