API for verifying certificates with SCT signatures

Visto 444 veces
Saltar al primer mensaje no leído

Tomas Gustavsson

no leída,
6 mar 2018, 8:13:396/3/18
a certificate-transparency
Hi,

I was looking for a tool to verify SCTs in issued certificates. The Google CT code in Github:

Don't do that, it has a todo:
* It does not work for verifying a final certificate with the CT extension. TODO(eranm): Add the
* ability to remove the CT extension and verify a final certificate.

Is anyone using some APIs to verify final certificate with the CT extension?

Regards,
TOmas

Al Cutter

no leída,
6 mar 2018, 9:09:146/3/18
a certificate-...@googlegroups.com
Hi Tomas,

you might be interested in this PR:

It's in golang, but even if that's not directly useful for you it'll at least show you the steps required to implement it in Java (and we'd be very happy to receieve a PR for that!)

Cheers,
Al.


--
You received this message because you are subscribed to the Google Groups "certificate-transparency" group.
To unsubscribe from this group and stop receiving emails from it, send an email to certificate-transp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/certificate-transparency/ab7bce0a-3d53-4b7d-a953-b037ac0587a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tomas Gustavsson

no leída,
13 may 2018, 17:45:1513/5/18
a certificate-transparency
Hi Al,

I have implemented the functionality in the Java API now. As usual most of the time was doing plumbing, and figure out where everything was. I spent some time re-implementing stripping an extension form the TBSCertificate until I found out that that Eran had already done that for the poison extension and I could just remove my code and add one more if statement to Erans code. It's not complete, as the "main" only verifies the first of the SCTs and does not loop over all of them. 

Let me know if it's interesting, and I can try to create a complete pull request for the certificate-transparency-java.

I tested by verifying the Google Pilos SCT (key attached) embedded in the EV certificate of GitHub (attached as chain.pem).

Full diff against current master attached.

Since it's not made to be humanly possible to match keys against SCTs I implemented in "main" directory parsing so you can put all known keys in a directory and the program will find the right key to verify the SCT with by calculating the "log" ID..


Cheers,
Tomas
verify-final-cert.diff
chain.pem
google-pilot.pub

Al Cutter

no leída,
14 may 2018, 6:58:3914/5/18
a certificate-...@googlegroups.com
Hi Tomas,

that sounds really great, thanks!
Please do send a PR and we'll take a look.

Cheers,
Al.

--
You received this message because you are subscribed to the Google Groups "certificate-transparency" group.
To unsubscribe from this group and stop receiving emails from it, send an email to certificate-transp...@googlegroups.com.

Tomas Gustavsson

no leída,
17 may 2018, 15:54:3917/5/18
a certificate-transparency

Here is a pull request to verify SCTs in a certificate. 

Tested with the github.com TLS, sample output below. I didn't have one of the log keys, so only 2 out of 3 SCTs verfiy in my example.


