Bug 1551702
Summary: | certmonger unit test fails with SEC_ERROR_BAD_DER | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Rob Crittenden <rcritten> | ||||||||||||||
Component: | certmonger | Assignee: | Rob Crittenden <rcritten> | ||||||||||||||
Status: | CLOSED ERRATA | QA Contact: | ipa-qe <ipa-qe> | ||||||||||||||
Severity: | urgent | Docs Contact: | |||||||||||||||
Priority: | high | ||||||||||||||||
Version: | 7.5 | CC: | dueno, hkario, kengert, ksiddiqu, lmiksik, mgrepl, mkosek, nalin, ndehadra, pvoborni, rcritten, rrelyea, salmy, toneata | ||||||||||||||
Target Milestone: | rc | Keywords: | Regression, ZStream | ||||||||||||||
Target Release: | --- | ||||||||||||||||
Hardware: | Unspecified | ||||||||||||||||
OS: | Unspecified | ||||||||||||||||
Whiteboard: | |||||||||||||||||
Fixed In Version: | certmonger-0.78.4-4.el7 | Doc Type: | If docs needed, set a value | ||||||||||||||
Doc Text: | Story Points: | --- | |||||||||||||||
Clone Of: | |||||||||||||||||
: | 1560960 (view as bug list) | Environment: | |||||||||||||||
Last Closed: | 2018-10-30 07:44:03 UTC | Type: | Bug | ||||||||||||||
Regression: | --- | Mount Type: | --- | ||||||||||||||
Documentation: | --- | CRM: | |||||||||||||||
Verified Versions: | Category: | --- | |||||||||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||||||||
Embargoed: | |||||||||||||||||
Bug Depends On: | |||||||||||||||||
Bug Blocks: | 1551635, 1560960 | ||||||||||||||||
Attachments: |
|
Description
Rob Crittenden
2018-03-05 19:09:33 UTC
Created attachment 1404489 [details]
cert.nss.2048
Created attachment 1404490 [details]
raw DER encoding of cert.nss.2048
Created attachment 1404491 [details]
stack.txt
Created attachment 1404504 [details]
cert text dump
Bob, Hubert, any idea what properties of this certificate could cause NSS 3.36 to fail decoding this certificate with BAD_DER, while NSS 3.28 had worked?
Well, I don't know if this encoding is valid. Another potential explanation could be that NSS 3.36 produced an invalid encoding.
I've got no clue, it looks sane and openssl parses it without issue, but it complaints about not being able to get issuer, despite this cert looking self-signed: $ openssl verify -CAfile cert.nss.2048 cert.nss.2048 CN = Babs Jensen error 20 at 0 depth lookup: unable to get local issuer certificate error cert.nss.2048: verification failed maybe "X509v3 Subject Key Identifier" is calculated wrong? This bug is seen with NSS 3.34. It might be worth repeating the test with the nss-softokn 3.36 packages that Daiki is currently working on. Although I don't have a lot of hope that it makes a difference. Created attachment 1405176 [details] minimal reproducer OK, I realized that this is a problem in the test program (it worked before because the old decoder is more tolerant about the length). When decoding BIT_STRING either with the old decoder or QuickDER, the length is returned in the number of bits instead of octets; so 504 / 8 = 64. On the other hand, VFY_VerifyDataWithAlgorithmIDI() expects octet length for the signature value. So you need to adjust it with something like: signed_data.signature.len /= 8; before calling that function. I am attaching the standalone version of checksig.c, which can be compiled with: $ gcc -o checksig checksig.c `pkg-config nss --cflags --libs` Feed the "der" file attached at comment 9: $ cat der | ./checksig error in verification: SEC_ERROR_BAD_DER If you comment out the line 95 (which adds the above adjustment) and recompile it: $ cat der | ./checksig verification OK Bob, thanks for the analysis. Daiki, thanks for identifying the fix! I'm attaching Daiki's suggested fix, and reassigning to certmonger. Rob, could you please verify it fixes the issue? Created attachment 1405225 [details]
Daiki's suggested fix as a patch to certmonger
The patch works for me, thank you very much! It doesn't look like any changes to NSS are required. IPA version: ipa-server-4.6.4-3.el7.x86_64 Certmonger: certmonger-0.78.4-3.el7.x86_64 Verified that the sanity tests required for verifying this bug are run successfully. No errors are observed when test run for ipa-getcert are run as regression for latest version. Thus marking the status of bug to Verified, based on these observations. (In reply to Nikhil Dehadrai from comment #31) > IPA version: ipa-server-4.6.4-3.el7.x86_64 > Certmonger: certmonger-0.78.4-3.el7.x86_64 > > Verified that the sanity tests required for verifying this bug are run > successfully. > > No errors are observed when test run for ipa-getcert are run as regression > for latest version. > > Thus marking the status of bug to Verified, based on these observations. certmonger version: certmonger-0.78.4-8.el7.x86_64 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:3018 |