|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Defines the properties of all certificates. A certificate is a collection of data used to associate a public key with an identity.
CertificateStatus,
CertificateField,
CertificateFactory| Field Summary | ||
|
static long |
EMAIL_ADDRESSES
The identifier to indicate the extraction of email addresses from the certificate. |
| Method Summary | ||
|
void |
checkCertificateChain(int position,
Certificate[] chain)
Checks to make sure that the certificate at position is valid within the chain.
|
|
CertificateDisplayField[] |
getCustomDisplayFields()
Returns custom information about the certificate for display in a dialog. |
|
byte[] |
getEncoding()
Returns the encoding of the certificate. |
|
byte[] |
getEncoding(int field)
Returns the encoding of the field within the certificate (see CertificateField).
|
|
CertificateExtension |
getExtension(OID oid)
Returns the extension for the given oid if it exists in the certificate, otherwise null.
|
|
CertificateExtension[] |
getExtensions()
Returns all the extensions associated with this certificate, or null. |
|
CertificateExtension[] |
getExtensions(boolean criticalBit)
Returns all the extensions associated with this certificate that have their critical bit set to the value of criticalBit, or null if none are found.
|
|
Object |
getInformation(long id,
Object param,
Object defaultValue)
Retrieves generic information about the certificate |
|
DistinguishedName |
getIssuer()
Returns a DistinguishedName object,
representing the issuer of this certificate.
|
|
long |
getNotAfter()
Returns the date on which this certificate will expire. |
|
long |
getNotBefore()
Returns the date on which this certificate will become valid. |
|
PublicKey |
getPublicKey()
Extracts the subject's public key. |
|
String |
getPublicKeyAlgorithm()
Returns a string representing the intended use of the public key. |
|
byte[] |
getSerialNumber()
Returns the certificates serial number as a byte array representing an an integer in big-endian (network) order. |
|
String |
getSignatureAlgorithm()
Returns a string representing the signature algorithm used to sign this certificate. |
|
CertificateStatus |
getStatus()
Retrieves the CertificateStatus for this certificate object |
|
DistinguishedName |
getSubject()
Returns a DistinguishedName object,
representing the subject name of this certificate.
|
|
String |
getSubjectFriendlyName()
Returns a human-readable string version of the name of the subject of this certificate. |
|
String |
getType()
Returns the type of this certificate, such as "X509", "WTLS" etc. |
|
int |
getVersion()
Returns the version of the certificate. |
|
boolean |
isCA()
Returns true if the certificate is of a certificate authority. |
|
boolean |
isRoot()
Returns true if the certificate is self signed. |
|
boolean |
isValid()
Checks that this certificate is valid, using the current date and time as the time reference. |
|
boolean |
isValid(long date)
Check that this certificate is valid, using date
as the time reference.
|
|
int |
queryKeyUsage(long purpose)
Indicates whether the key contained in this certificate may be used for the specified purpose. |
|
void |
setStatus(CertificateStatus status)
Sets the current CertificateStatus for this certificate object. |
|
void |
verify()
Verifies the certificate if the certificate is self signed. |
|
void |
verify(KeyStore keyStore)
Verifies the certificate. |
|
void |
verify(PublicKey issuerPublicKey)
Verifies the certificate. |
| Field Detail |
public static final long EMAIL_ADDRESSES
| Method Detail |
public void verify(PublicKey issuerPublicKey) throws CertificateVerificationException, DecodeException, InvalidSignatureEncodingException, NoSuchAlgorithmException, CryptoTokenException, CryptoUnsupportedOperationException
The function checks that the certificate was signed by
issuerPublicKey.
issuerPublicKey - The public key of the certificate issuer.CertificateVerificationException - Thrown if the certificate cannot
be verified.DecodeException - Thrown if the data is improperly
formatted.InvalidSignatureEncodingException - Thrown if the specified
signature is invalid.NoSuchAlgorithmException - Thrown if the specified algorithm is
not known.CryptoTokenException - Thrown if an error occurs with the crypto
token or crypto token is invalid.CryptoUnsupportedOperationException - Thrown if a call is made to
an unsupported operation.public void verify(KeyStore keyStore) throws CertificateVerificationException, DecodeException, InvalidSignatureEncodingException, NoSuchAlgorithmException, NoIssuerFoundException, CryptoTokenException, CryptoUnsupportedOperationException
The function checks that the certificate was signed by at least one of the publicKeys from the
given keyStore.
keyStore - The keyStore that contains the keys.CertificateVerificationException - Thrown if the certificate cannot
be verified.DecodeException - Thrown if the data is improperly
formatted.InvalidSignatureEncodingException - Thrown if the specified
signature is invalid.NoSuchAlgorithmException - Thrown if the specified algorithm is
not known.NoIssuerFoundException - Thrown when the issuer of the certificate cannot
be found.CryptoTokenException - Thrown if an error occurs with the crypto
token or crypto token is invalid.CryptoUnsupportedOperationException - Thrown if a call is made to
an unsupported operation.public boolean isRoot()
public boolean isCA()
public void verify()
throws CertificateVerificationException,
DecodeException,
InvalidSignatureEncodingException,
NoSuchAlgorithmException,
CryptoTokenException,
CryptoUnsupportedOperationException
CertificateVerificationException - Thrown if the certificate cannot
be verified.DecodeException - Thrown if the data is improperly
formatted.InvalidSignatureEncodingException - Thrown if the specified
signature is invalid.NoSuchAlgorithmException - Thrown if the specified algorithm is
not known.CryptoTokenException - Thrown if an error occurs with the crypto
token or crypto token is invalid.CryptoUnsupportedOperationException - Thrown if a call is made to
an unsupported operation.
public void checkCertificateChain(int position,
Certificate[] chain)
throws CertificateChainTooLongException,
CertificateVerificationException
position is valid within the chain.
position - The position of this ceritificate within the chain.chain - The array of certificates representing the certificate chain. The end-entity cert
must be at array index [0].CertificateChainTooLongException - Thrown if the number of certificates, before this one,
in the chain is longer than the certificates policy allows.CertificateVerificationException - Thrown if there is another problem with the chainpublic PublicKey getPublicKey() throws InvalidCryptoSystemException
PublicKey.InvalidCryptoSystemException - Thrown if the crypto system used to create the key was invalid.public String getPublicKeyAlgorithm()
public String getSignatureAlgorithm()
public DistinguishedName getIssuer()
DistinguishedName object,
representing the issuer of this certificate.
public DistinguishedName getSubject()
DistinguishedName object,
representing the subject name of this certificate.
public CertificateStatus getStatus()
CertificateStatus stored for this
certificate on the device. May be null.public void setStatus(CertificateStatus status) throws KeyStoreCancelException, InvalidTimeException, BackwardStatusException
status - the new CertificateStatus that will be set for this
certificate. It is important to note that this status should not attempt
to set the status backwards (i.e. from REVOKED to GOOD) and it should
not allow the date of a status to be in the future.KeyStoreCancelException - if the user decides not to enter their
KeyStore password.InvalidTimeException - if the time of the status is set in the future.BackwardStatusException - if the status of the certificate is being
backwards (i.e. from REVOKED to GOOD ).public boolean isValid()
It checks that the current date is between the
values returned by getNotValidBefore() and
getNotValidAfter().
Note that this method only checks that the current date is within the validity period specified in the certificate.
verify()public boolean isValid(long date)
date
as the time reference.
It checks that date is between the
values returned by getNotBefore() and
getNotValidAfter().
Note that this method only checks that date is within the validity
period specified in the certificate.
date - The Date used to verify the certificate.verify()public long getNotBefore()
public long getNotAfter()
public CertificateExtension getExtension(OID oid)
null.
oid - The oid with the extension.CertificateExtension or null.OIDspublic CertificateExtension[] getExtensions()
CertificateExtensions or null.OIDspublic CertificateExtension[] getExtensions(boolean criticalBit)
criticalBit, or null if none are found.
criticalBit - a boolean that is true, if all critical extensions are to be returned and
set to false if all non-critical extensions are to be returnedCertificateExtensions or null.OIDspublic String getType()
public int getVersion()
The version is specific to the type of certificate.
public byte[] getSerialNumber()
public byte[] getEncoding()
public byte[] getEncoding(int field)
CertificateField).
field - An integer that represents the field.public String getSubjectFriendlyName()
This string could be used for display purposes, for example. For the default behaviour, which
attempts to build a friendly name using parts of the subject distinguished name, invoke
.
CertificateUtilities.getSubjectFriendlyName(Certificate
certificate)
public int queryKeyUsage(long purpose)
purpose - A constant chosen from the KeyUsage constants indicating the purpose for which
the key will be checked.KeyUsageResult.ALLOWED | Thrown if the subject public key may be used for the specified purpose. |
KeyUsageResult.NOT_ALLOWED | Thrown if the subject public key may not be used for the specified purpose. |
KeyUsageResult.UNSPECIFIED | Thrown if it is unspecified whether the subject public key may be used for this purpose. |
KeyUsageResultpublic CertificateDisplayField[] getCustomDisplayFields()
The displayCertificateDetails method in CertificateUtilities uses this custom information to format a
dialog box containing details about the certificate. Details common to all types of certificates,
like the subject name, issuer name, etc., are always displayed in the dialog; this function allows
specific certificate types to add specific information to the dialog.
CertificateDisplayField objects containing label/value pairs for the information that is to
be shown in the dialog, or null if no custom information should be displayedpublic Object getInformation(long id, Object param, Object defaultValue)
id - the id of the data to retrieveparam - a parameter that may be used to determine what information to returndefaultValue - a default value that should be returned if the certificate does not recognize the id.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2002 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.