|
|||||||||
| 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.wtls.WTLSCertificate
Represents a WTLS certificate. The WTLS Certificate is defined in WAP-199-WTLS from Feb. 2000.
Certificate| Field Summary |
| Fields inherited from interface net.rim.device.api.crypto.certificate.Certificate |
DISPLAY_CA, DISPLAY_ROOT, EMAIL_ADDRESSES, IS_END_ENTITY, PROMPT_TO_TRUST_ON_IMPORT, PUBLIC_KEY_ALGORITHM_INFORMATION, SUMMARY_TEXT |
| Constructor Summary | ||
|
WTLSCertificate(byte[] input)
Creates a WTLSCertificate object given a byte array
containing the encoding of the certificate. |
|
|
WTLSCertificate(byte[] input,
int offset,
int length)
Creates a WTLSCertificate object given a byte array
containing the encoding of the certificate. |
|
|
WTLSCertificate(InputStream input)
Creates a WTLSCertificate object from
the given input stream. |
|
| Method Summary | ||
|
void |
checkCertificateChain(int position,
Certificate[] chain)
Checks to make sure that the certificate at position is valid within the chain. |
|
boolean |
equals(Object other)
Returns true if and only if the certificate is equal to
the object other. |
|
CertificateDisplayField[] |
getCustomDisplayFields()
For a WTLS certificate, the default information provided by the displayCertificateDetails method in CertificateUtilities is sufficient. |
|
byte[] |
getEncoding()
Returns the encoding of the certificate. |
|
byte[] |
getEncoding(int field)
Returns the encoding of the field from the certificate. |
|
CertificateExtension |
getExtension(OID oid)
Returns an extension with the given OID associated with this certificate. |
|
CertificateExtension[] |
getExtensions()
Returns all the extensions associated with this certificate. |
|
CertificateExtension[] |
getExtensions(boolean criticalBit)
Returns all the extensions associated with this certificate that have their critical bit set to the value of criticalBit. |
|
Object |
getInformation(long id,
Object param,
Object defaultValue)
Retrieves generic information about the certificate |
|
DistinguishedName |
getIssuer()
Returns a DistinguishedName (WTLSDistinguishedName) 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 a byte array containing the serial number of the certificate. |
|
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 (WTLSDistinguishedName) object, representing the subject name this certificate (in different representations). |
|
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 - "WTLS". |
|
int |
getVersion()
Returns the version of the certificate we have parsed. |
|
int |
hashCode()
Returns a hash code value for the object. |
|
boolean |
isCA()
Returns true if the certificate is of a certificate authority. |
|
boolean |
isRoot()
Returns true if the certificate is self signed. |
|
boolean |
isValid()
Check 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. |
|
String |
toString()
Converts the certificate to a string representation by calling CertificateUtilities.getSubjectFriendlyName(). |
|
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. |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public WTLSCertificate(byte[] input)
throws CertificateParsingException,
NoSuchAlgorithmException
WTLSCertificate object given a byte array
containing the encoding of the certificate.
input - A byte array containing the certificate data.CertificateParsingException - Thrown if a parsing error occurs.NoSuchAlgorithmException - Thrown if the specified key or signature encoding algorithm is not supported.
public WTLSCertificate(byte[] input,
int offset,
int length)
throws CertificateParsingException,
NoSuchAlgorithmException
WTLSCertificate object given a byte array
containing the encoding of the certificate.
input - The byte array containing the certificate bytes.offset - The starting offset of the certificate bytes.length - The length of the certificate in bytes.
CertificateParsingException - Thrown if a parsing error occurs.NoSuchAlgorithmException - Thrown if the specified key or signature encoding algorithm is not supported.public WTLSCertificate(InputStream input) throws CertificateParsingException, NoSuchAlgorithmException
WTLSCertificate object from
the given input stream.
input - The input stream containing the certificate data.CertificateParsingException - Thrown if a parsing error occurs.NoSuchAlgorithmException - Thrown if the specified key or signature encoding algorithm is not supported.| Method Detail |
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. Note that the end-entity
certificate must appear 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 boolean equals(Object other)
true if and only if the certificate is equal to
the object other. Equals test whether the two encodings
are equal. other can either be a WTLSCertificate or a byte[]
representing the encoding of a WTLSCertificate.
Objectobj - the reference object with which to compare.true if this object is the same as the obj
argument; false otherwise.Boolean.hashCode(),
Hashtablepublic CertificateDisplayField[] getCustomDisplayFields()
CertificateCertificateDisplayField 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 byte[] getEncoding()
public byte[] getEncoding(int field)
field from the certificate.
public CertificateExtension getExtension(OID oid)
Certificateoid - The oid with the extension.CertificateExtension or null.OIDspublic CertificateExtension[] getExtensions()
CertificateExtension[] or null.public CertificateExtension[] getExtensions(boolean criticalBit)
criticalBit. This returns null since
there are no extensions in a WTLS certificate
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 returned.CertificateExtensions or null.OIDspublic Object getInformation(long id, Object param, Object defaultValue)
Certificate
Certificateid - 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.public DistinguishedName getIssuer()
DistinguishedName (WTLSDistinguishedName) object,
representing the issuer of this certificate.
DistinguishedName object.DistinguishedNamepublic long getNotAfter()
Certificatepublic long getNotBefore()
Certificatepublic PublicKey getPublicKey() throws InvalidCryptoSystemException
InvalidCryptoSystemException - Thrown if the crypto system used to create the key was invalid.public String getPublicKeyAlgorithm()
Certificate
Certificatepublic byte[] getSerialNumber()
Certificatepublic String getSignatureAlgorithm()
Certificate
Certificatepublic CertificateStatus getStatus()
CertificateStatus stored for this
certificate on the device. May be null.public DistinguishedName getSubject()
DistinguishedName object.DistinguishedNamepublic String getSubjectFriendlyName()
CertificateUtilities.getSubjectFriendlyName(),
which produces a friendly string using elements of the subject distinguished name. May be null.
Certificatepublic String getType()
Certificatepublic int getVersion()
Certificatepublic int hashCode()
Objectjava.util.Hashtable.
The general contract of hashCode is:
hashCode method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hashtables.
As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)
ObjectObject.equals(java.lang.Object),
Hashtablepublic boolean isCA()
Certificatepublic boolean isRoot()
Certificatepublic boolean isValid()
getNotValidBefore() and
getNotValidBefore().
public boolean isValid(long date)
date
as the time reference.
It checks that date is between the
values returned by getNotValidBefore() and
getNotValidBefore().
date - The specified date that determines whether or not the certificates are
valid.public int queryKeyUsage(long purpose)
Certificate
Certificatepurpose - 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 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 String toString()
Object
public void verify()
throws CertificateVerificationException,
DecodeException,
CryptoTokenException,
CryptoUnsupportedOperationException,
InvalidSignatureEncodingException,
NoSuchAlgorithmException
CertificateCertificateVerificationException - 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, NoSuchAlgorithmException, InvalidSignatureEncodingException, NoIssuerFoundException, CryptoTokenException, CryptoUnsupportedOperationException
The function checks that the certificate was signed by at least one of the publicKeys from the
given keyStore.
CertificatekeyStore - 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 void verify(PublicKey issuerPublicKey) throws CertificateVerificationException, NoSuchAlgorithmException, InvalidSignatureEncodingException, CryptoTokenException, CryptoUnsupportedOperationException
The function checks that the certificate was signed by issuerPublicKey.
CertificateissuerPublicKey - 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.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.