FHIR Chat · OpenSSL · smart/health-cards

Stream: smart/health-cards

Topic: OpenSSL


view this post on Zulip Grahame Grieve (Sep 11 2021 at 23:41):

Has anyone tried to implement the JWS part of the spec using openSSL? I'm using the EVP_DigestVerifyInit | EVP_DigestUpdate | EVP_DigestVerifyFinal methods, and openSSL generates ok, and verifies it's own signatures, but the signatures are different to other ones, and it doesn't verify other signatures.

My take is that openSSL EVP_DigestVerifyFinal doesn't conform to this rule

"The JWS Signature is the value R || S."

from https://datatracker.ietf.org/doc/html/rfc7515#appendix-A.3.1 but all the openSSL implementations I can find and understand use EVP_DigestVerifyFinal and the openSSL mailing list said I was doing something wrong - well, I can't figure out what it could be. the OpenSSL signatures include a nonce and are not reproducible, so I don't see how they can conform to the rule I quoted. And I haven't found a non-openSSL based implementation I can use in an open source win64 application.

Can anyone comment?

view this post on Zulip Josh Mandel (Sep 12 2021 at 00:12):

I'm assuming you're familiar with the aspects of representation discussed in https://stackoverflow.com/questions/59904522/asn1-encoding-routines-errors-when-verifying-ecdsa-signature-type-with-openssl ?

view this post on Zulip Grahame Grieve (Sep 12 2021 at 00:17):

well, I wasn't. I found that by accident searching for the openSSL error message a couple of minutes before you posted it. How did you find it so easy?

view this post on Zulip Josh Mandel (Sep 12 2021 at 00:19):

view this post on Zulip Josh Mandel (Sep 12 2021 at 00:20):

(I feel like getting search terms right requires a good dose of luck.)

view this post on Zulip Grahame Grieve (Sep 12 2021 at 00:20):

thx. seems obvious but I didn't find it :-(

view this post on Zulip Josh Mandel (Sep 12 2021 at 00:20):

I'm not clear on the nonce related issues you described, but getting the binary representation of the signature right seems like a good start.

view this post on Zulip Grahame Grieve (Sep 12 2021 at 00:25):

yes that does sort things out.


Last updated: Apr 12 2022 at 19:14 UTC