edu.vt.middleware.crypt.x509.types
Class KeyUsage

java.lang.Object
  extended by edu.vt.middleware.crypt.x509.types.BitString
      extended by edu.vt.middleware.crypt.x509.types.KeyUsage

public class KeyUsage
extends BitString

Representation of the KeyUsage type defined in section 4.2.1.3 of RFC 2459.

Version:
$Revision: 2744 $
Author:
Middleware Services

Field Summary
 
Fields inherited from class edu.vt.middleware.crypt.x509.types.BitString
BITS_IN_BYTE, INT_BYTE_SIZE, octets, UNSIGNED_BYTE_MASK
 
Constructor Summary
KeyUsage(byte[] bitString)
          Creates a new instance with the given bit string, where each bit is one of the constants defined in the KeyUsageBits enumeration.
KeyUsage(int flags)
          Creates a new instance from OR-ing KeyUsageBits bitmask values.
KeyUsage(KeyUsageBits[] bits)
          Creates a new instance that has all the given KeyUsageBits set.
 
Method Summary
 Collection<KeyUsageBits> getUses()
          Gets a collection of the bits set for this instance.
 String toString()
           
 
Methods inherited from class edu.vt.middleware.crypt.x509.types.BitString
equals, getBytes, getOctets, hashCode, intValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyUsage

public KeyUsage(byte[] bitString)
Creates a new instance with the given bit string, where each bit is one of the constants defined in the KeyUsageBits enumeration.

Parameters:
bitString - Octets making up key usage bit string.

KeyUsage

public KeyUsage(int flags)
Creates a new instance from OR-ing KeyUsageBits bitmask values.

Parameters:
flags - Bit mask created by OR-ing the bitmask of KeyUsageBits enum values together, e.g. KeyUsageBits.DigitalSignature.getMask()|KeyUsageBits.KeyCertSign.getMask()

KeyUsage

public KeyUsage(KeyUsageBits[] bits)
Creates a new instance that has all the given KeyUsageBits set.

Parameters:
bits - Array of KeyUsageBits describing all key usage bits to be set.
Method Detail

getUses

public Collection<KeyUsageBits> getUses()
Gets a collection of the bits set for this instance.

Returns:
Collection of KeyUsageBits items representing the bits that are set for this instance.

toString

public String toString()
Overrides:
toString in class Object
Returns:
List of all key usage bits set in this object, e.g. [DigitalSignature, KeyCertSign].


Copyright © 2003-2013 Virginia Tech. All Rights Reserved.