public abstract class Attribute extends Object
In some cases, attributes are optional. In such a case, this attribute will return false when the application calls present() on this attribute. This means, that the object does not possess 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 standard-compliant.
Moreover, certain attributes can be sensitive; i.e. their values cannot be read, e.g. the private exponent of an RSA private key.
| Modifier and Type | Field and Description |
|---|---|
protected CK_ATTRIBUTE |
ckAttribute
The CK_ATTRIBUTE that is used to hold the PKCS#11 type of this attribute
and the value.
|
protected boolean |
present
True, if the object really possesses this attribute.
|
protected boolean |
sensitive
True, if this attribute is sensitive.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Attribute(long type)
Constructor taking the PKCS#11 type of the attribute.
|
| Modifier and Type | Method and Description |
|---|---|
Attribute |
ckAttribute(CK_ATTRIBUTE ckAttribute)
Set the CK_ATTRIBUTE of this Attribute.
|
CK_ATTRIBUTE |
getCkAttribute()
Get the CK_ATTRIBUTE object of this Attribute that contains the attribute
type and value .
|
static Attribute |
getInstance(long type) |
static Attribute |
getInstance(long type,
Object value) |
long |
getType()
Get the PKCS#11 type of this attribute.
|
abstract Object |
getValue() |
protected String |
getValueString()
Get a string representation of the value of this attribute.
|
boolean |
isNullValue() |
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.
|
Attribute |
present(boolean present)
Set, if this attribute is really present in the associated object.
|
Attribute |
sensitive(boolean sensitive)
Set, if this attribute is sensitive in the associated object.
|
String |
toString()
Get a string representation of this attribute.
|
String |
toString(boolean withName,
int minNameLen,
String indent)
Get a string representation of this attribute.
|
long |
type() |
protected boolean present
protected boolean sensitive
protected CK_ATTRIBUTE ckAttribute
protected Attribute(long type)
type - The PKCS#11 type of this attribute; e.g. CKA_PRIVATE.public abstract Object getValue()
public static Attribute getInstance(long type)
public Attribute present(boolean present)
present - True, if attribute is present.public Attribute sensitive(boolean sensitive)
sensitive - True, if attribute is sensitive.public Attribute ckAttribute(CK_ATTRIBUTE ckAttribute)
ckAttribute - The new CK_ATTRIBUTE of this Attribute.public boolean isPresent()
public boolean isSensitive()
public CK_ATTRIBUTE getCkAttribute()
public long type()
protected String getValueString()
public String toString()
public String toString(boolean withName, int minNameLen, String indent)
withName - If true, the string contains the attribute type name and the
value. If false, it just contains the value.minNameLen - Minimal length of the name.indent - The indent.public long getType()
public boolean isNullValue()
Copyright © 2023. All rights reserved.