more texts and no prefix in text

master
Marc Wäckerlin 15 years ago
parent 17cd26348c
commit ba6d0e0edf
  1. 144
      src/cryptoki.hxx

@ -119,70 +119,87 @@ namespace cryptoki {
} }
std::string name() { std::string name() {
switch (type) { switch (type) {
case CKA_CLASS: return "CKA_CLASS"; case CKA_CLASS: return "CLASS";
case CKA_TOKEN: return "CKA_TOKEN"; case CKA_TOKEN: return "TOKEN";
case CKA_PRIVATE: return "CKA_PRIVATE"; case CKA_PRIVATE: return "PRIVATE";
case CKA_LABEL: return "CKA_LABEL"; case CKA_LABEL: return "LABEL";
case CKA_APPLICATION: return "CKA_APPLICATION"; case CKA_APPLICATION: return "APPLICATION";
case CKA_VALUE: return "CKA_VALUE"; case CKA_VALUE: return "VALUE";
case CKA_OBJECT_ID: return "CKA_OBJECT_ID"; case CKA_OBJECT_ID: return "OBJECT_ID";
case CKA_CERTIFICATE_TYPE: return "CKA_CERTIFICATE_TYPE"; case CKA_CERTIFICATE_TYPE: return "CERTIFICATE_TYPE";
case CKA_ISSUER: return "CKA_ISSUER"; case CKA_ISSUER: return "ISSUER";
case CKA_SERIAL_NUMBER: return "CKA_SERIAL_NUMBER"; case CKA_SERIAL_NUMBER: return "SERIAL_NUMBER";
case CKA_AC_ISSUER: return "CKA_AC_ISSUER"; case CKA_AC_ISSUER: return "AC_ISSUER";
case CKA_OWNER: return "CKA_OWNER"; case CKA_OWNER: return "OWNER";
case CKA_ATTR_TYPES: return "CKA_ATTR_TYPES"; case CKA_ATTR_TYPES: return "ATTR_TYPES";
case CKA_TRUSTED: return "CKA_TRUSTED"; case CKA_TRUSTED: return "TRUSTED";
case CKA_KEY_TYPE: return "CKA_KEY_TYPE"; case CKA_KEY_TYPE: return "KEY_TYPE";
case CKA_SUBJECT: return "CKA_SUBJECT"; case CKA_SUBJECT: return "SUBJECT";
case CKA_ID: return "CKA_ID"; case CKA_ID: return "ID";
case CKA_SENSITIVE: return "CKA_SENSITIVE"; case CKA_SENSITIVE: return "SENSITIVE";
case CKA_ENCRYPT: return "CKA_ENCRYPT"; case CKA_ENCRYPT: return "ENCRYPT";
case CKA_DECRYPT: return "CKA_DECRYPT"; case CKA_DECRYPT: return "DECRYPT";
case CKA_WRAP: return "CKA_WRAP"; case CKA_WRAP: return "WRAP";
case CKA_UNWRAP: return "CKA_UNWRAP"; case CKA_UNWRAP: return "UNWRAP";
case CKA_SIGN: return "CKA_SIGN"; case CKA_SIGN: return "SIGN";
case CKA_SIGN_RECOVER: return "CKA_SIGN_RECOVER"; case CKA_SIGN_RECOVER: return "SIGN_RECOVER";
case CKA_VERIFY: return "CKA_VERIFY"; case CKA_VERIFY: return "VERIFY";
case CKA_VERIFY_RECOVER: return "CKA_VERIFY_RECOVER"; case CKA_VERIFY_RECOVER: return "VERIFY_RECOVER";
case CKA_DERIVE: return "CKA_DERIVE"; case CKA_DERIVE: return "DERIVE";
case CKA_START_DATE: return "CKA_START_DATE"; case CKA_START_DATE: return "START_DATE";
case CKA_END_DATE: return "CKA_END_DATE"; case CKA_END_DATE: return "END_DATE";
case CKA_MODULUS: return "CKA_MODULUS"; case CKA_MODULUS: return "MODULUS";
case CKA_MODULUS_BITS: return "CKA_MODULUS_BITS"; case CKA_MODULUS_BITS: return "MODULUS_BITS";
case CKA_PUBLIC_EXPONENT: return "CKA_PUBLIC_EXPONENT"; case CKA_PUBLIC_EXPONENT: return "PUBLIC_EXPONENT";
case CKA_PRIVATE_EXPONENT: return "CKA_PRIVATE_EXPONENT"; case CKA_PRIVATE_EXPONENT: return "PRIVATE_EXPONENT";
case CKA_PRIME_1: return "CKA_PRIME_1"; case CKA_PRIME_1: return "PRIME_1";
case CKA_PRIME_2: return "CKA_PRIME_2"; case CKA_PRIME_2: return "PRIME_2";
case CKA_EXPONENT_1: return "CKA_EXPONENT_1"; case CKA_EXPONENT_1: return "EXPONENT_1";
case CKA_EXPONENT_2: return "CKA_EXPONENT_2"; case CKA_EXPONENT_2: return "EXPONENT_2";
case CKA_COEFFICIENT: return "CKA_COEFFICIENT"; case CKA_COEFFICIENT: return "COEFFICIENT";
case CKA_PRIME: return "CKA_PRIME"; case CKA_PRIME: return "PRIME";
case CKA_SUBPRIME: return "CKA_SUBPRIME"; case CKA_SUBPRIME: return "SUBPRIME";
case CKA_BASE: return "CKA_BASE"; case CKA_BASE: return "BASE";
case CKA_PRIME_BITS: return "CKA_PRIME_BITS"; case CKA_PRIME_BITS: return "PRIME_BITS";
case CKA_SUBPRIME_BITS: return "CKA_SUBPRIME_BITS"; case CKA_SUBPRIME_BITS: return "SUBPRIME_BITS";
case CKA_VALUE_BITS: return "CKA_VALUE_BITS"; case CKA_VALUE_BITS: return "VALUE_BITS";
case CKA_VALUE_LEN: return "CKA_VALUE_LEN"; case CKA_VALUE_LEN: return "VALUE_LEN";
case CKA_EXTRACTABLE: return "CKA_EXTRACTABLE"; case CKA_EXTRACTABLE: return "EXTRACTABLE";
case CKA_LOCAL: return "CKA_LOCAL"; case CKA_LOCAL: return "LOCAL";
case CKA_NEVER_EXTRACTABLE: return "CKA_NEVER_EXTRACTABLE"; case CKA_NEVER_EXTRACTABLE: return "NEVER_EXTRACTABLE";
case CKA_ALWAYS_SENSITIVE: return "CKA_ALWAYS_SENSITIVE"; case CKA_ALWAYS_SENSITIVE: return "ALWAYS_SENSITIVE";
case CKA_KEY_GEN_MECHANISM: return "CKA_KEY_GEN_MECHANISM"; case CKA_KEY_GEN_MECHANISM: return "KEY_GEN_MECHANISM";
case CKA_MODIFIABLE: return "CKA_MODIFIABLE"; case CKA_MODIFIABLE: return "MODIFIABLE";
//case CKA_ECDSA_PARAMS: return "CKA_ECDSA_PARAMS"; //case CKA_ECDSA_PARAMS: return "ECDSA_PARAMS";
case CKA_EC_PARAMS: return "CKA_ECDSA_PARAMS or CKA_EC_PARAMS"; case CKA_EC_PARAMS: return "ECDSA_PARAMS or EC_PARAMS";
case CKA_EC_POINT: return "CKA_EC_POINT"; case CKA_EC_POINT: return "EC_POINT";
case CKA_SECONDARY_AUTH: return "CKA_SECONDARY_AUTH"; case CKA_SECONDARY_AUTH: return "SECONDARY_AUTH";
case CKA_AUTH_PIN_FLAGS: return "CKA_AUTH_PIN_FLAGS"; case CKA_AUTH_PIN_FLAGS: return "AUTH_PIN_FLAGS";
case CKA_HW_FEATURE_TYPE: return "CKA_HW_FEATURE_TYPE"; case CKA_HW_FEATURE_TYPE: return "HW_FEATURE_TYPE";
case CKA_RESET_ON_INIT: return "CKA_RESET_ON_INIT"; case CKA_RESET_ON_INIT: return "RESET_ON_INIT";
case CKA_HAS_RESET: return "CKA_HAS_RESET"; case CKA_HAS_RESET: return "HAS_RESET";
case CKA_VENDOR_DEFINED: return "CKA_VENDOR_DEFINED"; case CKA_VENDOR_DEFINED: return "VENDOR_DEFINED";
case CKA_IBM_OPAQUE: return "CKA_IBM_OPAQUE"; case CKA_IBM_OPAQUE: return "IBM_OPAQUE";
default: return "unknown"; default: return "unknown";
} }
} }
std::string readableValue() {
switch (type) {
case CKA_CLASS:
switch (*((CK_OBJECT_CLASS*)value.begin().operator->())) {
case CKO_DATA: return "DATA";
case CKO_CERTIFICATE: return "CERTIFICATE";
case CKO_PUBLIC_KEY: return "PUBLIC_KEY";
case CKO_PRIVATE_KEY: return "PRIVATE_KEY";
case CKO_SECRET_KEY: return "SECRET_KEY";
case CKO_HW_FEATURE: return "HW_FEATURE";
case CKO_DOMAIN_PARAMETERS: return "DOMAIN_PARAMETERS";
case CKO_VENDOR_DEFINED: return "VENDOR_DEFINED";
default: "unknown";
}
default: return readable(value);
}
}
CK_ATTRIBUTE_TYPE type; CK_ATTRIBUTE_TYPE type;
std::string value; std::string value;
}; };
@ -190,7 +207,6 @@ namespace cryptoki {
typedef std::vector<Attribute> AttributeList; typedef std::vector<Attribute> AttributeList;
// //! Map Attribute Class to type // //! Map Attribute Class to type
// /*! @todo to be completed ... */ // /*! @todo to be completed ... */
// template<CK_ATTRIBUTE_TYPE Attribute> class AttributeType {}; // template<CK_ATTRIBUTE_TYPE Attribute> class AttributeType {};
@ -1407,7 +1423,7 @@ namespace cryptoki {
the contents of a buffer before calling the contents of a buffer before calling
C_GetAttributeValue to get such an array C_GetAttributeValue to get such an array
value. If any ulValueLen within the array isn't value. If any ulValueLen within the array isn't
large enough, it will be set to â<EFBFBD><EFBFBD>1 and the large enough, it will be set to -1 and the
function will return CKR_BUFFER_TOO_SMALL, as it function will return CKR_BUFFER_TOO_SMALL, as it
does if an attribute in the pTemplate argument does if an attribute in the pTemplate argument
has ulValueLen too small. Note that any has ulValueLen too small. Note that any
@ -1535,7 +1551,7 @@ namespace cryptoki {
calling C_GetAttributeValue to get such an calling C_GetAttributeValue to get such an
array value. If any ulValueLen within the array value. If any ulValueLen within the
array isn't large enough, it will be set array isn't large enough, it will be set
to â<EFBFBD><EFBFBD>1 and the function will return to -1 and the function will return
CKR_BUFFER_TOO_SMALL, as it does if an CKR_BUFFER_TOO_SMALL, as it does if an
attribute in the pTemplate argument has attribute in the pTemplate argument has
ulValueLen too small. Note that any ulValueLen too small. Note that any

Loading…
Cancel
Save