SSE4E

Home

GPError
GPSystem
ByteString
ByteBuffer
TLV
TLVList
Card
Atr
Key
Crypto
Application GPApplication GPSecDomain

ASN1
CardFile
IsoSecureChannel
ApplFactory
GPXML
JsScript
CardSim

X509
CRL
KeyStore
CMSSignedData
CMSGenerator
XMLSignature
OCSPQuery
LDAP
SOAP
URLConnection

PKCS11Provider
PKCS11Session
PKCS11Object

OutlineNode

OpenSCDP

PKCS11Object - Reference Documentation

Class implementing support for objects in cryptographic token with PKCS#11 interface

Index of Methods

Constants

TypeNameDescription
NumberCKO_DATAPKCS#11 object class
NumberCKO_CERTIFICATEPKCS#11 object class
NumberCKO_PUBLIC_KEYPKCS#11 object class
NumberCKO_PRIVATE_KEYPKCS#11 object class
NumberCKO_SECRET_KEYPKCS#11 object class
NumberCKO_HW_FEATUREPKCS#11 object class
NumberCKO_DOMAIN_PARAMETERSPKCS#11 object class
NumberCKO_MECHANISMPKCS#11 object class
NumberCKA_CLASSPKCS#11 attribute
NumberCKA_TOKENPKCS#11 attribute
NumberCKA_PRIVATEPKCS#11 attribute
NumberCKA_LABELPKCS#11 attribute
NumberCKA_APPLICATIONPKCS#11 attribute
NumberCKA_VALUEPKCS#11 attribute
NumberCKA_OBJECT_IDPKCS#11 attribute
NumberCKA_CERTIFICATE_TYPEPKCS#11 attribute
NumberCKA_ISSUERPKCS#11 attribute
NumberCKA_SERIAL_NUMBERPKCS#11 attribute
NumberCKA_SERIAL_NUMBERPKCS#11 attribute
NumberCKA_OWNERPKCS#11 attribute
NumberCKA_ATTR_TYPESPKCS#11 attribute
NumberCKA_TRUSTEDPKCS#11 attribute
NumberCKA_CERTIFICATE_CATEGORYPKCS#11 attribute
NumberCKA_JAVA_MIDP_SECURITY_DOMAINPKCS#11 attribute
NumberCKA_URLPKCS#11 attribute
NumberCKA_HASH_OF_SUBJECT_PUBLIC_KEYPKCS#11 attribute
NumberCKA_HASH_OF_ISSUER_PUBLIC_KEYPKCS#11 attribute
NumberCKA_CHECK_VALUEPKCS#11 attribute
NumberCKA_KEY_TYPEPKCS#11 attribute
NumberCKA_SUBJECTPKCS#11 attribute
NumberCKA_IDPKCS#11 attribute
NumberCKA_SENSITIVEPKCS#11 attribute
NumberCKA_ENCRYPTPKCS#11 attribute
NumberCKA_DECRYPTPKCS#11 attribute
NumberCKA_WRAPPKCS#11 attribute
NumberCKA_UNWRAPPKCS#11 attribute
NumberCKA_SIGNPKCS#11 attribute
NumberCKA_SIGN_RECOVERPKCS#11 attribute
NumberCKA_VERIFYPKCS#11 attribute
NumberCKA_VERIFY_RECOVERPKCS#11 attribute
NumberCKA_DERIVEPKCS#11 attribute
NumberCKA_START_DATEPKCS#11 attribute
NumberCKA_END_DATEPKCS#11 attribute
NumberCKA_MODULUSPKCS#11 attribute
NumberCKA_MODULUS_BITSPKCS#11 attribute
NumberCKA_PUBLIC_EXPONENTPKCS#11 attribute
NumberCKA_PRIVATE_EXPONENTPKCS#11 attribute
NumberCKA_PRIME_1PKCS#11 attribute
NumberCKA_PRIME_2PKCS#11 attribute
NumberCKA_EXPONENT_1PKCS#11 attribute
NumberCKA_EXPONENT_2PKCS#11 attribute
NumberCKA_COEFFICIENTPKCS#11 attribute
NumberCKA_PRIMEPKCS#11 attribute
NumberCKA_SUBPRIMEPKCS#11 attribute
NumberCKA_BASEPKCS#11 attribute
NumberCKA_PRIME_BITSPKCS#11 attribute
NumberCKA_SUB_PRIME_BITSPKCS#11 attribute
NumberCKA_VALUE_BITSPKCS#11 attribute
NumberCKA_VALUE_LENPKCS#11 attribute
NumberCKA_EXTRACTABLEPKCS#11 attribute
NumberCKA_LOCALPKCS#11 attribute
NumberCKA_NEVER_EXTRACTABLEPKCS#11 attribute
NumberCKA_ALWAYS_SENSITIVEPKCS#11 attribute
NumberCKA_KEY_GEN_MECHANISMPKCS#11 attribute
NumberCKA_MODIFIABLEPKCS#11 attribute
NumberCKA_ECDSA_PARAMSPKCS#11 attribute
NumberCKA_EC_PARAMSPKCS#11 attribute
NumberCKA_EC_POINTPKCS#11 attribute
NumberCKA_SECONDARY_AUTHPKCS#11 attribute
NumberCKA_AUTH_PIN_FLAGSPKCS#11 attribute
NumberCKA_ALWAYS_AUTHENTICATEPKCS#11 attribute
NumberCKA_WRAP_WITH_TRUSTEDPKCS#11 attribute
NumberCKK_RSAPKCS#11 key type
NumberCKK_ECDSAPKCS#11 key type
NumberCKK_ECPKCS#11 key type
NumberCKK_DESPKCS#11 key type
NumberCKK_DES2PKCS#11 key type
NumberCKK_DES3PKCS#11 key type

