I am developing a PKCS#11 Module for Netscape 4.7, I develop a few
options and
works fine, but when I try to generate a RSA key for certificate
enrollment, Netscape
give me wrong parameters when it calls C_GenerateKeyPair.
I take the definition of the function from RSA PKCS#11 v 2.10
especifications:
CK_DEFINE_FUNCTION(CK_RV, C_GenerateKeyPair)(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
CK_ATTRIBUTE_PTR pPublicKeyTemplate,
CK_ULONG ulPublicKeyAttributeCount,
CK_ATTRIBUTE_PTR pPrivateKeyTemplate,
CK_ULONG ulPrivateKeyAttributeCount,
CK_OBJECT_HANDLE_PTR phPublicKey,
CK_OBJECT_HANDLE_PTR phPrivateKey
)
The problem arrises when I try to go through the pPublicKeyTemplate
table,
Netscape told that this table has 0x206f6369 entries!!! Of course the
value is
wrong, but I can't find where I made the mistake.
I'm using MS Visual C++ 6.0, and the debugger prints this stack trace
C_GenerateKeyPair(unsigned long 0x00000002, CK_MECHANISM * 0x0012f544,
CK_ATTRIBUTE * 0x76696e55, unsigned long 0x206f6369,
CK_ATTRIBUTE * 0x0012f628, unsigned long 0x00000007,
unsigned long * 0x0012f6a0, unsigned long * 0x0012f69c) line 1081
NETSCAPE! 0077acac()
I've tried to read up to 7 seven entries and values has meaning in the
context
(Key Generation for RSA), 8th entry refer to a CKA_TYPE of other type of
key.
I can hardcode this value, but I think that there should be another way
of
doing this.
Thanks in advance.
------------------------------------------------------------------------------
Rafael Calzada
Carlos III University of Madrid
http://teleles.uc3m.es/~rafa