|
|||||||||
| 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)
|
|
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()
|
|
byte[] |
getSerialNumber()
Returns a byte array containing the serial number of the certificate. |
|
String |
getSignatureAlgorithm()
|
|
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()
|
|
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)
|
|
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 byte[] getEncoding()
public byte[] getEncoding(int field)
field from the certificate.
public void verify(PublicKey issuerPublicKey) throws CertificateVerificationException, NoSuchAlgorithmException, InvalidSignatureEncodingException, CryptoTokenException, CryptoUnsupportedOperationException
The function checks that the certificate was signed by issuerPublicKey.
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.
public boolean isRoot()
public boolean isCA()
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 chain
public void verify()
throws CertificateVerificationException,
DecodeException,
CryptoTokenException,
CryptoUnsupportedOperationException,
InvalidSignatureEncodingException,
NoSuchAlgorithmException
public PublicKey getPublicKey() throws InvalidCryptoSystemException
InvalidCryptoSystemException - Thrown if the crypto system used to create the key was invalid.public String getPublicKeyAlgorithm()
Certificatepublic String getSignatureAlgorithm()
Certificatepublic String getType()
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()
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 getVersion()
public byte[] getSerialNumber()
public DistinguishedName getIssuer()
DistinguishedName (WTLSDistinguishedName) object,
representing the issuer of this certificate.
DistinguishedName object.DistinguishedNamepublic DistinguishedName getSubject()
DistinguishedName object.DistinguishedNamepublic long getNotBefore()
public long getNotAfter()
public CertificateExtension getExtension(OID oid)
public 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 String toString()
public 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.public 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.)
public int queryKeyUsage(long purpose)
Certificatepublic String getSubjectFriendlyName()
CertificateUtilities.getSubjectFriendlyName(),
which produces a friendly string using elements of the subject distinguished name. May be null.public CertificateDisplayField[] getCustomDisplayFields()
public Object getInformation(long id, Object param, Object defaultValue)
Certificate
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2006 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.