Is any one can provide RSA sample which use SafeNet Authentication Client SDK. The SDK only provide ECC sample. I changed something and C_GenerateKeyPair return failed. Sometimes return CKR_ATTRIBUTE_TYPE_INVALID 0x00000012. I use sample array
/* Settings for the public key */
CK_ATTRIBUTE tPubKey[] =
{
{CKA_TOKEN, &ck_False, sizeof(CK_BBOOL)},
{CKA_CLASS, &cko_PublicKey, sizeof(CK_ULONG)},
{CKA_KEY_TYPE, &ckk_RSA, sizeof(CK_ULONG)},
{CKA_PRIVATE, &ck_False, sizeof(CK_BBOOL)},
{CKA_EC_PARAMS, ec_params, sizeof(ec_params)},
};
/* Settings for the private key */
CK_ATTRIBUTE tPrvKey[] =
{
{CKA_TOKEN, &ck_True, sizeof(CK_BBOOL)},
{CKA_PRIVATE, &ck_True, sizeof(CK_BBOOL)},
{CKA_DERIVE, &ck_True, sizeof(CK_BBOOL)},
{CKA_SIGN, &ck_True, sizeof(CK_BBOOL)},
};
I change configure to RSA and I don't know what is ec_params. Actually I don't detail of template for pub. key and template for priv. key for RSA.
CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair)
#ifdef CK_NEED_ARG_LIST
(
CK_SESSION_HANDLE hSession, /* session handle */
CK_MECHANISM_PTR pMechanism, /* key-gen mech. */
CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template for pub. key */
CK_ULONG ulPublicKeyAttributeCount, /* # pub. attrs. */
CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template for priv. key */
CK_ULONG ulPrivateKeyAttributeCount, /* # priv. attrs. */
CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub. key handle */
CK_OBJECT_HANDLE_PTR phPrivateKey /* gets priv. key handle */
);
#endif
Can any help me this.
You have mentioned different storage classes for public and privatre parts:
{CKA_TOKEN, &ck_False, sizeof(CK_BBOOL)},
and
{CKA_TOKEN, &ck_True, sizeof(CK_BBOOL)},
They must have same storage class CKA_TOKEN
- both must point to ck_True
.
Also try without CKA_EC_PARAM
.
User contributions licensed under CC BY-SA 3.0