Skip to content

Conversation

vmiklos
Copy link
Contributor

@vmiklos vmiklos commented Feb 17, 2017

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

Copy link
Owner

@lsh123 lsh123 left a 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?

xmlSecTransformGetName(transform));
return(-1);
if(ctx->alg == SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST) {
statusDer = DSAU_EncodeDerSig(&signatureDer, &signature);
Copy link
Owner

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?

Copy link
Contributor Author

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.
@vmiklos
Copy link
Contributor Author

vmiklos commented Feb 18, 2017

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.

@vmiklos
Copy link
Contributor Author

vmiklos commented Feb 24, 2017

Hi,

Can I help anything to get this reviewed? :-)

Thanks,

Miklos

@lsh123
Copy link
Owner

lsh123 commented Feb 25, 2017

Apologies, I thought I already merged it :)

@lsh123 lsh123 merged commit bf68612 into lsh123:master Feb 25, 2017
@vmiklos vmiklos deleted the nss-ecdsa-sha256 branch February 25, 2017 16:12
vmiklos pushed a commit to vmiklos/xmlsec that referenced this pull request Mar 6, 2017
Conflicts:
	configure.ac
	src/nss/signatures.c
vmiklos pushed a commit to vmiklos/xmlsec that referenced this pull request Apr 20, 2017
Conflicts:
	configure.ac
	src/nss/signatures.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants