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.
question from:
https://stackoverflow.com/questions/65895629/how-to-use-safenet-authentication-client-sdk-to-generate-rsa-key-pair-and-sign 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…