pkcs11: Added names for CKA_* constants.
authorTobias Brunner <tobias@strongswan.org>
Fri, 28 Oct 2011 16:07:02 +0000 (18:07 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 31 Oct 2011 17:45:36 +0000 (18:45 +0100)
src/libstrongswan/plugins/pkcs11/pkcs11_library.c
src/libstrongswan/plugins/pkcs11/pkcs11_library.h

index d819ddc..ef20fa7 100644 (file)
@@ -447,6 +447,123 @@ ENUM_NEXT(ck_mech_names, CKM_DSA_PARAMETER_GEN, CKM_X9_42_DH_PARAMETER_GEN,
        "X9_42_DH_PARAMETER_GEN");
 ENUM_END(ck_mech_names, CKM_X9_42_DH_PARAMETER_GEN);
 
+
+ENUM_BEGIN(ck_attr_names, CKA_CLASS, CKA_LABEL,
+       "CLASS",
+       "TOKEN",
+       "PRIVATE",
+       "LABEL");
+ENUM_NEXT(ck_attr_names, CKA_APPLICATION, CKA_OBJECT_ID, CKA_LABEL,
+       "APPLICATION",
+       "VALUE",
+       "OBJECT_ID");
+ENUM_NEXT(ck_attr_names, CKA_CERTIFICATE_TYPE, CKA_HASH_OF_ISSUER_PUBLIC_KEY,
+               CKA_OBJECT_ID,
+       "CERTIFICATE_TYPE",
+       "ISSUER",
+       "SERIAL_NUMBER",
+       "AC_ISSUER",
+       "OWNER",
+       "ATTR_TYPES",
+       "TRUSTED",
+       "CERTIFICATE_CATEGORY",
+       "JAVA_MIDP_SECURITY_DOMAIN",
+       "URL",
+       "HASH_OF_SUBJECT_PUBLIC_KEY",
+       "HASH_OF_ISSUER_PUBLIC_KEY");
+ENUM_NEXT(ck_attr_names, CKA_CHECK_VALUE, CKA_CHECK_VALUE,
+               CKA_HASH_OF_ISSUER_PUBLIC_KEY,
+       "CHECK_VALUE");
+ENUM_NEXT(ck_attr_names, CKA_KEY_TYPE, CKA_DERIVE, CKA_CHECK_VALUE,
+       "KEY_TYPE",
+       "SUBJECT",
+       "ID",
+       "SENSITIVE",
+       "ENCRYPT",
+       "DECRYPT",
+       "WRAP",
+       "UNWRAP",
+       "SIGN",
+       "SIGN_RECOVER",
+       "VERIFY",
+       "VERIFY_RECOVER",
+       "DERIVE");
+ENUM_NEXT(ck_attr_names, CKA_START_DATE, CKA_END_DATE, CKA_DERIVE,
+       "START_DATE",
+       "END_DATE");
+ENUM_NEXT(ck_attr_names, CKA_MODULUS, CKA_COEFFICIENT, CKA_END_DATE,
+       "MODULUS",
+       "MODULUS_BITS",
+       "PUBLIC_EXPONENT",
+       "PRIVATE_EXPONENT",
+       "PRIME_1",
+       "PRIME_2",
+       "EXPONENT_1",
+       "EXPONENT_2",
+       "COEFFICIENT");
+ENUM_NEXT(ck_attr_names, CKA_PRIME, CKA_SUB_PRIME_BITS, CKA_COEFFICIENT,
+       "PRIME",
+       "SUBPRIME",
+       "BASE",
+       "PRIME_BITS",
+       "SUB_PRIME_BITS");
+ENUM_NEXT(ck_attr_names, CKA_VALUE_BITS, CKA_KEY_GEN_MECHANISM,
+               CKA_SUB_PRIME_BITS,
+       "VALUE_BITS",
+       "VALUE_LEN",
+       "EXTRACTABLE",
+       "LOCAL",
+       "NEVER_EXTRACTABLE",
+       "ALWAYS_SENSITIVE",
+       "KEY_GEN_MECHANISM");
+ENUM_NEXT(ck_attr_names, CKA_MODIFIABLE, CKA_MODIFIABLE, CKA_KEY_GEN_MECHANISM,
+       "MODIFIABLE");
+ENUM_NEXT(ck_attr_names, CKA_EC_PARAMS, CKA_EC_POINT, CKA_MODIFIABLE,
+       "EC_PARAMS",
+       "EC_POINT");
+ENUM_NEXT(ck_attr_names, CKA_SECONDARY_AUTH, CKA_ALWAYS_AUTHENTICATE,
+               CKA_EC_POINT,
+       "SECONDARY_AUTH",
+       "AUTH_PIN_FLAGS",
+       "ALWAYS_AUTHENTICATE");
+ENUM_NEXT(ck_attr_names, CKA_WRAP_WITH_TRUSTED, CKA_WRAP_WITH_TRUSTED,
+               CKA_ALWAYS_AUTHENTICATE,
+       "WRAP_WITH_TRUSTED");
+ENUM_NEXT(ck_attr_names, CKA_HW_FEATURE_TYPE, CKA_HAS_RESET,
+               CKA_WRAP_WITH_TRUSTED,
+       "HW_FEATURE_TYPE",
+       "RESET_ON_INIT",
+       "HAS_RESET");
+ENUM_NEXT(ck_attr_names, CKA_PIXEL_X, CKA_BITS_PER_PIXEL, CKA_HAS_RESET,
+       "PIXEL_X",
+       "RESOLUTION",
+       "CHAR_ROWS",
+       "CHAR_COLUMNS",
+       "COLOR",
+       "BITS_PER_PIXEL");
+ENUM_NEXT(ck_attr_names, CKA_CHAR_SETS, CKA_MIME_TYPES, CKA_BITS_PER_PIXEL,
+       "CHAR_SETS",
+       "ENCODING_METHODS",
+       "MIME_TYPES");
+ENUM_NEXT(ck_attr_names, CKA_MECHANISM_TYPE, CKA_SUPPORTED_CMS_ATTRIBUTES,
+               CKA_MIME_TYPES,
+       "MECHANISM_TYPE",
+       "REQUIRED_CMS_ATTRIBUTES",
+       "DEFAULT_CMS_ATTRIBUTES",
+       "SUPPORTED_CMS_ATTRIBUTES");
+ENUM_NEXT(ck_attr_names, CKA_WRAP_TEMPLATE, CKA_UNWRAP_TEMPLATE,
+               CKA_SUPPORTED_CMS_ATTRIBUTES,
+       "WRAP_TEMPLATE",
+       "UNWRAP_TEMPLATE");
+ENUM_NEXT(ck_attr_names, CKA_ALLOWED_MECHANISMS, CKA_ALLOWED_MECHANISMS,
+               CKA_UNWRAP_TEMPLATE,
+       "ALLOWED_MECHANISMS");
+ENUM_END(ck_attr_names, CKA_ALLOWED_MECHANISMS);
+/* the values in an enum_name_t are stored as int, thus CKA_VENDOR_DEFINED
+ * will overflow and is thus not defined here */
+
+
+
 /**
  * Private data of an pkcs11_library_t object.
  */
index abe0234..e0db653 100644 (file)
@@ -72,7 +72,7 @@ struct pkcs11_library_t {
         *
         * @param session       session to use
         * @param tmpl          search template
-        * @param tcount        number of attributes in the search template
+        * @param tcount        number of attributes in the search template
         * @param attr          attributes to read from object
         * @param acount        number of attributes to read
         */
@@ -109,6 +109,11 @@ extern enum_name_t *ck_rv_names;
 extern enum_name_t *ck_mech_names;
 
 /**
+ * Enum names for CK_ATTRIBUTE_TYPE values
+ */
+extern enum_name_t *ck_attr_names;
+
+/**
  * Trim/null terminate a string returned by the varius PKCS#11 functions.
  *
  * @param str          string to trim