|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.rim.device.api.crypto.certificate.CertificateUtilities
Verifies certificate chains.
Certificate,
CertificateFactory,
CertificateStatus| Method Summary | ||
|
static Certificate[] |
buildCertificateChain(Certificate certificate,
Certificate[] pool,
KeyStore keyStore)
Builds a certificate chain for a certificate from a pool of certificates and a keystore. |
|
static Certificate[] |
buildCertificateChain(Certificate certificate,
KeyStore keyStore)
Builds a certificate chain for a certificate from a keystore. |
|
static Certificate[][] |
buildCertificateChains(Certificate certificate,
Certificate[] pool,
KeyStore keyStore)
Builds all of the certificate chains for a certificate from a pool of certificates and a keystore. |
|
static Certificate[][] |
buildCertificateChains(Certificate certificate,
KeyStore keyStore)
Builds all of the certificate chains for a certificate from a keystore. |
|
static Certificate[] |
buildTrustedCertificateChain(Certificate certificate,
Certificate[] pool,
KeyStore keyStore,
KeyStore trustedKeyStore)
Builds a trusted certificate chain for a certificate from a pool of certificates and a keystore. |
|
static Certificate[][] |
buildTrustedCertificateChains(Certificate certificate,
Certificate[] pool,
KeyStore keyStore,
KeyStore trustedKeyStore)
Builds all of the trusted certificate chains for a certificate from a pool of certificates and a keystore. |
|
static String |
calculateThumbprint(Certificate certificate,
Digest digest)
Calculates the thumbprint of the certificate using the given digest. |
|
static boolean |
compareDistinguishedNames(DistinguishedName dn1,
DistinguishedName dn2)
Compares two DistinguishedNames component by component, and returns true if they both have the same number of components and same values for each component. |
|
static void |
displayCertificateDetails(Certificate certificate)
Blocks and displays a dialog box containing information about the specified certificate. |
|
static void |
displayCertificateDetails(Certificate certificate,
KeyStore keyStore)
Blocks and displays a dialog box containing information about the specified certificate. |
|
static void |
displayCertificateDetails(Certificate certificate,
KeyStore keyStore,
boolean allowFetchStatus,
CertificateStatusManagerTicket ticket)
Blocks and displays a dialog box containing information about the specified certificate. |
|
static String |
getFriendlyName(DistinguishedName distinguishedName)
Returns a string that contains a "friendly" name for the distinguished name of a certificate. |
|
static String |
getHexAsciiString(byte[] data)
Returns a String containing the hexadecimal ASCII encoding of the given data. |
|
static String |
getHexAsciiString(byte[] data,
int offset,
int length)
Returns a String containing the hexadecimal ASCII encoding of the given data. |
|
static String |
getKeyUsageString(long keyUsage)
Returns a String that determines how the key is used. |
|
static String |
getSubjectFriendlyName(Certificate certificate)
Returns a string that contains a "friendly" name for the subject of this certificate. |
|
static boolean |
isCertificateChainTrusted(Certificate[] chain,
KeyStore trustedKeyStore)
Determines if the chain is trusted. |
|
static boolean |
isCertificateTrusted(Certificate certificate,
Certificate[] pool,
KeyStore keyStore,
KeyStore trustedKeyStore)
Determines if this certificate is trusted by trying to build a chain into the trustedKeyStore. |
|
static boolean |
isCertificateTrusted(Certificate certificate,
KeyStore trustedKeyStore)
Determines if this certificate is trusted by trying to build a chain into the trustedKeyStore. |
|
static int |
selectCertificate(RichTextField descriptionField,
String[] names,
Certificate[] certificates,
KeyStore keyStore)
This method displays a dialog prompting the user to select a certificate from the list of certificates provided. |
|
static int[] |
selectCertificates(RichTextField descriptionField,
String[] names,
Certificate[] certificates,
int[] selectedCertificates,
KeyStore keyStore)
This method displays a dialog prompting the user to select a group of certificates from the list of certificates provided. |
|
static int[] |
selectCertificates(RichTextField descriptionField,
String[] names,
Certificate[] certificates,
KeyStore keyStore)
This method displays a dialog prompting the user to select a group of certificates from the list of certificates provided. |
|
static boolean |
verifyCertificateChain(Certificate[] chain,
KeyStore trustedKeyStore,
long date)
Verifies the signatures of the certificates in a chain. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static Certificate[] buildCertificateChain(Certificate certificate, KeyStore keyStore)
The chain will be built up until a root certificate is encountered, or until the issuer of a certificate cannot be found in the keystore.
certificate - The certificate for which the chain should be built.keyStore - The keystore that should be searched when looking for certificates in the chain. Note this can be null.certificate in position 0, its issuer in position 1, etc.public static Certificate[] buildCertificateChain(Certificate certificate, Certificate[] pool, KeyStore keyStore)
The chain will be built up until a root certificate is encountered, or until the issuer of a certificate cannot be found in the pool or in the keystore. The pool will be searched first for each issuer certificate, and if the certificate is not found there, the keystore will be searched.
certificate - The certificate for which the chain will be built.pool - The pool of certificates that should be searched for certificates in the chain. Note this can be null.keyStore - The keystore that should be searched for certificates in the chain. Note this can be null.certificate in position 0, its issuer in position 1, etc.public static Certificate[][] buildCertificateChains(Certificate certificate, KeyStore keyStore)
The chains will be built up until a root certificate is encountered, or until the issuer of a certificate cannot be found in the keystore.
certificate - The certificate for which the chains should be built.keyStore - The keystore that should be searched for certificates in the chains. Note this can be null.certificate in position 0, its issuer in position 1, etc.public static Certificate[][] buildCertificateChains(Certificate certificate, Certificate[] pool, KeyStore keyStore)
The chains will be built up until a root certificate is encountered, or until the issuer of a certificate cannot be found in the pool or in the keystore. The pool will be searched first for each issuer certificate, and if the certificate is not found there, the keystore will be searched.
certificate - The certificate for which the chains will be built.pool - The pool of certificates that should be searched for certificates in the chains. Note this can be null.keyStore - The keystore that should be searched for certificates in the chains. Note this can be null.certificate in position 0, its issuer in position 1, etc.public static Certificate[] buildTrustedCertificateChain(Certificate certificate, Certificate[] pool, KeyStore keyStore, KeyStore trustedKeyStore)
The chain will be built up until a root certificate is encountered, or until the issuer of a certificate cannot be found in the pool or in the keystore. The pool will be searched first for each issuer certificate, and if the certificate is not found there, the keystore will be searched.
certificate - The certificate for which the chain will be built.pool - The pool of certificates that should be searched for certificates in the chain. Note this can be null.keyStore - The keystore that should be searched for certificates in the chain. Note this can be null.trustedKeyStore - The keystore that should be searched for the trusted certificates.certificate in position 0, its issuer in position 1, etc. or null
if no trusted chain could be created.public static Certificate[][] buildTrustedCertificateChains(Certificate certificate, Certificate[] pool, KeyStore keyStore, KeyStore trustedKeyStore)
The chains will be built up until a root certificate is encountered, or until the issuer of a certificate cannot be found in the pool or in the keystore. The pool will be searched first for each issuer certificate, and if the certificate is not found there, the keystore will be searched.
certificate - The certificate for which the chains will be built.pool - The pool of certificates that should be searched for certificates in the chains. Note this can be null.keyStore - The keystore that should be searched for certificates in the chains. Note this can be null.trustedKeyStore - The keystore that should be searched for the trusted certificates.certificate in position 0, its issuer in position 1, etc. or null if no trusted chain
could be created.public static boolean verifyCertificateChain(Certificate[] chain, KeyStore trustedKeyStore, long date) throws CertificateVerificationException, CertificateChainTooLongException, CertificateRevokedException, CertificateInvalidException, DecodeException, InvalidSignatureEncodingException, NoSuchAlgorithmException, CryptoTokenException, CryptoUnsupportedOperationException, InvalidCryptoSystemException
The last known on-device status of each certificate is checked as the signatures are verified. The function returns normally if every signature verifies properly, and no certificate in the chain is known to be revoked.
chain - The chain of certificates to be verified. Must be non null and contain at least one certificate.
Note that the end entity certificate must appear at array index [0].trustedKeyStore - A keyStore that contains keys that the user trusts.date - The date of the signature.trustedKeyStore, and false
if no certificate in the chain was contained in trustedKeyStore.CertificateVerificationException - Thrown if a signature on a certificate in the chain did not
verify properlyCertificateChainTooLongException - Thrown if the chain is longer than allowed by the CA's path length
constraint, as defined in the Basic Constraints ExtensionCertificateRevokedException - Thrown if a certificate in the chain is known to be revokedCertificateInvalidException - Thrown if a certificate in the chain is not valid (ie. it has expired
or it has not yet become valid).DecodeException - Thrown if an error occurs while decoding the certificate.InvalidSignatureEncodingException - Thrown if a signature is encoded incorrectly.NoSuchAlgorithmException - Thrown if the specified algorithm is invalid.CryptoTokenException - Thrown if an error occurs with the crypto token or the crypto token is invalid.CryptoUnsupportedOperationException - Thrown if a call is made to an unsupported operation.InvalidCryptoSystemException - Thrown if the specified crypto system is invalid.public static boolean isCertificateChainTrusted(Certificate[] chain, KeyStore trustedKeyStore)
Returns true if the certificate chain contains some certificate in the trusted key store, and false otherwise. Note that this function does not verify signatures, check revocation statuses, or check the validity of any of the certificates in the chain.
chain - The specified certificate chain. Must be non null, with at least one certificate in the chain.
Note that the end entity certificate must appear at array index [0].trustedKeyStore - The trusted key store.public static boolean isCertificateTrusted(Certificate certificate, KeyStore trustedKeyStore)
Note that this function does not verify signatures, check revocation statuses, or check the validity of any of the certificates in the chain.
certificate - The certificate to check.trustedKeyStore - The trusted key store.public static boolean isCertificateTrusted(Certificate certificate, Certificate[] pool, KeyStore keyStore, KeyStore trustedKeyStore)
Note that this function does not verify signatures, revocation status, or validity of any of the certificates in the chain.
certificate - The certificate to check.pool - A certificate array of potential members in the certificate chain. Can be null.keyStore - A key store to try and find potential members of the certificate chain. Can be null.trustedKeyStore - The trusted key store.public static String getSubjectFriendlyName(Certificate certificate)
The friendly name created using the first present attribute in the following list, taken from the subject distinguished name.
certificate - The specified certificate.public static String getFriendlyName(DistinguishedName distinguishedName)
The friendly name created using the first present attribute in the following list, taken from the distinguished name provided as the parameter to this method.
distinguishedName - The specified DistinguishedName.public static void displayCertificateDetails(Certificate certificate)
certificate - The certificate about which information is to be displayed.public static void displayCertificateDetails(Certificate certificate, KeyStore keyStore)
certificate - The certificate about which information is to be displayed.keyStore - The key store that will be searched for the issuer's certificate.public static void displayCertificateDetails(Certificate certificate, KeyStore keyStore, boolean allowFetchStatus, CertificateStatusManagerTicket ticket)
certificate - The certificate about which information is to be displayed.keyStore - The key store that will be searched for the issuer's certificate.allowFetchStatus - If set to true, the dialog will contain a button for fetching the
certificate's status over the air.ticket - A CertificateStatusManagerTicket to be used to update the certificate status
if requested. If this is null, the user will be prompted for their password.public static String calculateThumbprint(Certificate certificate, Digest digest)
certificate - The certificate to calculate the thumbprint on.digest - The digest used in the calculation of the thumbprint.public static String getHexAsciiString(byte[] data)
data - The specified byte buffer.public static String getHexAsciiString(byte[] data, int offset, int length)
data - The specified byte buffer.offset - The starting position of the data in the array.length - The length of the data in the array.public static String getKeyUsageString(long keyUsage)
keyUsage - A long that represents how the key is used.public static int selectCertificate(RichTextField descriptionField, String[] names, Certificate[] certificates, KeyStore keyStore)
descriptionField - A field that will be inserted at the top of the dialog. This field should describe
the reason the user is selecting a certificate.names - An array of strings containing the names of the certificates that you want to
show the user. These could be the DNs of the certificates, the labels of the key store data
or something else.certificates - An array of Certificate objects that contain the certificates that you are considering using.keyStore - A keystore that will be used to display the certificate details for any of the certificates provided.
Providing the keystore, allows the certificate display dialog to show information about the issuer of the certificate.
This parameter may be null.data array of the certificate that was selected by the user.
If the user selects cancel, -1 is returned.public static int[] selectCertificates(RichTextField descriptionField, String[] names, Certificate[] certificates, KeyStore keyStore)
descriptionField - A field that will be inserted at the top of the dialog. This field should describe
the reason the user is selecting certificates.names - An array of strings containing the names of the certificates that you want to
show the user. These could be the DNs of the certificates, the labels of the key store data
or something else.certificates - An array of Certificate objects that contain the certificates that you are considering using.keyStore - A keystore that will be used to display the certificate details for any of the certificates provided.
Providing the keystore, allows the certificate display dialog to show information about the issuer of the certificate.
This parameter may be null.data array ) that was selected by the user.
Returns null if the user selected cancel. Returns an empty array is no certificates were selected.public static int[] selectCertificates(RichTextField descriptionField, String[] names, Certificate[] certificates, int[] selectedCertificates, KeyStore keyStore)
descriptionField - A field that will be inserted at the top of the dialog. This field should describe
the reason the user is selecting certificates.names - An array of strings containing the names of the certificates that you want to
show the user. These could be the DNs of the certificates, the labels of the key store data
or something else.certificates - An array of Certificate objects that contain the certificates that you are considering using.keyStore - A keystore that will be used to display the certificate details for any of the certificates provided.
Providing the keystore, allows the certificate display dialog to show information about the issuer of the certificate.
This parameter may be null.selectedCertificates - An array of indicies ( within the data array ) which indicate which certificates
are to be selected by default when the dialog first gets displayed. If this parameter is null, no certificates are selected when
the dialog first gets displayed.data array ) that was selected by the user.
Returns null if the user selected cancel. Returns an empty array if no certificates were selected.public static boolean compareDistinguishedNames(DistinguishedName dn1, DistinguishedName dn2)
dn1 - The first distinguished name to compare. Must be non null.dn2 - The second distinguished name to compare. Must be non null.
|
|||||||||
| 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.