-
Notifications
You must be signed in to change notification settings - Fork 107
nss: add ECDSA-SHA256 support #83
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
Conversation
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.
Which version of NSS does support ECDSA? Should the configure.in be changed appropriately?
src/nss/signatures.c
Outdated
| xmlSecTransformGetName(transform)); | ||
| return(-1); | ||
| if(ctx->alg == SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST) { | ||
| statusDer = DSAU_EncodeDerSig(&signatureDer, &signature); |
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.
Is it possible to use DSAU_EncodeDerSigWithLen() for SHA1 too?
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.
Indeed, the difference between the two is just an assert before they call a shared internal function, so using DSAU_EncodeDerSigWithLen() for both makes sense.
make check-crypto-nss XMLSEC_TEST_NAME="aleksey-xmldsig-01/enveloping-sha256-ecdsa-sha256" now passes after these changes. Other notes: - the NSS representation of ECDSA keys is ecKey - the NSS identifier for ECDSA-SHA256 is SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE - ECDSA has no fixed signature size, as it depends on the curve parameters. This means the size has to be always told explicitly to NSS, so DSAU_DecodeDerSig() -> DSAU_DecodeDerSigToLen(), DSAU_EncodeDerSig() -> DSAU_EncodeDerSigWithLen(). - the full list of supported ECDSA parameters is at e.g. NSS ecdecode.c, EC_FillParams(): https://dxr.mozilla.org/nss/source/nss/lib/freebl/ecdecode.c#214 - ECDSA support is available in 3.11.1 according to <https://wiki.mozilla.org/NSS:Roadmap:Archive#Elliptic_Curve_Cryptography>, so upgrade the minimal version requirement accordingly.
|
https://wiki.mozilla.org/NSS:Roadmap:Archive#Elliptic_Curve_Cryptography says 3.11.1 should be the new requirement, hopefully that's not really problematic, I have 3.28 e.g. here. |
13a5250 to
1650d8d
Compare
|
Hi, Can I help anything to get this reviewed? :-) Thanks, Miklos |
|
Apologies, I thought I already merged it :) |
Conflicts: configure.ac src/nss/signatures.c
Conflicts: configure.ac src/nss/signatures.c
make check-crypto-nss XMLSEC_TEST_NAME="aleksey-xmldsig-01/enveloping-sha256-ecdsa-sha256"
now passes after these changes. Other notes:
the NSS representation of ECDSA keys is ecKey
the NSS identifier for ECDSA-SHA256 is
SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE
ECDSA has no fixed signature size, as it depends on the curve
parameters. This means the size has to be always told explicitly to
NSS, so DSAU_DecodeDerSig() -> DSAU_DecodeDerSigToLen(),
DSAU_EncodeDerSig() -> DSAU_EncodeDerSigWithLen().
the full list of supported ECDSA parameters is at e.g. NSS ecdecode.c,
EC_FillParams():
https://dxr.mozilla.org/nss/source/nss/lib/freebl/ecdecode.c#214