title: What is CKA_VALUE used in AES secret key generation template?
body: <p>I am trying to integrate safenet HSM with our application. I am writing the program in C. I am referring to the <strong>PKCS11 v2.20 cryptoki</strong> standard document from RSA labs. I need to generate an AES 256 bit key. While defining the template for key generation I am not sure what value needs to be passed for CKA_VALUE. While generating a DES3 key, I didn't provide this attribute and I was able to generate a key.</p>
  
  <p>I searched for sample programs for CKA_LABEL but failed to find any solid examples in C. I found a couple of Java programs where they have used CKA_VALUE_LEN instead of CKA_VALUE. I am not sure if that will work.</p>
  
  <p>This is the snippet given in the document. Most websites give only this snippet as an example. Nothing is specified for the array value. </p>
  
  <pre><code>CK_OBJECT_CLASS class = CKO_SECRET_KEY;
  CK_KEY_TYPE keyType = CKK_AES;
  CK_UTF8CHAR label[] = “An AES secret key object”;
  CK_BYTE value[] = {...};
  CK_BBOOL true = CK_TRUE;
  CK_ATTRIBUTE template[] = {
  {CKA_CLASS, &amp;class, sizeof(class)},
  {CKA_KEY_TYPE, &amp;keyType, sizeof(keyType)},
  {CKA_TOKEN, &amp;true, sizeof(true)},
  {CKA_LABEL, label, sizeof(label)-1},
  {CKA_ENCRYPT, &amp;true, sizeof(true)},
  {CKA_VALUE, value, sizeof(value)}
  };
  </code></pre>