Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| IAIK PKCS#11 Wrapper version 1.2.16
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## iaik.pkcs.pkcs11.objects
Class Attribute

    java.lang.Object
      iaik.pkcs.pkcs11.objects.Attribute

All Implemented Interfaces:
  Cloneable

Direct Known Subclasses:
  BooleanAttribute, ByteArrayAttribute, CharArrayAttribute, DateAttribute, LongAttribute

public class Attribute
extends Object
implements Cloneable

This is the base-class for all types of attributes. In general, all PKCS#11 objects are just a collection of attributes. PKCS#11 specifies which attributes each type of objects must have. In some cases, attributes are optinal (e.g. in RSAPrivateKey). In such a case, this attribute will return false when the application calls isPresent() on this attribute. This measn, that the object does not posses this attribute (maybe even though it should, but not all drivers seem to implement the standard correctly). Handling attributes in this fashion ensures that this library can work also with drivers that are not fully compliant. Moreover, certain attributes can be sensitive; i.e. their values cannot be read, e.g. the private exponent of a RSA private key.

Invariants
  (ckAttribute_ <> null)

Field Summary
`static Long` | `AC_ISSUER`
`static Long` | `ALWAYS_SENSITIVE`
`static Long` | `APPLICATION`
`static Long` | `ATTR_TYPES`
`protected static Hashtable` | `attributeNames_`
`static Long` | `AUTH_PIN_FLAGS`
`static Long` | `BASE`
`static Long` | `CERTIFICATE_TYPE`
`protected CK_ATTRIBUTE` | `ckAttribute_` The CK_ATTRIBUTE that is used to hold the PKCS#11 type of this attribute and the value.
`static Long` | `CLASS`
`static Long` | `COEFFICIENT`
`static Long` | `DECRYPT`
`static Long` | `DERIVE`
`static Long` | `EC_PARAMS`
`static Long` | `EC_POINT`
`static Long` | `ECDSA_PARAMS`
`static Long` | `ENCRYPT`
`static Long` | `END_DATE`
`static Long` | `EXPONENT_1`
`static Long` | `EXPONENT_2`
`static Long` | `EXTRACTABLE`
`static Long` | `HAS_RESET`
`static Long` | `HW_FEATURE_TYPE`
`static Long` | `ID`
`static Long` | `ISSUER`
`static Long` | `KEY_GEN_MECHANISM`
`static Long` | `KEY_TYPE`
`static Long` | `LABEL`
`static Long` | `LOCAL`
`static Long` | `MODIFIABLE`
`static Long` | `MODULUS`
`static Long` | `MODULUS_BITS`
`static Long` | `NEVER_EXTRACTABLE`
`static Long` | `OBJECT_ID`
`static Long` | `OWNER`
`protected boolean` | `present_` True, if the object really posesses this attribute.
`static Long` | `PRIME`
`static Long` | `PRIME_1`
`static Long` | `PRIME_2`
`static Long` | `PRIME_BITS`
`static Long` | `PRIVATE`
`static Long` | `PRIVATE_EXPONENT`
`static Long` | `PUBLIC_EXPONENT`
`static Long` | `RESET_ON_INIT`
`static Long` | `SECONDARY_AUTH`
`static Long` | `SENSITIVE`
`protected boolean` | `sensitive_` True, if this attribute is sensitive.
`static Long` | `SERIAL_NUMBER`
`static Long` | `SIGN`
`static Long` | `SIGN_RECOVER`
`static Long` | `START_DATE`
`static Long` | `SUB_PRIME_BITS`
`static Long` | `SUBJECT`
`static Long` | `SUBPRIME`
`static Long` | `TOKEN`
`static Long` | `TRUSTED`
`static Long` | `UNWRAP`
`static Long` | `VALUE`
`static Long` | `VALUE_BITS`
`static Long` | `VALUE_LEN`
`static Long` | `VENDOR_DEFINED`
`static Long` | `VERIFY`
`static Long` | `VERIFY_RECOVER`
`static Long` | `WRAP`

Constructor Summary
`protected` | `Attribute()` Empty constructor.
`protected` | `Attribute(Long type)` Constructor taking the PKCS#11 type of the attribute.

