Wan-Teh Chang wrote:
> It seems that if the private key already exists, we modify its attributes:
> http://lxr.mozilla.org/security/source/security/nss/lib/softoken/sftkdb.c#848
>
> Many PKCS #11 errors of the softoken are mapped to SEC_ERROR_BAD_DATA:
> http://lxr.mozilla.org/security/source/security/nss/lib/pk11wrap/pk11err.c#74
>
> Dave, if you run your program in the debugger, you should be able to track
> this down in half an hour.
>
> Wan-Teh

Heh, not sure if half an hour is a good estimate for me, but I've 
finally managed to get a debugger working with this and here is what I 
have. It is indeed trying to set attributes on the existing key, however 
for the first attribute it tries to set it fails in 
lg_FindRSAPrivateKeyAttribute falling past the switch returning 
CKR_ATTRIBUTE_TYPE_INVALID. The attribute type is 3584088832. This is 
with NSS_3_12_RC3

#0      0x1628beee in lg_FindRSAPrivateKeyAttribute at lgattr.c:868
#1      0x1628c870 in lg_FindPrivateKeyAttribute at lgattr.c:1034
#2      0x1628d8f4 in lg_GetSingleAttribute at lgattr.c:1364
#3      0x1628e0a7 in lg_SetSingleAttribute at lgattr.c:1697
#4      0x1628e264 in lg_SetAttributeValue at lgattr.c:1754
#5      0x002c3410 in sftkdb_setAttributeValue at sftkdb.c:835
#6      0x002c35db in sftkdb_write at sftkdb.c:891
#7      0x002a7a7e in sftk_handlePrivateKeyObject at pkcs11.c:1072
#8      0x002a80ed in sftk_handleKeyObject at pkcs11.c:1251
#9      0x002a8756 in sftk_handleObject at pkcs11.c:1469
#10     0x002ac673 in NSC_CreateObject at pkcs11.c:3612
#11     0x0032769c in PK11_CreateNewObject at pk11obj.c:412
#12     0x0032f0fe in PK11_ImportAndReturnPrivateKey at pk11pk12.c:439
#13     0x0032f3ec in PK11_ImportPrivateKeyInfoAndReturnKey at pk11pk12.c:544
#14     0x0032e88c in PK11_ImportDERPrivateKeyInfoAndReturnKey at pk11pk12.c:271

Dave
_______________________________________________
dev-tech-crypto mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to