Constructor

Prototype

PKCS11Object(PKCS11Session session)

Description

Create a PKCS#11 object within the given session using the provided list of attributes. The object is created in the selected token.

The constructor accepts an associative array of attributes. The key must be one of the PKCS11Object.CKA_xxx values. The value can be a number, a string, a ByteString or boolean value. At least the CKA_CLASS must be defined.

Arguments

TypeNameDescription
PKCS11SessionsessionPreviously opened session with PKCS#11 device

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType of argument is invalid for call

Example


// var p = new PKCS11Provider("c:/programme/smart card bundle/opensc-pkcs11.dll");
var p = new PKCS11Provider("C:/usr/local/lsm/bin/lsmpkcs11.dll");

// Login as user in a read/write session
var s = new PKCS11Session(p, 1, true);
s.login("12345678");

var attr = new Array();

attr[PKCS11Object.CKA_CLASS] = PKCS11Object.CKO_SECRET_KEY;
attr[PKCS11Object.CKA_KEY_TYPE] = PKCS11Object.CKK_DES;
attr[PKCS11Object.CKA_LABEL] = "MyTestKey";
attr[PKCS11Object.CKA_TOKEN] = true;
attr[PKCS11Object.CKA_VALUE] = new ByteString("0101010101010101", HEX);

// Create object
var o = new PKCS11Object(s, attr);

getAttribute()

Prototype

ByteString getAttribute(Number attr)

Description

Return the requested attribute as ByteString

Arguments

TypeNameDescription
NumberattrOne of the CKA_ attributes

Return

ByteStringValue of attribute. null is returned if the attribute is not defined.

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType of argument is invalid for call
GPErrorGPError.OBJECT_NOT_FOUNDThe requested attribute can not be read

Example


print("CKA_LABEL = " + o.getAttribute(PKCS11Object.CKA_LABEL).toString(ASCII));

getNumberAttribute()

Prototype

Number getAttribute(Number attr)

Description

Return the requested attribute as Number

Arguments

TypeNameDescription
NumberattrOne of the CKA_ attributes

Return

NumberValue of attribute

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType of argument is invalid for call
GPErrorGPError.OBJECT_NOT_FOUNDThe requested attribute is not defined or can not be read

Example


print("CKA_KEY_TYPE = " + o.getNumberAttribute(PKCS11Object.CKA_KEY_TYPE));

getBooleanAttribute()

Prototype

Boolean getBooleanAttribute(Number attr)

Description

Return the requested attribute as boolean value

Arguments

TypeNameDescription
NumberattrOne of the CKA_ attributes

Return

BooleanBoolean value of attribute

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType of argument is invalid for call
GPErrorGPError.OBJECT_NOT_FOUNDThe requested attribute is not defined or can not be read

Example


print("CKA_TOKEN = " + o.getBooleanAttribute(PKCS11Object.CKA_TOKEN));