# Certificate

public abstract class **Certificate** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  

|---|---|---|
| Known Direct Subclasses [X509Certificate](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/X509Certificate.html) |---|---| | [X509Certificate](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/X509Certificate.html) | Abstract class for X.509 v1 certificates. | |||

<br />

Abstract class for managing a variety of identity certificates.
An identity certificate is a guarantee by a principal that
a public key is that of another principal. (A principal represents
an entity such as an individual user, a group, or a corporation.)


This class is an abstraction for certificates that have different
formats but important common uses. For example, different types of
certificates, such as X.509 and PGP, share general certificate
functionality (like encoding and verifying) and
some types of information (like a public key).


X.509, PGP, and SDSI certificates can all be implemented by
subclassing the Certificate class, even though they contain different
sets of information, and they store and retrieve the information in
different ways.

*Note: The classes in the package `javax.security.cert`
exist for compatibility with earlier versions of the
Java Secure Sockets Extension (JSSE). New applications should instead
use the standard Java SE certificate classes located in
`java.security.cert`.*

<br />

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/X509Certificate.html`

### Public Constructor Summary

|---|---|
|   | [Certificate](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/Certificate.html#Certificate())() |

### Public Method Summary

|---|---|
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/Certificate.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) other) Compares this certificate for equality with the specified object. |
| abstract byte\[\] | [getEncoded](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/Certificate.html#getEncoded())() Returns the encoded form of this certificate. |
| abstract [PublicKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/PublicKey.html) | [getPublicKey](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/Certificate.html#getPublicKey())() Gets the public key from this certificate. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/Certificate.html#hashCode())() Returns a hashcode value for this certificate from its encoded form. |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/Certificate.html#toString())() Returns a string representation of this certificate. |
| abstract void | [verify](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/Certificate.html#verify(java.security.PublicKey,%20java.lang.String))([PublicKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/PublicKey.html) key, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) sigProvider) Verifies that this certificate was signed using the private key that corresponds to the specified public key. |
| abstract void | [verify](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/Certificate.html#verify(java.security.PublicKey))([PublicKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/PublicKey.html) key) Verifies that this certificate was signed using the private key that corresponds to the specified public key. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Constructors

#### public
**Certificate**
()

<br />

## Public Methods

#### public boolean
**equals**
([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) other)

Compares this certificate for equality with the specified
object. If the `other` object is an
`instanceof` `Certificate`, then
its encoded form is retrieved and compared with the
encoded form of this certificate.

##### Parameters

| other | the object to test for equality with this certificate. |
|---|---|

##### Returns

- true if the encoded forms of the two certificates match, false otherwise.

#### public abstract byte\[\]
**getEncoded**
()

Returns the encoded form of this certificate. It is
assumed that each certificate type would have only a single
form of encoding; for example, X.509 certificates would
be encoded as ASN.1 DER.

##### Returns

- encoded form of this certificate

##### Throws

| [CertificateEncodingException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/CertificateEncodingException.html) | on internal certificate encoding failure |
|---|---|

#### public abstract [PublicKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/PublicKey.html)
**getPublicKey**
()

Gets the public key from this certificate.

##### Returns

- the public key.

#### public int
**hashCode**
()

Returns a hashcode value for this certificate from its
encoded form.

##### Returns

- the hashcode value.

#### public abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toString**
()

Returns a string representation of this certificate.

##### Returns

- a string representation of this certificate.

#### public abstract void
**verify**
([PublicKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/PublicKey.html) key, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) sigProvider)

Verifies that this certificate was signed using the
private key that corresponds to the specified public key.
This method uses the signature verification engine
supplied by the specified provider.

##### Parameters

| key | the PublicKey used to carry out the verification. |
| sigProvider | the name of the signature provider. |
|---|---|

##### Throws

| [NoSuchAlgorithmException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/NoSuchAlgorithmException.html) | on unsupported signature algorithms. |
| [InvalidKeyException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidKeyException.html) | on incorrect key. |
| [NoSuchProviderException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/NoSuchProviderException.html) | on incorrect provider. |
| [SignatureException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/SignatureException.html) | on signature errors. |
| [CertificateException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/CertificateException.html) | on encoding errors. |
|---|---|

#### public abstract void
**verify**
([PublicKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/PublicKey.html) key)

Verifies that this certificate was signed using the
private key that corresponds to the specified public key.

##### Parameters

| key | the PublicKey used to carry out the verification. |
|---|---|

##### Throws

| [NoSuchAlgorithmException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/NoSuchAlgorithmException.html) | on unsupported signature algorithms. |
| [InvalidKeyException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidKeyException.html) | on incorrect key. |
| [NoSuchProviderException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/NoSuchProviderException.html) | if there's no default provider. |
| [SignatureException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/SignatureException.html) | on signature errors. |
| [CertificateException](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/cert/CertificateException.html) | on encoding errors. |
|---|---|