autograph icon indicating copy to clipboard operation
autograph copied to clipboard

Return serial number of the signed certificate

Open EnTeQuAk opened this issue 7 years ago • 10 comments

As part of porting AMO over to using /sign/file endpoint I'm investigating whether or not we'll eventually be able to get rid of the signing-clients dependency.

Once ported to /sign/file the only thing that AMO still does with the XPI is extracting the certificates serial number.

I wonder if it's possible to return it in the response data of /sign/file too.

EnTeQuAk avatar Jan 15 '19 13:01 EnTeQuAk

It'd be great to either decide if it's feasible to implement before AMO moves to /sign/file endpoint or if I should keep the current implementation.

An advantage would be that we don't have to open the XPI anymore after signing it which should speed-up the whole process a bit.

EnTeQuAk avatar Jan 15 '19 13:01 EnTeQuAk

I'm theoretically in favor, but the implementation may be tricky. This touches the SignFile interface which only returns a signed file and an error right now. We'd have to return extra metadata as well, probably as an opaque interface{} marshaled into the API response to be future proof. It's not the ugliest design in the world, but since it break an existing interface, we may want to implement it as a new one instead, possibly SignFileWithDetails.

jvehent avatar Jan 15 '19 14:01 jvehent

Could we return the serial number in an http header?

g-k avatar Jan 15 '19 14:01 g-k

I don't think that makes it any easier.

jvehent avatar Jan 15 '19 14:01 jvehent

This is about pulling the UUID from the EE cert to use as the addon ID right?

g-k avatar Jan 15 '19 14:01 g-k

No, this is about returning the EE cert's serial number, generated at signing, back to the caller.

jvehent avatar Jan 15 '19 14:01 jvehent

No, this is about pulling serialNumber from the actual pkcs7 content part (signer_info.sid.issuer.serial_number)

EnTeQuAk avatar Jan 15 '19 14:01 EnTeQuAk

Gotcha, I think there were other use cases for changing the SignFile interface to return extra signer specific data (audit fields and other things that escape me at the moment).

So I think we could refactor all SignFile calls to SignFileWith{Details,Data} that returns data / details a JSON marshalable interface{} and adds it to the sign file response data structure as "extra". For existing signers it would be nil and marshal to {}.

g-k avatar Jan 15 '19 14:01 g-k

:+1:

jvehent avatar Jan 15 '19 14:01 jvehent

Note to self: can use gofmt for this https://blog.golang.org/go-fmt-your-code#TOC_3.

g-k avatar Mar 19 '19 18:03 g-k