com.iplanet.trustbase.security.store
Class KeyUsages

java.lang.Object
  |
  +--com.iplanet.trustbase.security.store.KeyUsages
All Implemented Interfaces:
java.lang.Cloneable

public class KeyUsages
extends java.lang.Object
implements java.lang.Cloneable

represents purposes for which a private key may be used draws from X.509 KeyUsage and ExtendedKeyUsage extensions for KeyUsage definitions


Inner Class Summary
static class KeyUsages.ExtendedKeyUsage
          describes an X509 ExtendedKeyUsage, giving a code defined here, a name, a description and an ASN.1 OID
static class KeyUsages.KeyUsage
          describes an X509 KeyUsage, giving a code defined here, a name, a description and a position in the ASN.1 KeyUsage BitString
static class KeyUsages.KeyUsageI
          common base class for KeyUsage and ExtendedKeyUsage ties together a code, name and description
 
Field Summary
static int CLIENT_AUTH
          code for the clientAuth ExtendedKeyUsage
static int CODE_SIGNING
          code for the codeSigning ExtendedKeyUsage
static int CRL_SIGN
          code for the cRLSign keyUsage
static int DATA_ENCIPHERMENT
          code for the dataEncipherment KeyUsage
static int DECIPHER_ONLY
          code for the decipherOnoly KeyUsage
static int DIGITAL_SIGNATURE
          code for the digitalSignature KeyUsage
static KeyUsages.ExtendedKeyUsage EKU_CLIENT_AUTH
          the clientAuth ExtendedKeyUsage
static KeyUsages.ExtendedKeyUsage EKU_CODE_SIGNING
          the codeSigning ExtendedKeyUsage
static KeyUsages.ExtendedKeyUsage EKU_EMAIL_PROTECTION
          the emailProtection ExtendedKeyUsage
static KeyUsages.ExtendedKeyUsage EKU_SERVER_AUTH
          the serverAuth ExtendedKeyUsage
static KeyUsages.ExtendedKeyUsage EKU_TIME_STAMPING
          the timeStamping ExtendedKeyUsage
static int EMAIL_PROTECTION
          code for the emailProtection ExtendedKeyUsage
static int ENCIPHER_ONLY
          code for the encipherOnly KeyUsage
static KeyUsages.ExtendedKeyUsage[] EXTENDED_KEY_USAGES
          all X.509 ExtendedKeyUsages presented
static int KEY_AGREEMENT
          code for the keyAgreement KeyUsage
static int KEY_CERT_SIGN
          code for the keyCertSign KeyUsage
static int KEY_ENCIPHERMENT
          code for the keyEncipherment KeyUsage
static KeyUsages.KeyUsage[] KEY_USAGES
          all the X.509 KeyUsages presented in ASN.1 BitString order
static KeyUsages.KeyUsage KU_CRL_SIGN
          the cRLSign KeyUsage
static KeyUsages.KeyUsage KU_DECIPHER_ONLY
          the decipherOnly KeyUsage
static KeyUsages.KeyUsage KU_DIGITAL_SIGNATURE
          the digitalSignature KeyUsage
static KeyUsages.KeyUsage KU_ENCIPHER_ONLY
          the encipherOnly KeyUsage
static KeyUsages.KeyUsage KU_KEY_AGREEMENT
          the keyAgreement KeyUsage
static KeyUsages.KeyUsage KU_KEY_CERT_SIGN
          the keyCertSignKeyUsage
static KeyUsages.KeyUsage KU_KEY_ENCIPHERMENT
          the keyEncipherment KeyUsage
static KeyUsages.KeyUsage KU_NON_REPUDIATION
          the nonRepudiation KeyUsage
static int NON_REPUDIATION
          code for the nonRepudiation KeyUsage
static int SERVER_AUTH
          code for the serverAuth ExtendedKeyUsage
static int TIME_STAMPING
          code for the timeStamping ExtendedKeyUsage
 
Constructor Summary
KeyUsages()
          construct an empty KeyUsages Object
KeyUsages(boolean[] keyUsages, java.lang.String[] ekuOids)
          Creates new KeyUsage, from the KeyUsages and ExtendedKeyUsages presented in an X.509 certificate
KeyUsages(KeyUsages.KeyUsage[] keyUsages, KeyUsages.ExtendedKeyUsage[] extendedKeyUsages)
          create a new KeyUsages from lists of KeyUsage and ExtendedKeyUsages
 
Method Summary
 void addUsage(KeyUsages.KeyUsageI usage)
           
 java.lang.Object clone()
           
static KeyUsages.KeyUsageI getByAbbrev(java.lang.String abbrev)
          get a KeyUsageI by it's abbreviation
static KeyUsages.ExtendedKeyUsage getByOid(java.lang.String oid)
          get an ExtendedKeyUsages, identified by it's ASN.1 Oid, given in the period separated decimal digit encoding
 java.util.Set getExtendedKeyUsages()
          get the enabled ExtendedKeyUsages
 java.util.Set getKeyUsages()
          get the enabled X509 KeyUsages
 boolean hasUsage(KeyUsages.KeyUsageI usage)
          check if this KeyUsage has the specified usage
 void removeUsage(KeyUsages.KeyUsageI usage)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIGITAL_SIGNATURE

public static final int DIGITAL_SIGNATURE
code for the digitalSignature KeyUsage

NON_REPUDIATION

public static final int NON_REPUDIATION
code for the nonRepudiation KeyUsage

KEY_ENCIPHERMENT

public static final int KEY_ENCIPHERMENT
code for the keyEncipherment KeyUsage

DATA_ENCIPHERMENT

