[gpkcs11-dev] Problem with C_GenerateKeyPair
Status: Beta
Brought to you by:
cypherfox
|
From: Angel M. G. <an...@ti...> - 2004-11-10 10:04:56
|
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=20
the public key haven=B4t a label, although I used a label in=20
the public key template. The private key have label.
I used those templates:
CK_CHAR label[] =3D "public_key";
CK_ATTRIBUTE publicKeyTemplate[] =3D {
{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=20
(publicExponent)}
};
CK_ATTRIBUTE privateKeyTemplate[] =3D {
{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 =3D (*ckFunc->C_GenerateKeyPair )( hSession,=20
&mechanism, publicKeyTemplate, NumAttrPublico,=20
privateKeyTemplate, NumAttrPrivado, &hPublicKey,=20
&hPrivateKey);
What is incorrect?.
Thanks.
|