Subject: [jose] JSON-I. Was: JWK member names, was: SECDIR review of draft-ietf-jose-json-web-key-31

From: Anders Rundgren <[email-masked]>
Date: Thu, 18 Sep 2014 14:11:46 +0200

Hi Tero,
You are of course right.  If you want to use JOSE you should use a parser that matches the requirements or update an existing until it does.
I would consider taking this one step further.

It is /*trivial*/ creating (sort of) "canonicalized" JSON by tweaking the parser (not the JSON spec) so that it doesn't modify the input with the exception of whitespace and escaping.

There's no point repeating the problems we had with XML but still you don't /*have*/ to revert to base64-encoded octet-strings either.

Why is that important?  Because then you open the door to things like step #8 on:
http://webpki.org/papers/PKI/EMV-Tokenization-SET-3DSecure-WebCryptoPlusPlus-combo.pdf#page=4
which when using JCS looks like this (actual log message):

{
   "@context": "http://xmlns.webpki.org/wcpp-payment-demo",
   "@qualifier": "TransactionResponse",
   "PaymentRequest":
     {
       "CommonName": "Demo Merchant",
       "Amount": 325,
       "Currency": "USD",
       "ReferenceID": "#1000000",
       "DateTime": "2014-09-17T14:17:22Z",
       "Signature":
         {
           "Algorithm": "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
           "KeyInfo":
             {
               "SignatureCertificate":
                 {
                   "Issuer": "CN=Merchant Network Sub CA5,C=DE",
                   "SerialNumber": "1410946675139",
                   "Subject": "CN=Demo Merchant,2.5.4.5=#1306383936333235,C=DE"
                 },
               "X509CertificatePath":
                 [
"MIIDQzCCAiugAwIBAgIGAUiC-bHDMA0GCSqGSIb3DQEBCwUAMDAxCzAJBgNVBAYTAkRFMSEwHwYDVQQDExhNZXJjaGFudCBOZXR3b3JrIFN1YiBDQ
TUwHhcNMTQwMTAxMDAwMDAwWhcNMjAwNzEwMDk1OTU5WjA2MQswCQYDVQQGEwJERTEPMA0GA1UEBRMGODk2MzI1MRYwFAYDVQQDEw1EZW1vIE1lcmNoYW50MIIBIjANBgkqh
kiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlrcRmV_2Wt1-N_MQA_v55GMXCeUfep3f5gC6R76OzBgAR-Ix8waP_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lBOmf8FxNRLsu-UYIugCTmvvA0b3QT9f5qgr_YqPD0tgXbiUShKQon6LRLDqV8jSxMg9XPWD8o
ScX-1rOJS8kE3TgB16VQQI"
                 ]
             },
           "SignatureValue": "Pdp3FCQuu34gBtyobMGTbesrqLgl5NuICpeVBxvvnwo6oqCX0d0thRWxGTLdUEniPbd4JnODCr3FjOlaLHJl7OuguJX6ejRmvA29y8q
JhcELXtT1_n13JAI8puHPtk-hn_1M8d7048dqAeUKzjwN-uhyup1CaaxaVf4zxkMJBcUDqgs17EKmsHtuEKvz8kti8QfpYVWGRlJbkWlQHGerPVb6Ev6i4by1ruSZLnVLjFw
0-CerwOHMzN49FBe9_vjtDzAGqLTcHZlJxDHKBMEeCc9WERuGOEQHqdPG1lrQfuTcCqZPs-yXIXNQTvmLalK005DgODLPYCPt2tthNBjIzA"
         }
     },
   "TransactionID": "#164006",
   "PayeePAN": "**** **** **** 1405",
   "CardType": "SuperCard",
   "Signature":
     {
       "Algorithm": "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
       "KeyInfo":
         {
           "SignatureCertificate":
             {
               "Issuer": "CN=Payment Network Sub CA3,C=EU",
               "SerialNumber": "1410946666582",
               "Subject": "CN=mybank.com,2.5.4.5=#130434353031,C=FR"
             },
           "X509CertificatePath":
             [
"MIIDPTCCAiWgAwIBAgIGAUiC-ZBWMA0GCSqGSIb3DQEBCwUAMC8xCzAJBgNVBAYTAkVVMSAwHgYDVQQDExdQYXltZW50IE5ldHdvcmsgU3ViIENBMzAeF
w0xNDAxMDEwMDAwMDBaFw0yMDA3MTAwOTU5NTlaMDExCzAJBgNVBAYTAkZSMQ0wCwYDVQQFEwQ0NTAxMRMwEQYDVQQDEwpteWJhbmsuY29tMIIBIjANBgkqhkiG9w0BAQEFA
AOCAQ8AMIIBCgKCAQEA1_7YaM1c28HRTYzzVQzTP-ohms_xBoVWl2W5Ac4ZWItD3MqXIKukxjjUXQtb3duLHHnEgIvnAe-boksQ1KyvLigAMfpUKKr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KpSVi9RG_p5RnJc6uCBfgPW0PK3QUaYgwzR6GA8PeRCn
fk5B4HATgLo_p5K"
             ]
         },
       "SignatureValue": "LZyTyWZPvX2Wfztvbr_d_25tvo4JxRfy3waqMbJEF3_It9lD83jdlkjSvqk5EosNU45_xcnYnCtdgeT0i7allt6vZW4-0-wr6QZLMtnsJNk
Slk249z5y2Q_qZmqbBL0NpolepcREF_TBa_fSnWUV_c2lTkc6lj725_fIVHV1b58rYSEGE3yqF9zi3Eb8LGBIWf5TPXB3BloHu5aj1C3kqIwUkR0nOnoLPvxI5lF44yyLyKt
Yvtqth3EoAmrcu-h2eLD-GMe18jwxazkK8QS3ZecJ-0Kb1RP5bgsReEwnrRJnLS6li5XqWRtJA6PBTJDrpvrIn_HLaqaATCbSborbyQ"
     }
}

JSON-I as it stands today doesn't return (IMO FWIW) enough benefits to motivate redesigned parsers.

https://openkeystore.googlecode.com/svn/resources/trunk/docs/jcs.html#Normalization_and_Signature_Validation

I will as an experiment see if I can add this feature to the Firefox JSON implementation.  I could of course be wrong...

Regards,
Anders Rundgren