Subject: [Unbearable] Dumb formatting question

From: Bill Cox <[email-masked]>
Date: Tue, 3 Nov 2015 16:37:00 -0800

;Some more details about formatting of the TokenBindingMessage probably
should be added to the spec.  Here's what I'm assuming:

- Points are 65 bytes: 0x04 + 32-byte X + 32-byte Y
- Signatures are 72-ish bytes: ASN.1 encoded: 0x30(sequence) + u8-len +
 0x2(integer) + u8-len + opt-zero-byte + 32-byte r + 0x2(integer) + u8-len
+ opt-zero-byte + 32-byte s

Here, the opt-zero-byte is only there if the 32-byte integer starts with a
1.  Otherwise, it would be negative.  The length is thus 70 to 72 bytes.
Isn't ASN.1 encoding fun :-p

What about the RSA keys?  I think they are simpler, but I could be wrong.
Are they simply:

- u16-len + modulus + u8-len + exponent

I am assuming this, but I was wrong about the other formats.  Did I get
this right?  I don't even know how to represent an integer with > 256 bytes
of modulus (4096 bits) using ASN.1, and I've kind of wanted to barf every
time I looked closely at ASN.1, so I avoid it as much as possible.

What exactly is the RSA key format?

Thanks,
Bill

---

From: Bill Cox <[email-masked]>
Date: Tue, 3 Nov 2015 16:47:08 -0800

> time I looked closely at ASN.1, so I avoid it as much as possible.
I just made the mistake of looking into large ASN.1 INTEGER encoding.  The
length bytes are similar to UTF-8 encoding, having a hack for multi-byte
lengths.  All the joy and pain of UTF-8 without any of the gain...

<Bill turns green, runs for nearest toilet>

Bill

---

From: Andrei Popov <[email-masked]>
Date: Wed, 4 Nov 2015 01:43:08 +0000

Yes, I have these clarifications on my TODO list. The short answer is do the same as your TLS implementation.

Cheers,

Andrei

From: Unbearable [mailto:[email-masked]] On Behalf Of Bill Cox
Sent: Wednesday, November 4, 2015 9:37 AM
To: [email-masked]
Subject: [Unbearable] Dumb formatting question

;Some more details about formatting of the TokenBindingMessage probably should be added to the spec.  Here's what I'm assuming:

- Points are 65 bytes: 0x04 + 32-byte X + 32-byte Y
- Signatures are 72-ish bytes: ASN.1 encoded: 0x30(sequence) + u8-len +  0x2(integer) + u8-len + opt-zero-byte + 32-byte r + 0x2(integer) + u8-len + opt-zero-byte + 32-byte s

Here, the opt-zero-byte is only there if the 32-byte integer starts with a 1.  Otherwise, it would be negative.  The length is thus 70 to 72 bytes.  Isn't ASN.1 encoding fun :-p

What about the RSA keys?  I think they are simpler, but I could be wrong.  Are they simply:

I am assuming this, but I was wrong about the other formats.  Did I get this right?  I don't even know how to represent an integer with > 256 bytes of modulus (4096 bits) using ASN.1, and I've kind of wanted to barf every time I looked closely at ASN.1, so I avoid it as much as possible.

Thanks,
Bill