Method Summary
`Object` | `clone()` Create a (deep) clone of this object.
`boolean` | `equals(Object otherObject)` True, if both attributes are not present or if both attributes are present and all other member variables are equal.
`protected static String` | `getAttributeName(Long type)` Get the name of the given attribute type.
`protected CK_ATTRIBUTE` | `getCkAttribute()` Get the CK_ATTRIBUTE object of this Attribute that contains the attribute type and value .
`protected Long` | `getType()` Get the PKCS#11 type of this attribute.
`protected String` | `getValueString()` Get a string representation of the value of this attribute.
`int` | `hashCode()` The overriding of this method should ensure that the objects of this class work correctly in a hashtable.
`boolean` | `isPresent()` Check, if this attribute is really present in the associated object.
`boolean` | `isSensitive()` Check, if this attribute is sensitive in the associated object.
`protected void` | `setCkAttribute(CK_ATTRIBUTE ckAttribute)` Set the CK_ATTRIBUTE of this Attribute.
`void` | `setPresent(boolean present)` Set, if this attribute is really present in the associated object.
`void` | `setSensitive(boolean sensitive)` Set, if this attribute is sensitive in the associated object.
`protected void` | `setType(Long type)` Set the PKCS#11 type of this attribute.
`String` | `toString()` Get a string representation of this attribute.
`String` | `toString(boolean withName)` Get a string representation of this attribute.

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### CLASS

    public static final Long CLASS

### TOKEN

    public static final Long TOKEN

### PRIVATE

    public static final Long PRIVATE

### LABEL

    public static final Long LABEL

### APPLICATION

    public static final Long APPLICATION

### VALUE

    public static final Long VALUE

### OBJECT_ID

    public static final Long OBJECT_ID

### CERTIFICATE_TYPE

    public static final Long CERTIFICATE_TYPE

### ISSUER

    public static final Long ISSUER

### SERIAL_NUMBER

    public static final Long SERIAL_NUMBER

### AC_ISSUER

    public static final Long AC_ISSUER

### OWNER

    public static final Long OWNER

### ATTR_TYPES

    public static final Long ATTR_TYPES

### TRUSTED

    public static final Long TRUSTED

### KEY_TYPE

    public static final Long KEY_TYPE

### SUBJECT

    public static final Long SUBJECT

### ID

    public static final Long ID

### SENSITIVE

    public static final Long SENSITIVE

### ENCRYPT

    public static final Long ENCRYPT

### DECRYPT

    public static final Long DECRYPT

### WRAP

    public static final Long WRAP

### UNWRAP

    public static final Long UNWRAP

### SIGN

    public static final Long SIGN

### SIGN_RECOVER

    public static final Long SIGN_RECOVER

### VERIFY

    public static final Long VERIFY

### VERIFY_RECOVER

    public static final Long VERIFY_RECOVER

### DERIVE

    public static final Long DERIVE

### START_DATE

    public static final Long START_DATE

### END_DATE

    public static final Long END_DATE

### MODULUS

    public static final Long MODULUS

### MODULUS_BITS

    public static final Long MODULUS_BITS

### PUBLIC_EXPONENT

    public static final Long PUBLIC_EXPONENT

### PRIVATE_EXPONENT

    public static final Long PRIVATE_EXPONENT

### PRIME_1

    public static final Long PRIME_1

### PRIME_2

    public static final Long PRIME_2

### EXPONENT_1

    public static final Long EXPONENT_1

### EXPONENT_2

    public static final Long EXPONENT_2

### COEFFICIENT

    public static final Long COEFFICIENT

### PRIME

    public static final Long PRIME

### SUBPRIME

    public static final Long SUBPRIME

### BASE

    public static final Long BASE

### PRIME_BITS

    public static final Long PRIME_BITS

### SUB_PRIME_BITS

    public static final Long SUB_PRIME_BITS

### VALUE_BITS

    public static final Long VALUE_BITS

### VALUE_LEN

    public static final Long VALUE_LEN

### EXTRACTABLE

    public static final Long EXTRACTABLE

### LOCAL

    public static final Long LOCAL

### NEVER_EXTRACTABLE

    public static final Long NEVER_EXTRACTABLE

### ALWAYS_SENSITIVE

    public static final Long ALWAYS_SENSITIVE

### KEY_GEN_MECHANISM

    public static final Long KEY_GEN_MECHANISM

### MODIFIABLE

    public static final Long MODIFIABLE

### ECDSA_PARAMS

    public static final Long ECDSA_PARAMS

### EC_PARAMS

    public static final Long EC_PARAMS

### EC_POINT

    public static final Long EC_POINT

### SECONDARY_AUTH

    public static final Long SECONDARY_AUTH

### AUTH_PIN_FLAGS

    public static final Long AUTH_PIN_FLAGS

### HW_FEATURE_TYPE

    public static final Long HW_FEATURE_TYPE

### RESET_ON_INIT

    public static final Long RESET_ON_INIT

### HAS_RESET

    public static final Long HAS_RESET

### VENDOR_DEFINED

    public static final Long VENDOR_DEFINED

### attributeNames_

    protected static Hashtable attributeNames_

### present_

    protected boolean present_

  True, if the object really posesses this attribute.

### sensitive_

    protected boolean sensitive_

  True, if this attribute is sensitive.

### ckAttribute_

    protected CK_ATTRIBUTE ckAttribute_

  The CK_ATTRIBUTE that is used to hold the PKCS#11 type of this attribute and the value.

Constructor Detail

### Attribute

    protected Attribute()

  Empty constructor. Attention! If you use this constructor, you must set ckAttribute_ to ensure that the class invariant is not violated.

Preconditions
Postconditions

### Attribute

    protected Attribute(Long type)

  Constructor taking the PKCS#11 type of the attribute.

Parameters:
  `type` - The PKCS'11 type of this attribute; e.g. PKCS11Constants.CKA_PRIVATE.
Preconditions
  (type <> null)
Postconditions

Method Detail

### getAttributeName

    protected static String getAttributeName(Long type)

  Get the name of the given attribute type.

  Parameters:
    `type` - The attribute type.
  Returns:
    The name of the attribute type, or null if there is no such type.
  Preconditions
  Postconditions

### clone

    public Object clone()

  Create a (deep) clone of this object.

  Returns:
    A clone of this object.
  Preconditions
  Postconditions
    (result <> null) and (result instanceof Attribute) and (result.equals(this))

### setPresent

    public void setPresent(boolean present)

  Set, if this attribute is really present in the associated object. Does only make sense if used in combination with template objects.

  Parameters:
    `present` - True, if attribute is present.
  Preconditions
  Postconditions

### setSensitive

    public void setSensitive(boolean sensitive)

  Set, if this attribute is sensitive in the associated object. Does only make sense if used in combination with template objects.

  Parameters:
    `sensitive` - True, if attribute is sensitive.
  Preconditions
  Postconditions

### setCkAttribute

    protected void setCkAttribute(CK_ATTRIBUTE ckAttribute)

  Set the CK_ATTRIBUTE of this Attribute. Only for internal use.

  Parameters:
    `ckAttribute` - The new CK_ATTRIBUTE of this Attribute.
  Preconditions
    (ckAttribute <> null)
  Postconditions

### isPresent

    public boolean isPresent()

  Check, if this attribute is really present in the associated object.

  Returns:
    True, if this attribute is really present in the associated object.
  Preconditions
  Postconditions

### isSensitive

    public boolean isSensitive()

  Check, if this attribute is sensitive in the associated object.

  Returns:
    True, if this attribute is sensitive in the associated object.
  Preconditions
  Postconditions

### getCkAttribute

    protected CK_ATTRIBUTE getCkAttribute()

  Get the CK_ATTRIBUTE object of this Attribute that contains the attribute type and value .

  Returns:
    The CK_ATTRIBUTE of this Attribute.
  Preconditions
  Postconditions
    (result <> null)

### getValueString

    protected String getValueString()

  Get a string representation of the value of this attribute.

  Returns:
    A string representation of the value of this attribute.
  Preconditions
  Postconditions
    (result <> null)

### toString

    public String toString()

  Get a string representation of this attribute. If the attribute is not present or if it is sensitive, the output of this method shows jsut a message telling this. This string does not contain the attribute's type name.

  Returns:
    A string representation of the value of this attribute.
  Preconditions
  Postconditions
    (result <> null)

### toString

    public String toString(boolean withName)

  Get a string representation of this attribute. If the attribute is not present or if it is sensitive, the output of this method shows jsut a message telling this.

  Parameters:
    `withName` - If true, the string contains the attribute type name and the value. If false, it just contains the value.
  Returns:
    A string representation of this attribute.
  Preconditions
  Postconditions
    (result <> null)

### setType

    protected void setType(Long type)

  Set the PKCS#11 type of this attribute.

  Parameters:
    `type` - The PKCS#11 type of this attribute.
  Preconditions
    (type <> null)
  Postconditions

### getType

    protected Long getType()

  Get the PKCS#11 type of this attribute.

  Returns:
    The PKCS#11 type of this attribute.
  Preconditions
  Postconditions
    (result <> null)

### equals

    public boolean equals(Object otherObject)

  True, if both attributes are not present or if both attributes are present and all other member variables are equal. False, otherwise.

  Parameters:
    `otherObject` - The other object to compare to.
  Returns:
    True, if both attributes are not present or if both attributes are present and all other member variables are equal. False, otherwise.
  Preconditions
  Postconditions

### hashCode

    public int hashCode()

  The overriding of this method should ensure that the objects of this class work correctly in a hashtable.

  Returns:
    The hash code of this object.
  Preconditions
  Postconditions

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| IAIK PKCS#11 Wrapper version 1.2.16
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

IAIK JavaSecurity Website http://jce.iaik.tugraz.at/
IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2002, IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved.