Closed
Bug 108097
Opened 25 years ago
Closed 24 years ago
cmsutil pick the wrong cert to create a CMS signed message
Categories
(NSS :: Tools, defect, P1)
Tracking
(Not tracked)
RESOLVED
FIXED
3.4
People
(Reporter: alam, Assigned: julien.pierre)
References
Details
Attachments
(2 files, 2 obsolete files)
|
550 bytes,
patch
|
Details | Diff | Splinter Review | |
|
4.15 KB,
patch
|
bugz
:
review+
|
Details | Diff | Splinter Review |
cmsutil failed to use the correct signing cert to generate the CMS signed
message when I have dual key certs (one for signing and the other for
encrypting) that have the same Nickname in the cert database.
I tried to use "-u 4", but cmsutil still use the wrong certificate (the
encrypting cert, instead of signing cert) to sign the message. As result, I
get the following error in Communicator when trying to read the sign msg:
The certificate is not approved for the attempted operation.
Below comment is quoted from Ian McGreer:
"The problem seems to be that cmsutil is using CERT_FindCertByNickname, which
does not distinguish usage."
Note: this bug is preventing me to run the smime automated test using dual key
certs.
Comment 1•25 years ago
|
||
Assigned the bug to Julien.
Assignee: wtc → jpierre
Priority: -- → P1
Target Milestone: --- → 3.4
| Assignee | ||
Comment 2•25 years ago
|
||
Antonio,
Can you still run your tests manually without cmsutil fixed ?
| Reporter | ||
Comment 3•25 years ago
|
||
I can only run my test with single certificate (dual-purpose cert), but not with
dual-key certs (one for signing and one for encryption). Since the dual-key
certs is the prefer way for the deployment purpose, I would like to run my test
with dual-key certs instead of single cert.
| Assignee | ||
Comment 4•25 years ago
|
||
I believe the fix for this is to use
CERT_FindUserCertByUsage to look up the cert rather than CERT_FindCertByNickname.
| Assignee | ||
Comment 5•25 years ago
|
||
Patch to allow dual-key certs to work
| Assignee | ||
Comment 6•25 years ago
|
||
I have attached a patch for this. I don't have a dual key cert to test with so I
haven't had a chance to test it for that case. But it does work with my normal
single-key cert - it looks the cert by nickname and usage for both signing and
encrypting, finds it, and the messages verify/decrypt in Communicator.
It also requires the CERT_FindUserCertByUsage symbol to be exported. I'm
proposing that this should be done in both 3.3.2 and on the tip for 3.4.
| Assignee | ||
Comment 7•25 years ago
|
||
Patch to export CERT_FindUserCertByUsage .
| Assignee | ||
Comment 8•25 years ago
|
||
I have also attached the patch to nss.def for 3.3.2 .
Ian, could you please review the code change to cmsutil ? Thanks.
Comment 9•24 years ago
|
||
The new exported symbol (CERT_FindUserCertByUsage) needs
to be approved by Bob Relyea.
Comment 10•24 years ago
|
||
Comment on attachment 58813 [details] [diff] [review]
proposed patch for cmsutil
This brings up a good point - we should really have a QA test for creating
dual-key certs and using them with cmsutil...
Attachment #58813 -
Flags: review+
| Reporter | ||
Comment 11•24 years ago
|
||
I have a dual-key cert to test the cmsutil.
Indeed, this is required for the S/MIME automated test.
Once this bug is marked fixed, I will started testing it with my dual-key cert.
Comment 12•24 years ago
|
||
Antonio, when you are done could you please give me the testcase, so I can also
put this into the regular NSS QA?
| Assignee | ||
Comment 13•24 years ago
|
||
Antonio,
I have a debug version of my tool with the patch built for Solaris 2.8 in
/u/jpierre/cmsutil . Make sure to also use the NSS shared libraries from that
directory as they are required for the patched cmsutil due to the new exported
symbol. Let me know if it works with dual-key certs.
| Reporter | ||
Comment 14•24 years ago
|
||
Tried to run the following with dual-key certs using the cmsutil in
/u/jpierre/cmsutil gave me the following error message:
cat /u/alam/tle_sprat/ns/server/msg/test/tle/smime/messages/sectest/plaintext.in
| perl smime.pl -S "Security Test's America Online Inc ID" -p "netscape" -d
"/u/alam/tle_sprat/ns/server/msg/test/tle/smime/certdb/sectest" | mail
sectest2@netscape.com
ERROR: cannot add default SMIMEEncKeyPrefs attribute.
cmsutil: problem signing: Certificate key usage inadequate for attempted
operation.
Segmentation Fault - core dumped
ERROR: signature generation failed.
The dual-key certs can be found in:
/u/alam/tle_sprat/ns/server/msg/test/tle/smime/certdb/sectest
Note: I have set the LD_LIBRARY_PATH to /u/jpierre/cmsutil:
#env |grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/u/jpierre/cmsutil
| Assignee | ||
Comment 15•24 years ago
|
||
Antonio,
I reproduced your problem and am looking into it. It seems that the way cmsutil
is written right now, it expects a signing cert to also be usable for encrypion,
and tries to set the encryption preferences using it, but it fails. I think I
need to reset the encryption preferences.
Did you try encrypting to a recipient that has a dual-key cert ? I tried -E
sectest2@netscape.com but it doesn't seem that there is a proper encryption cert
for it in your database.
| Reporter | ||
Comment 16•24 years ago
|
||
I didn't added other people's cert in my database.
Now I have added the sectest2 recipient cert into the db, and try to send a
encrypted message to it, and it worked fine:
cat /u/alam/tle_sprat/ns/server/msg/test/tle/smime/messages
/sectest/plaintext.in | perl smime.pl -E "sectest2@netscape.com" -d
"/u/alam/tle_sprat/ns/server/msg/test/tle/smime/certdb/sectest"
| mail sectest2@netscape.com
You can try again.
| Assignee | ||
Updated•24 years ago
|
Attachment #58813 -
Attachment is obsolete: true
| Assignee | ||
Comment 17•24 years ago
|
||
| Assignee | ||
Comment 18•24 years ago
|
||
Antonio,
Please get the new cmsutil from /u/jpierre/cmsutil and try it. It should work
with dual-key certs now for both signing and encrypting.
I have attached a new patch with the change. Basically when signing, cmsutil was
automatically trying to use the signing cert as encryption cert if the
encryption cert was unspecified. This setting of an encryption cert was not
needed in this case as no encryption was performed, so I have simply removed
that code. I have verified that all the cases work both with single-key and
dual-key certs.
I still need Bob to approve the change to export CERT_FindCertByUsage .
| Reporter | ||
Comment 19•24 years ago
|
||
I tried to sign a message with dual-key certs, and this time cmsutil didn't give
me the error messages I describe above. But when I tried to retrieve the signed
message from communicator 4.77, the sender's encrypting cert is NOT being added
to the "Other People" in the local certdb.
Note: I can't verify this on latest mozilla trunk build because of bug 105774.
I will tried this on Outlook Express to see if it has the same problem.
| Reporter | ||
Comment 20•24 years ago
|
||
Outlook Express 5.5 also has the same problem. The sender's encrypting cert is
not being added to the local cert db.
| Assignee | ||
Comment 21•24 years ago
|
||
OK. I guess that code was necessary after all to include the recipient's
encryption certificate. But it needed to be patched to support dual-key certs.
I'm attaching another patch. Please try the newly-updated version of cmsutil
from /u/jpierre/cmsutil again. Thanks.
| Assignee | ||
Updated•24 years ago
|
Attachment #59969 -
Attachment is obsolete: true
| Assignee | ||
Comment 22•24 years ago
|
||
| Reporter | ||
Comment 23•24 years ago
|
||
Finally, it worked now. I can sign/encrpyt with dual-key certs, and the sender's
encrypting cert is added into the certdb as well.
| Assignee | ||
Comment 24•24 years ago
|
||
Ian,
Could you please review the latest patch I attached ? It seems to work great for
me and Antonio in NSS 3.3 . Can't get it to work in NSS 3.4 though - but then
again even without this patch all I get with NSS 3.4 is core dumps.
| Assignee | ||
Comment 25•24 years ago
|
||
I am checking this in to the tip as I'm now convinced the s/mime crashes I'm
getting in 3.4 are unrelated - they happen regardless of this patch. I would
like to also check it into the 3.3 branch, but there is a code freeze.
Everything should work on the 3.4 branch once 113746 gets resolved. I will wait
until it does to mark this defect fixed.
Depends on: 113746
Updated•24 years ago
|
Attachment #59978 -
Flags: review+
Comment 26•24 years ago
|
||
Comment on attachment 59978 [details] [diff] [review]
latest patch for dual-key cert support
just showing my support for the patch :)
Comment 27•24 years ago
|
||
My understanding is that we plan to have mozilla switched to
NSS 3.4 (pre-release) in mozilla0.9.8. So we should stop
checking in mozilla-related fixes on the NSS 3.3 branch unless
they are targeted mozilla0.9.7.
Comment 28•24 years ago
|
||
I discussed this with Antonio. He has private builds from Julien that allow him
to run his test suite.
cmsutil is still useful to test the mozilla s/mime implementation until it uses
3.4 at which point a 3.4 based cmsutil will have to be used.
I'm fine with this interim solution as long as Antonio is.
| Assignee | ||
Comment 29•24 years ago
|
||
113746 is not reproducible, so marking this resolved
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•