1

Let's say I have access to an https weather API. Let's say I query its health status on thursday 17/08/2017 23h30 and the API replies OK (simple OK http code).

As a client, I need to prove in the future that the service actually responded me this data.

I'm thinking to asking the API to add a crypto signature of the data sent + timestamp, in order to prove they actually responded OK at that specific time. Is it overkill? Is there a more simple way of doing it?

pedrofb
  • 37,271
  • 5
  • 94
  • 142
VsM
  • 710
  • 1
  • 10
  • 23

1 Answers1

2

A digital signature containing current date/time or even adding a time stamp issued by a third party time stamp authority is an appropriate way to ensure that the content was actually issued on a date

In general, implementing a digital signature system on HTTP requests is not so simple and you have to consider many elements:

  • What content will you sign: headers, payload, attachments?

  • Is it binary content or text? Because the algorithms and signature formats will be different

  • In case of text you must canonicalize the content to avoid encoding problems when you verify the signature on the client side. Also you need to define a signature algorithm to compute the content to sign

  • Do you also need to sign the attachments when they are sent via streams?. How are you going to handle big files?

  • How are you going to attach the signature to the https response: special header, additional attribute in the payload?

  • How is the server going to distribute the signing certificate? You should include it in a truststore on the client

But, if you only want to proof that a service response was OK/FAIL, then the server just need to add a digital signature over the payload (or computed on a concatenation of the headers) but if you want to implement something more complex I suggest you take a look at the Json Web Signature (JWS)

Community
  • 1
  • 1
pedrofb
  • 37,271
  • 5
  • 94
  • 142