Skip to content

Most visited

Recently visited

navigation
Added in API level 1

Certificate

public abstract class Certificate
extends Object

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

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.

Inherited methods

From class java.lang.Object

Public constructors

Certificate

Added in API level 1
Certificate ()

Creates a new Certificate.

Public methods

equals

Added in API level 1
boolean equals (Object obj)

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:

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

hashCode

Added in API level 1
int hashCode ()

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:

toString

Added in API level 1
String toString ()

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

Returns
String a printable representation for the receiver.

verify

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

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

verify

Added in API level 1
void verify (PublicKey key)

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