public static final int DATA_ENCIPHERMENT
code for the dataEncipherment KeyUsage

KEY_AGREEMENT

public static final int KEY_AGREEMENT
code for the keyAgreement KeyUsage

KEY_CERT_SIGN

public static final int KEY_CERT_SIGN
code for the keyCertSign KeyUsage

CRL_SIGN

public static final int CRL_SIGN
code for the cRLSign keyUsage

ENCIPHER_ONLY

public static final int ENCIPHER_ONLY
code for the encipherOnly KeyUsage

DECIPHER_ONLY

public static final int DECIPHER_ONLY
code for the decipherOnoly KeyUsage

SERVER_AUTH

public static final int SERVER_AUTH
code for the serverAuth ExtendedKeyUsage

CLIENT_AUTH

public static final int CLIENT_AUTH
code for the clientAuth ExtendedKeyUsage

CODE_SIGNING

public static final int CODE_SIGNING
code for the codeSigning ExtendedKeyUsage

EMAIL_PROTECTION

public static final int EMAIL_PROTECTION
code for the emailProtection ExtendedKeyUsage

TIME_STAMPING

public static final int TIME_STAMPING
code for the timeStamping ExtendedKeyUsage

KU_DIGITAL_SIGNATURE

public static final KeyUsages.KeyUsage KU_DIGITAL_SIGNATURE
the digitalSignature KeyUsage

KU_NON_REPUDIATION

public static final KeyUsages.KeyUsage KU_NON_REPUDIATION
the nonRepudiation KeyUsage

KU_KEY_ENCIPHERMENT

public static final KeyUsages.KeyUsage KU_KEY_ENCIPHERMENT
the keyEncipherment KeyUsage

KU_KEY_AGREEMENT

public static final KeyUsages.KeyUsage KU_KEY_AGREEMENT
the keyAgreement KeyUsage

KU_KEY_CERT_SIGN

public static final KeyUsages.KeyUsage KU_KEY_CERT_SIGN
the keyCertSignKeyUsage

KU_CRL_SIGN

public static final KeyUsages.KeyUsage KU_CRL_SIGN
the cRLSign KeyUsage

KU_ENCIPHER_ONLY

public static final KeyUsages.KeyUsage KU_ENCIPHER_ONLY
the encipherOnly KeyUsage

KU_DECIPHER_ONLY

public static final KeyUsages.KeyUsage KU_DECIPHER_ONLY
the decipherOnly KeyUsage

KEY_USAGES

public static final KeyUsages.KeyUsage[] KEY_USAGES
all the X.509 KeyUsages presented in ASN.1 BitString order

EKU_SERVER_AUTH

public static final KeyUsages.ExtendedKeyUsage EKU_SERVER_AUTH
the serverAuth ExtendedKeyUsage

EKU_CLIENT_AUTH

public static final KeyUsages.ExtendedKeyUsage EKU_CLIENT_AUTH
the clientAuth ExtendedKeyUsage

EKU_CODE_SIGNING

public static final KeyUsages.ExtendedKeyUsage EKU_CODE_SIGNING
the codeSigning ExtendedKeyUsage

EKU_EMAIL_PROTECTION

public static final KeyUsages.ExtendedKeyUsage EKU_EMAIL_PROTECTION
the emailProtection ExtendedKeyUsage

EKU_TIME_STAMPING

public static final KeyUsages.ExtendedKeyUsage EKU_TIME_STAMPING
the timeStamping ExtendedKeyUsage

EXTENDED_KEY_USAGES

public static final KeyUsages.ExtendedKeyUsage[] EXTENDED_KEY_USAGES
all X.509 ExtendedKeyUsages presented
Constructor Detail

KeyUsages

public KeyUsages()
construct an empty KeyUsages Object

KeyUsages

public KeyUsages(boolean[] keyUsages,
                 java.lang.String[] ekuOids)
Creates new KeyUsage, from the KeyUsages and ExtendedKeyUsages presented in an X.509 certificate
Parameters:
keyUsages - the ASN.1 BitString from the X.509 KeyUsage extension. may be null
ekuOids - a list of ASN.1 OIDs from the X.509 ExtendedKeyUsage extension. may be null

KeyUsages

public KeyUsages(KeyUsages.KeyUsage[] keyUsages,
                 KeyUsages.ExtendedKeyUsage[] extendedKeyUsages)
create a new KeyUsages from lists of KeyUsage and ExtendedKeyUsages
Parameters:
keyUsages - the required KeyUsages. may be null
extendedKeyUsages - the required ExtendedKeyUsages. may be null
Method Detail

getByAbbrev

public static KeyUsages.KeyUsageI getByAbbrev(java.lang.String abbrev)
get a KeyUsageI by it's abbreviation

getByOid

public static KeyUsages.ExtendedKeyUsage getByOid(java.lang.String oid)
get an ExtendedKeyUsages, identified by it's ASN.1 Oid, given in the period separated decimal digit encoding

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

hasUsage

public boolean hasUsage(KeyUsages.KeyUsageI usage)
check if this KeyUsage has the specified usage
Returns:
true if the KeyUsage or ExtendedKeyUsage specified was enabled in theis KeyUsages

addUsage

public void addUsage(KeyUsages.KeyUsageI usage)

removeUsage

public void removeUsage(KeyUsages.KeyUsageI usage)

getKeyUsages

public java.util.Set getKeyUsages()
get the enabled X509 KeyUsages
Returns:
a Set of KeyUsage Objects. not null

getExtendedKeyUsages

public java.util.Set getExtendedKeyUsages()
get the enabled ExtendedKeyUsages
Returns:
a Set of ExtendedKeyUsage Objects. not null