mirror of https://github.com/cbeuw/Cloak
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
1.3 KiB
Go
21 lines
1.3 KiB
Go
package client
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/hex"
|
|
"testing"
|
|
)
|
|
|
|
func TestComposeExtensions(t *testing.T) {
|
|
target, _ := hex.DecodeString("000000170015000012636f6e73656e742e676f6f676c652e636f6d00170000ff01000100000a000e000c001d00170018001901000101000b000201000010000e000c02683208687474702f312e310005000501000000000033006b0069001d00208d8ea1b80430b7710b65f0d89b0144a5eeb218709ce6613d4fc8bfb117657c150017004104bcffff92fc5a5aa656a04342cef647cf59a365678743ec64409a1444360c58b552c92ee6d0aad8573d1b8ca91a160e28de18bf9b46f8950c50957f606e04a970002b0009080304030303020301000d0018001604030503060308040805080604010501060102030201001c0002400100150096000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
|
|
|
|
serverName := "consent.google.com"
|
|
keyShare, _ := hex.DecodeString("8d8ea1b80430b7710b65f0d89b0144a5eeb218709ce6613d4fc8bfb117657c15")
|
|
|
|
result := (&Firefox{}).composeExtensions(serverName, keyShare)
|
|
// skip random secp256r1
|
|
if !bytes.Equal(result[:133], target[:133]) || !bytes.Equal(result[198:], target[198:]) {
|
|
t.Errorf("got %x", result)
|
|
}
|
|
}
|