Hello:
I tried to generate a RSA key pair with the function:
C_GenerateKeyPair
but I have a problem. This function make a key pair, but
the public key haven´t a label, although I used a label in
the public key template. The private key have label.
I used those templates:
CK_CHAR label[] = "public_key";
CK_ATTRIBUTE publicKeyTemplate[] = {
{CKA_LABEL, label, sizeof(label)},
{CKA_KEY_TYPE, &tipoClave, sizeof(tipoClave)},
{CKA_ENCRYPT, &tru, sizeof(tru)},
{CKA_VERIFY, &tru, sizeof(tru)},
{CKA_WRAP, &tru, sizeof(tru)},
{CKA_MODULUS_BITS, &modulusBits, sizeof
(modulusBits)},
{CKA_PUBLIC_EXPONENT, publicExponent, sizeof
(publicExponent)}
};
CK_ATTRIBUTE privateKeyTemplate[] = {
{CKA_TOKEN, &tru, sizeof(tru)},
{CKA_PRIVATE, &tru, sizeof(tru)},
{CKA_SUBJECT, (void *)nombre, strlen(nombre)},
{CKA_ID, id, sizeof(id)},
{CKA_SENSITIVE, &tru, sizeof(tru)},
{CKA_DECRYPT, &tru, sizeof(tru)},
{CKA_SIGN, &tru, sizeof(tru)},
{CKA_UNWRAP, &tru, sizeof(tru)},
{CKA_LABEL, (void *)nombre, strlen(nombre)}
};
rv = (*ckFunc->C_GenerateKeyPair )( hSession,
&mechanism, publicKeyTemplate, NumAttrPublico,
privateKeyTemplate, NumAttrPrivado, &hPublicKey,
&hPrivateKey);
What is incorrect?.
Thanks.