Hi, I'm reading this code:
NSSLOWKEYSubjectPublicKeyInfo spki; NSSLOWKEYPublicKey pubk; SECItem *publicKeyInfo; if (SEC_ASN1EncodeItem(arena, &spki.subjectPublicKey, &pubk, nsslowkey_RSAPublicKeyTemplate) == NULL) { crv = CKR_HOST_MEMORY; goto loser; } publicKeyInfo = SEC_ASN1EncodeItem(arena, NULL, &spki, nsslowkey_SubjectPublicKeyInfoTemplate); if (!publicKeyInfo) { crv = CKR_HOST_MEMORY; goto loser; } in nss/lib/softoken/pkcs11c.c:sftk_unwrapPrivateKey() In my version of this code I'm finding that I need to convert the returned subjectPublicKey's length to bits, something like: spki.subjectPublicKey *= 8; before making the second SEC_ASN1EncodeItem() call. I believe this is because that field is encoded using: { SEC_ASN1_BIT_STRING, offsetof(NSSLOWKEYSubjectPublicKeyInfo, subjectPublicKey) }, and SEC_ASN1_BIT_STRING expects the SECItem.len to be in bits not bytes. could the above have the same problem? Andrew -- You received this message because you are subscribed to the Google Groups "dev-tech-crypto@mozilla.org" group. To unsubscribe from this group and stop receiving emails from it, send an email to dev-tech-crypto+unsubscr...@mozilla.org. To view this discussion on the web visit https://groups.google.com/a/mozilla.org/d/msgid/dev-tech-crypto/CAJeAr6sqVsB26Qri3utMAf3BXXNv%3DfcAkn1iJCy2%2BJ-%2BpBKZ-Q%40mail.gmail.com.