-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for CAdES Basic Electronic Signatures (CAdES-BES) #7893
Conversation
Ok, so one step was made, but the task is not completed yet. You now have a feature branch but it still contains all the 40+ unsquashed commits, instead of the single squashed commit. Don't worry, we can fix it without creating a new pull request. Your local branch needs to be reset to the squashed commit and then your local branch with the squashed needs to be force-pushed. You have two options:
But it will take a little while because I won't be able to do it this evening. |
'allow edits from maintainers' check button is checked however if you want to send me the commands or indicate me a link where to learn them, I can do it |
Ok, then you will do it. Can you please post the output of the following two commands? You can either post it here or send it to my email address (which you find in the git log).
|
Cool! You did it! Congratulations! |
Next question is: is your pull request ready for final review or still work-in-progress? If the latter holds, then please edit the pull request title (not the commit message title) and add the "WIP:" prefix. There is an [Edit] button right next to it at the top of this page.
|
For me this pull request is ready for final review |
Oh, I learned something today... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First read through.
FYI, I usually do more than one read through, so there may be other change requests coming up. This all looks pretty good, though, so I don't expect much changes will be needed.
In line with my previous comment , I specify a bit more my point of view: A large part of code is already in the project, You just need to extract from this file :
Add this two dedicated simple methods :
and reuse them in your code, and in ts_rsp_sign.c |
Wow!!!!! :) THANKS TO EVERYBODY! |
Thanks @maxcuttins. BTW, review and feedback from OpenSSL users are welcome at any time 😃. @opensignature it might be an option for you to announce the new CAdES feature on the openssl-users mailing list together with a link to this pull request and to ask for additional feedback from other users. Of course that's up to you. |
I agree @FdaSilvaYY, I hope in this last commit to have correctly understood your suggestion |
What do you think about adding a new sub-library to OpenSSL, crypto/ess with ess_lib.c, ess_err.c, ecc. ? |
Considering the API is a whole bunch of |
Now it all seems more logical to me that ESS functions are inside crypto/ess and rest on ts and cms (in this the two CAdES functions have remained). |
Almost! :) @opensignature you are a hero! |
Hey @opensignature, you already acquired a fan club! ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you removed "ess" from the disablable features, there's no need to check OPENSSL_NO_ESS
Test: and try to upload result file here: dss.agid.gov.it/validation in the first case the result is: Signature format: CAdES-BASELINE-B |
Here a suggestion for Don't forget to run diff --git a/doc/man3/CMS_add1_signing_cert.pod b/doc/man3/CMS_add1_signing_cert.pod
index dbcf4f6ae9..e91c1c0706 100644
--- a/doc/man3/CMS_add1_signing_cert.pod
+++ b/doc/man3/CMS_add1_signing_cert.pod
@@ -2,22 +2,28 @@
=head1 NAME
-CMS_add1_signing_cert - add ESS signing-certificate signed
-attribute to a CMS_SignerInfo data structure
+CMS_add1_signing_cert, CMS_add1_signing_cert_v2
+- add ESS signing-certificate signed attribute to a
+CMS_SignerInfo data structure
=head1 SYNOPSIS
#include <openssl/cms.h>
CMS_SignerInfo *CMS_add1_signing_cert(CMS_SignerInfo *si, X509 *signer)
+ CMS_SignerInfo *CMS_add1_signing_cert_v2(CMS_SignerInfo *si, X509 *signer,
+ const EVP_MD *sign_md)
=head1 DESCRIPTION
-CMS_add1_signing_cert() adds a ESS signing-certificate signed
-attribute using certificate B<signer> and SHA1 message digest
+CMS_add1_signing_cert() adds a ESS Signing Certificate (version 1) signed
+attribute using certificate B<signer> and SHA1 message digest
to CMS_SignerInfo B<si>structure.
-ESS signing certificate attribute is defined in the RFC 5035
-that updates Section 5.4 of RFC 2634.
+CMS_add1_signing_cert_v2() adds a ESS Signing Certificate (version 2) signed
+attribute using certificate B<signer> and message digest B<sign_md>
+to CMS_SignerInfo B<si>structure.
+ESS Signing Certificate attributes version 1 and 2 are defined in RFC 5035
+which updates Section 5.4 of RFC 2634.
=head1 NOTES
@@ -26,12 +32,8 @@ This attribute is mandatory to make a CMS compliant with CAdES-BES
=head1 RETURN VALUES
-CMS_add1_signing_cert() returns an internal pointer to the CMS_SignerInfo
-structure just added for a successful add and NULL if an error occurred.
-
-=head1 SEE ALSO
-
-L<CMS_add1_signing_cert_v2(3)>,
+CMS_add1_signing_cert() and CMS_add1_signing_cert_v2() return a pointer
+to the CMS_SignerInfo structure just added, or NULL if an error occurred.
=head1 COPYRIGHT |
@opensignature there is a merge commit (ed610c5) in your branch now. But let's not worry about gitechnical nitpicking and just concentrate on the change set. Because in the end (when it's merged into master after the second approval) all commits will be squashed anyway (by me). I will need to take a final look at it today or tomorrow evening before being able to approve. So please be patient with me. |
sorry @mspncp erroneous use of git pull |
Funny, the certificate for https://dss.agid.gov.it/validation expired yesterday: What an irony that not even the digital signature experts manage to get their web certificates renewed in time. ;-)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@opensignature now everything looks fine to me, I think now it's ready for a second review. :-)
(Note to the second reviewer: don't worry about the merge commit, the pull request will be squashed in the end, using the commit message of it's first commit.) |
use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Are you willing to take care of the |
Yes, no problem. I can do it. |
…BES) A CAdES Basic Electronic Signature (CAdES-BES) contains, among other specifications, a collection of Signing Certificate reference attributes, stored in the signedData ether as ESS signing-certificate or as ESS signing-certificate-v2. These are described in detail in Section 5.7.2 of RFC 5126 - CMS Advanced Electronic Signatures (CAdES). This patch adds support for adding ESS signing-certificate[-v2] attributes to CMS signedData. Although it implements only a small part of the RFC, it is sufficient many cases to enable the `openssl cms` app to create signatures which comply with legal requirements of some European States (e.g Italy). Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from #7893)
Merged to master: e85d19c crypto/cms: Add support for CAdES Basic Electronic Signatures (CAdES-BES) Congratulations to your first successful contribution to the OpenSSL library @opensignature! I think your pull request has matured very nicely since its first version and now it makes a nice and consistent impression. Special thanks go to @FdaSilvaYY who helped improving your work and did a major part of the reviewing. |
Thanks again to @opensignature! |
@maxcuttins there is even more on the way. I assume you have already noticed #8098 by @FdaSilvaYY? |
@mspncp, this seems very good. This is not happening at the moment. So at the moment we need to parse the asn1 code in order to see the signiningTime and check it manually against the certificate expiration date.
Do you think this new merge will help also to avoid this kind of ugly fix? |
@maxcuttins : the |
A CAdES Basic Electronic Signature (CAdES-BES) contains, among other
specifications, a collection of Signing Certificate reference attributes,
stored in the signedData ether as ESS signing-certificate or as
ESS signing-certificate-v2. These are described in detail in Section 5.7.2
of RFC 5126 - CMS Advanced Electronic Signatures (CAdES).
This patch adds support for adding ESS signing-certificate[-v2] attributes
to CMS signedData. Although it implements only a small part of the RFC, it
is sufficient many cases to enable the
openssl cms
app to create signatureswhich comply with legal requirements of some European States (e.g Italy).
(migrated from #7611)
Checklist