java -cp target/ctlog-0.1.2-SNAPSHOT-with-deps.jar org.certificatetransparency.ctlog.utils.VerifySignature ../../../workspace/ctlog/chain.txt null ../../../workspace/ctlog/logkeys
No SCTs as input, assuming there are some in the cert
The leafcert does have some SCTs
Log ID: cEI0jMvInc6X4gSecjSm7Y2Vr1DybbHw3W8pTlCgoOc=, /home/user/Dev/git/primetomas/certificate-transparency-java/../../../workspace/ctlog/logkeys/digicert-golem.pub
Log ID: aPaY+B9kgr46jO65KB1M/HFRXWeT1ETRCmesu09P+8Q=, /home/user/Dev/git/primetomas/certificate-transparency-java/../../../workspace/ctlog/logkeys/google-aviator.pub
Log ID: pFASaQVaFVReYhGrN7wQP2KuVXakXksXFEU+GyIQaiU=, /home/user/Dev/git/primetomas/certificate-transparency-java/../../../workspace/ctlog/logkeys/google-aragon-2018.pub
Log ID: pLkJkLQYWBSHuxOizGdwCjw1mAT5G9+443fNDsgN3BA=, /home/user/Dev/git/primetomas/certificate-transparency-java/../../../workspace/ctlog/logkeys/google-pilot.pub
Log ID: Bti9XYhIavO/M9izWTDZWVaamP7bMgmezgi+cGjOXIE=, /home/user/Dev/git/primetomas/certificate-transparency-java/../../../workspace/ctlog/logkeys/cloudflare-2021.pub
Log ID: sMyD5aX5fWuvfAnMKEkEhyrH6IsTLGNQt8b9JuFsbHc=, /home/user/Dev/git/primetomas/certificate-transparency-java/../../../workspace/ctlog/logkeys/google-testtube-key.pub
Log ID: KTxRllTIOWW6qlD8WAfUt2+/WHopctykwwz05UVH9Hg=, /home/user/Dev/git/primetomas/certificate-transparency-java/../../../workspace/ctlog/logkeys/google-icarus.pub
Log ID: rj4DG898fzaxWWBvMIcPv7DEp5JVyMyuwaX5Q+0Pimg=, /home/user/Dev/git/primetomas/certificate-transparency-java/../../../workspace/ctlog/logkeys/cloudflare-2019.pub
Log ID: ETNwKnIZFsGr4jur52jIpPycaY9Gd/xjm+fJEVc6H8w=, /home/user/Dev/git/primetomas/certificate-transparency-java/../../../workspace/ctlog/logkeys/cloudflare-2018.pub
Log ID: C03mHulk1KhCs4C1Y0BlWzK/fFWJc7FMGNPiKMRP5R4=, /home/user/Dev/git/primetomas/certificate-transparency-java/../../../workspace/ctlog/logkeys/cloudflare-2020.pub
Log ID: u9nfvB+KcbWTlCOXqpJ7RzhXlQqrUugakJZkNo4e0YU=, /home/user/Dev/git/primetomas/certificate-transparency-java/../../../workspace/ctlog/logkeys/google-skydiver.pub
Log ID: 7ku9t3XOYLrhQmkfq+GeZqMPfl+wctiDAMR7iXqo/cs=, /home/user/Dev/git/primetomas/certificate-transparency-java/../../../workspace/ctlog/logkeys/google-rocketeer.pub
Log ID: 23b9raxl59CVCIhuIVm9i5A1L1/q0+PcXiLrNQrMe5g=, /home/user/Dev/git/primetomas/certificate-transparency-java/../../../workspace/ctlog/logkeys/comodo-dodo-key.pub
SCT to verify
with keyID: pLkJkLQYWBSHuxOizGdwCjw1mAT5G9+443fNDsgN3BA=
version
: V1
id
{
  key_id
: "\244\271\t\220\264\030X\024\207\273\023\242\314gp\n<5\230\004\371\033\337\270\343w\315\016\310\r\334\020"
}
timestamp
: 1525810359562
signature
{
  hash_algorithm
: SHA256
  sig_algorithm
: ECDSA
  signature
: "0E\002!\000\321f\235\374q5\254X}\206t\032^\376\343\323Z{.\376n\001\020-\276t\207/K)\031b\002 \b\376`\032\376\262\315\246\263\304\022\2667\001\235\232l\256\020SR\203j@E\263\t\225A`S\225"
}
extensions
: ""


Signature verified OK.
SCT to verify
with keyID: VhQGmi/XwuzT9eG9RLI+x0Z2ubyZEVzA75SYVdaJ0N0=
version
: V1
id
{
  key_id
: "V\024\006\232/\327\302\354\323\365\341\275D\262>\307Fv\271\274\231\021\\\300\357\224\230U\326\211\320\335"
}
timestamp
: 1525810359597
signature
{
  hash_algorithm
: SHA256
  sig_algorithm
: ECDSA
  signature
: "0E\002!\000\242\356\211\224\275\202\346\321\275\213\241\273Dy\020\030\236R(\356~\211\305\266\035\256\326\035\230\365\026%\002 V\f5\001\236u\274\257D6)\301\203m\205?\026\374\331;\315\f\3559O^\341\305tB\330\206"
}
extensions
: ""


No log with ID: VhQGmi/XwuzT9eG9RLI+x0Z2ubyZEVzA75SYVdaJ0N0= found among loaded log keys, skipping verification with FAILURE
SCT to verify
with keyID: u9nfvB+KcbWTlCOXqpJ7RzhXlQqrUugakJZkNo4e0YU=
version
: V1
id
{
  key_id
: "\273\331\337\274\037\212q\265\223\224#\227\252\222{G8W\225\n\253R\350\032\220\226d6\216\036\321\205"
}
timestamp
: 1525810359775
signature
{
  hash_algorithm
: SHA256
  sig_algorithm
: ECDSA
  signature
: "0E\002!\000\241\315\324\312QM\215\371w*p\255\016%\212\315\360F2\236Z\025\306\0328\310\371:\016\255\304>\002 t\321\371\273\312\302\335G,\225\005x\a\3324kL6\323\212&\r\021\006)5n\022\234Fx\344"
}
extensions
: ""


Signature verified OK.



To unsubscribe from this group and stop receiving emails from it, send an email to certificate-transparency+unsub...@googlegroups.com.
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos