1 package iaik.pkcs.pkcs11.objects; 2 3 /** 4 * Objects of this class represent a boolean attribute of a PKCS#11 object 5 * as specified by PKCS#11. 6 * 7 * @author <a href="mailto:Karl.Scheibelhofer@iaik.at"> Karl Scheibelhofer </a> 8 * @version 1.0 9 * @invariants 10 */ 11 public class BooleanAttribute extends Attribute { 12 13 /** 14 * Default constructor - only for internal use in AttributeArrayAttribute.getValueString(). 15 */ BooleanAttribute()16 BooleanAttribute() { 17 super(); 18 } 19 20 /** 21 * Constructor taking the PKCS#11 type of the attribute. 22 * 23 * @param type The PKCS'11 type of this attribute; e.g. 24 * PKCS11Constants.CKA_PRIVATE. 25 * @preconditions (type <> null) 26 * @postconditions 27 */ BooleanAttribute(Long type)28 public BooleanAttribute(Long type) { 29 super(type); 30 } 31 32 /** 33 * Set the boolean value of this attribute. Null, is also valid. 34 * A call to this method sets the present flag to true. 35 * 36 * @param value The boolean value to set. May be null. 37 * @preconditions 38 * @postconditions 39 */ setBooleanValue(Boolean value)40 public void setBooleanValue(Boolean value) { 41 ckAttribute_.pValue = value; 42 present_ = true; 43 } 44 45 /** 46 * Get the boolean value of this attribute. Null, is also possible. 47 * 48 * @return The boolean value of this attribute or null. 49 * @preconditions 50 * @postconditions 51 */ getBooleanValue()52 public Boolean getBooleanValue() { 53 return (Boolean) ckAttribute_.pValue; 54 } 55 56 } 57