Bug 156948

Summary: [Patch] More fine-grained error messages
Product: [Unmaintained] kio Reporter: Richard Hartmann <richih-kde>
Component: ksslAssignee: Richard Hartmann <richih-kde>
Status: RESOLVED FIXED    
Severity: wishlist CC: ahartmetz, faure
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: patch for ksslcertificate.h
patch for ksslcertificate.cpp
patch for kjavaappletserver.cpp
new version of ksslcertificate.h.patch
new version of ksslcertificate.cpp.patch
new version of kjavaappletserver.cpp.patch
yet another version of ksslcertificate.h.patch
yet another version of ksslcertificate.cpp.patch
yet another version of kjavaappletserver.cpp.patch
yet another kjavaappletserver.cpp.patch

Description Richard Hartmann 2008-01-30 05:50:51 UTC
Version:            (using KDE 4.0.0)

Disclaimer: I do not speak C++ well and it is 05:36 local.

Long story short, the error messages of KSSL for OpenSSL's verify(1) are very broad and inspecific, in one case (KSSLCertificate::Expired) hiding eight(!) distinct errors behind itself.

I created three patches which apply to current svn trunk, but will definately not work, yet. I am more in the looking for feeback phase. I talked to George Staikos, who told me to find another sponsor for the patch as he was not active within KSSL, any more.

Known issues:
1) I could not fully check for all occurences of KSSLCertificate::Rejected and KSSLCertificate::Revoked as I had too many hits. From searching for the other keywords, I am reasonably sure I hit all of them, though.

2) The order in the enum of keywords in ksslcertificate.h does not match the one in ksslcertificate.cpp, yet.

3) kjavaappletserver.cpp does not carry the needed changes, yet (too late at night, need sleep).

4) X509_V_ERR_AKID_SKID_MISMATCH and X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH do not have any strings yet, as I could not wrap my head around the wording in the OpenSSL docs.


Names I changed/split into parts are:

Rejected
    CertificateRejected

Revoked
    CertificateRevoked

Untrusted
    CertificateUntrusted

SelfSignedChain
    SelfSignedInChain

SignatureFailed
    VerifyLeafSignatureFailed
    CertificateSignatureFailed
    CRLSignatureFailed
    DecryptCertificateSignatureFailed
    DecryptCRLSignatureFailed

InvalidCA
    InvalidCA
    GetIssuerCertFailed
    DecodeIssuerPublicKeyFailed
    GetIssuerCertLocallyFailed

Expired
    CertificateNotYetValid
    CertificateHasExpired
    CRLNotYetValid
    CRLHasExpired
    CertificateFieldNotBeforeErroneous
    CertificateFieldNotAfterErroneous
    CRLFieldLastUpdateErroneous
    CRLFieldNextUpdateErroneous

Newly created:
    ApplicationVerificationFailed
    OutOfMemory
    GetCRLFailed
    CertificateChainTooLong
    KeyMayNotSignCertificate


As, apart from many/most tooltips in KMail's encryption settings some years ago, this is my first patch for KDE, it is highly likely that I missed something and/or failed to follow established coding guidelines. Please be gentle :)

One related questions is if I need to add myself to the copyright section of the files. From the looks of it, I would say not, but I am external. I am, of course, fine with GPLv2+ so there should be no problems, anyway.


Any and all feedback appreciated.
Comment 1 Richard Hartmann 2008-01-30 05:51:55 UTC
Created attachment 23359 [details]
patch for ksslcertificate.h
Comment 2 Richard Hartmann 2008-01-30 05:52:23 UTC
Created attachment 23360 [details]
patch for ksslcertificate.cpp
Comment 3 Richard Hartmann 2008-01-30 05:52:49 UTC
Created attachment 23361 [details]
patch for kjavaappletserver.cpp
Comment 4 Richard Hartmann 2008-01-30 05:54:38 UTC
Oh, and the patches apply to 3.5 as well. There is a tiny issue with kdDebug vs kDebug, but else..
Comment 5 Richard Hartmann 2008-02-01 15:45:00 UTC
Created attachment 23392 [details]
new version of ksslcertificate.h.patch
Comment 6 Richard Hartmann 2008-02-01 15:45:28 UTC
Created attachment 23393 [details]
new version of ksslcertificate.cpp.patch
Comment 7 Richard Hartmann 2008-02-01 15:46:03 UTC
Created attachment 23394 [details]
new version of kjavaappletserver.cpp.patch
Comment 8 Richard Hartmann 2008-02-01 19:24:17 UTC
I will stop posting the patches here, for now. This discussion moved over to kde-devel-core [1].

I will close this bug when the patches are merged.


Richard

[1] http://lists.kde.org/?l=kde-core-devel&m=120188393728889&w=2
Comment 9 Richard Hartmann 2008-02-02 21:24:20 UTC
Created attachment 23404 [details]
yet another version of ksslcertificate.h.patch
Comment 10 Richard Hartmann 2008-02-02 21:24:38 UTC
Created attachment 23405 [details]
yet another version of ksslcertificate.cpp.patch
Comment 11 Richard Hartmann 2008-02-02 21:25:01 UTC
Created attachment 23406 [details]
yet another version of kjavaappletserver.cpp.patch
Comment 12 Richard Hartmann 2008-02-02 21:26:01 UTC
Attached here, as there is a 40 kB limit on kde-core-devel
Comment 13 Richard Hartmann 2008-02-07 01:14:55 UTC
Created attachment 23446 [details]
yet another kjavaappletserver.cpp.patch
Comment 14 David Faure 2008-02-07 10:18:05 UTC
SVN commit 771938 by dfaure:

Use KSSLCertificate::verifyText instead of duplicating the error messages here.
CCBUG: 156948


 M  +10 -42    kjavaappletserver.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=771938
Comment 15 David Faure 2008-02-07 10:27:32 UTC
SVN commit 771943 by dfaure:

Patch by Richard Hartmann  (I only changed the doxygen comment for the enum so that the KDE5 TODO doesn't replace the real dox)
"Long story short, the error messages of KSSL for OpenSSL's verify(1) are very broad and inspecific, in one case (KSSLCertificate::Expired) hiding eight(!) distinct errors behind itself."
Patch also reindents the stuff since the indentation was really weird in this code.
BUG: 156948


 M  +808 -612  ksslcertificate.cpp  
 M  +266 -239  ksslcertificate.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=771943
Comment 16 David Faure 2008-02-07 11:15:21 UTC
SVN commit 771958 by dfaure:

Fix compilation
CCBUG: 156948


 M  +2 -1      ksslcertificate.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=771958
Comment 17 Richard Hartmann 2008-02-07 13:28:54 UTC
Thanks a lot! Could you apply the same patches to 3.5 as well, please? You will need to fix the kdDebug vs kDebug thing in ksslcertificate.cpp.patch, but you are prolly faster doing it by hand than /me submitting yet another patch (If you want me to it, tell me, though).

Richard
Comment 18 David Faure 2008-02-07 18:30:13 UTC
3.5 is message-frozen, we can't add new i18n calls there. Also I'm not even sure there'll be a new 3.5.x release.
Comment 19 Richard Hartmann 2008-02-07 18:57:08 UTC
Ah, OK, then. I did not know there was a message freeze.

The KDE PIM teams seems to be certain that there will be a 3.5.9. Others have expressed the same. Personally, I think it would make sense as the wait for 4.1 will be long-ish.