├── tls ├── testdata │ ├── Client-TLSv10-Ed25519 │ ├── Client-TLSv11-Ed25519 │ ├── example-key.pem │ ├── example-cert.pem │ ├── Server-TLSv11-FallbackSCSV │ ├── Server-TLSv12-ALPN-NoMatch │ ├── Server-TLSv13-RSA-RSAPSS-TooSmall │ ├── Server-TLSv13-ALPN-NoMatch │ ├── Server-TLSv12-Resume │ ├── Server-TLSv12-Ed25519 │ ├── Server-TLSv13-Resume │ ├── Client-TLSv12-Ed25519 │ ├── Client-TLSv13-Ed25519 │ ├── Server-TLSv10-RSA-RC4 │ ├── Server-TLSv11-RSA-RC4 │ ├── Server-TLSv10-RSA-3DES │ ├── Server-TLSv12-RSA-RC4 │ ├── Server-TLSv13-Ed25519 │ ├── Server-TLSv12-RSA-RSAPKCS1v15 │ ├── Server-TLSv12-RSA-RSAPSS │ ├── Server-TLSv10-RSA-AES │ ├── Server-TLSv12-RSA-3DES │ ├── Server-TLSv10-ECDHE-ECDSA-AES │ ├── Server-TLSv12-X25519 │ ├── Server-TLSv12-RSA-AES-GCM │ ├── Server-TLSv12-RSA-AES256-GCM-SHA384 │ ├── Client-TLSv12-ECDHE-ECDSA-CHACHA20-POLY1305 │ ├── Client-TLSv10-RSA-RC4 │ ├── Client-TLSv11-RSA-RC4 │ ├── Client-TLSv12-RSA-RC4 │ ├── Server-TLSv12-RSA-AES │ ├── Server-TLSv12-SNI │ └── Server-TLSv12-SNI-GetCertificate ├── cpu │ ├── export_test.go │ ├── cpu_mips.go │ ├── cpu_mipsle.go │ ├── cpu_riscv64.go │ ├── cpu_wasm.go │ ├── cpu.s │ ├── cpu_arm64_android.go │ ├── cpu_arm64_linux.go │ ├── cpu_arm64.s │ ├── cpu_arm64_other.go │ ├── cpu_ppc64x_aix.go │ ├── cpu_ppc64x.go │ ├── cpu_no_name.go │ ├── cpu_x86.s │ ├── cpu_mips64x.go │ ├── cpu_ppc64x_linux.go │ ├── cpu_arm64.go │ ├── cpu_x86_test.go │ ├── cpu_arm.go │ ├── cpu_arm64_freebsd.go │ ├── cpu_arm64_darwin.go │ ├── cpu_s390x_test.go │ ├── cpu_test.go │ ├── cpu_arm64_hwcap.go │ ├── cpu_s390x.s │ └── cpu_x86.go ├── handshake_unix_test.go ├── link_test.go ├── common_string.go ├── alert.go ├── generate_cert.go ├── ticket.go ├── prf_test.go └── key_schedule_test.go ├── go.mod ├── Readme.md ├── go.sum ├── LICENSE └── tests └── lint-lists.go /tls/testdata/Client-TLSv10-Ed25519: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tls/testdata/Client-TLSv11-Ed25519: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tls/cpu/export_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu 6 | 7 | var ( 8 | Options = options 9 | ) 10 | -------------------------------------------------------------------------------- /tls/testdata/example-key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PRIVATE KEY----- 2 | MHcCAQEEIIrYSSNQFaA2Hwf1duRSxKtLYX5CB04fSeQ6tF1aY/PuoAoGCCqGSM49 3 | AwEHoUQDQgAEPR3tU2Fta9ktY+6P9G0cWO+0kETA6SFs38GecTyudlHz6xvCdz8q 4 | EKTcWGekdmdDPsHloRNtsiCa697B2O9IFA== 5 | -----END EC PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /tls/cpu/cpu_mips.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu 6 | 7 | const CacheLinePadSize = 32 8 | 9 | func doinit() { 10 | } 11 | -------------------------------------------------------------------------------- /tls/cpu/cpu_mipsle.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu 6 | 7 | const CacheLinePadSize = 32 8 | 9 | func doinit() { 10 | } 11 | -------------------------------------------------------------------------------- /tls/cpu/cpu_riscv64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu 6 | 7 | const CacheLinePadSize = 32 8 | 9 | func doinit() { 10 | } 11 | -------------------------------------------------------------------------------- /tls/cpu/cpu_wasm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu 6 | 7 | const CacheLinePadSize = 64 8 | 9 | func doinit() { 10 | } 11 | -------------------------------------------------------------------------------- /tls/cpu/cpu.s: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This assembly file exists to allow internal/cpu to call 6 | // non-exported runtime functions that use "go:linkname". -------------------------------------------------------------------------------- /tls/cpu/cpu_arm64_android.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm64 6 | 7 | package cpu 8 | 9 | func osInit() { 10 | hwcapInit("android") 11 | } 12 | -------------------------------------------------------------------------------- /tls/cpu/cpu_arm64_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm64 && linux && !android 6 | 7 | package cpu 8 | 9 | func osInit() { 10 | hwcapInit("linux") 11 | } 12 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/hellais/utls-light 2 | 3 | go 1.18 4 | 5 | require ( 6 | github.com/andybalholm/brotli v1.0.4 7 | github.com/klauspost/compress v1.15.9 8 | golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 9 | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 10 | ) 11 | 12 | require ( 13 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect 14 | golang.org/x/text v0.3.6 // indirect 15 | ) 16 | -------------------------------------------------------------------------------- /tls/handshake_unix_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris 6 | 7 | package tls 8 | 9 | import ( 10 | "errors" 11 | "syscall" 12 | ) 13 | 14 | func init() { 15 | isConnRefused = func(err error) bool { 16 | return errors.Is(err, syscall.ECONNREFUSED) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tls/cpu/cpu_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | // func getisar0() uint64 8 | TEXT ·getisar0(SB),NOSPLIT,$0 9 | // get Instruction Set Attributes 0 into R0 10 | MRS ID_AA64ISAR0_EL1, R0 11 | MOVD R0, ret+0(FP) 12 | RET 13 | 14 | // func getMIDR() uint64 15 | TEXT ·getMIDR(SB), NOSPLIT, $0-8 16 | MRS MIDR_EL1, R0 17 | MOVD R0, ret+0(FP) 18 | RET 19 | -------------------------------------------------------------------------------- /tls/cpu/cpu_arm64_other.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm64 && !linux && !freebsd && !android && (!darwin || ios) 6 | 7 | package cpu 8 | 9 | func osInit() { 10 | // Other operating systems do not support reading HWCap from auxiliary vector, 11 | // reading privileged aarch64 system registers or sysctl in user space to detect 12 | // CPU features at runtime. 13 | } 14 | -------------------------------------------------------------------------------- /tls/cpu/cpu_ppc64x_aix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ppc64 || ppc64le 6 | 7 | package cpu 8 | 9 | const ( 10 | // getsystemcfg constants 11 | _SC_IMPL = 2 12 | _IMPL_POWER9 = 0x20000 13 | ) 14 | 15 | func osinit() { 16 | impl := getsystemcfg(_SC_IMPL) 17 | PPC64.IsPOWER9 = isSet(impl, _IMPL_POWER9) 18 | } 19 | 20 | // getsystemcfg is defined in runtime/os2_aix.go 21 | func getsystemcfg(label uint) uint 22 | -------------------------------------------------------------------------------- /tls/cpu/cpu_ppc64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ppc64 || ppc64le 6 | 7 | package cpu 8 | 9 | const CacheLinePadSize = 128 10 | 11 | func doinit() { 12 | options = []option{ 13 | {Name: "darn", Feature: &PPC64.HasDARN}, 14 | {Name: "scv", Feature: &PPC64.HasSCV}, 15 | {Name: "power9", Feature: &PPC64.IsPOWER9}, 16 | } 17 | 18 | osinit() 19 | } 20 | 21 | func isSet(hwc uint, value uint) bool { 22 | return hwc&value != 0 23 | } 24 | -------------------------------------------------------------------------------- /tls/testdata/example-cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIBhTCCASugAwIBAgIQIRi6zePL6mKjOipn+dNuaTAKBggqhkjOPQQDAjASMRAw 3 | DgYDVQQKEwdBY21lIENvMB4XDTE3MTAyMDE5NDMwNloXDTE4MTAyMDE5NDMwNlow 4 | EjEQMA4GA1UEChMHQWNtZSBDbzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABD0d 5 | 7VNhbWvZLWPuj/RtHFjvtJBEwOkhbN/BnnE8rnZR8+sbwnc/KhCk3FhnpHZnQz7B 6 | 5aETbbIgmuvewdjvSBSjYzBhMA4GA1UdDwEB/wQEAwICpDATBgNVHSUEDDAKBggr 7 | BgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MCkGA1UdEQQiMCCCDmxvY2FsaG9zdDo1 8 | NDUzgg4xMjcuMC4wLjE6NTQ1MzAKBggqhkjOPQQDAgNIADBFAiEA2zpJEPQyz6/l 9 | Wf86aX6PepsntZv2GYlA5UpabfT2EZICICpJ5h/iI+i341gBmLiAFQOyTDT+/wQc 10 | 6MF9+Yw1Yy0t 11 | -----END CERTIFICATE----- 12 | -------------------------------------------------------------------------------- /tls/cpu/cpu_no_name.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build !386 && !amd64 6 | 7 | package cpu 8 | 9 | // Name returns the CPU name given by the vendor 10 | // if it can be read directly from memory or by CPU instructions. 11 | // If the CPU name can not be determined an empty string is returned. 12 | // 13 | // Implementations that use the Operating System (e.g. sysctl or /sys/) 14 | // to gather CPU information for display should be placed in internal/sysinfo. 15 | func Name() string { 16 | // "A CPU has no name". 17 | return "" 18 | } 19 | -------------------------------------------------------------------------------- /tls/cpu/cpu_x86.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build 386 || amd64 6 | 7 | #include "textflag.h" 8 | 9 | // func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) 10 | TEXT ·cpuid(SB), NOSPLIT, $0-24 11 | MOVL eaxArg+0(FP), AX 12 | MOVL ecxArg+4(FP), CX 13 | CPUID 14 | MOVL AX, eax+8(FP) 15 | MOVL BX, ebx+12(FP) 16 | MOVL CX, ecx+16(FP) 17 | MOVL DX, edx+20(FP) 18 | RET 19 | 20 | // func xgetbv() (eax, edx uint32) 21 | TEXT ·xgetbv(SB),NOSPLIT,$0-8 22 | MOVL $0, CX 23 | XGETBV 24 | MOVL AX, eax+0(FP) 25 | MOVL DX, edx+4(FP) 26 | RET 27 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv11-FallbackSCSV: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 77 01 00 00 73 03 02 0a 6b c9 55 9d |....w...s...k.U.| 3 | 00000010 bf 4e 61 b2 0a c7 c6 96 9f eb 90 91 87 ca d3 d3 |.Na.............| 4 | 00000020 62 dc b6 b4 db ea 41 fe 43 3e a3 00 00 14 c0 0a |b.....A.C>......| 5 | 00000030 c0 14 00 39 c0 09 c0 13 00 33 00 35 00 2f 00 ff |...9.....3.5./..| 6 | 00000040 56 00 01 00 00 36 00 00 00 0e 00 0c 00 00 09 31 |V....6.........1| 7 | 00000050 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 8 | 00000060 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| 9 | 00000070 00 23 00 00 00 16 00 00 00 17 00 00 |.#..........| 10 | >>> Flow 2 (server to client) 11 | 00000000 15 03 02 00 02 02 56 |......V| 12 | -------------------------------------------------------------------------------- /tls/cpu/cpu_mips64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build mips64 || mips64le 6 | 7 | package cpu 8 | 9 | const CacheLinePadSize = 32 10 | 11 | // This is initialized by archauxv and should not be changed after it is 12 | // initialized. 13 | var HWCap uint 14 | 15 | // HWCAP bits. These are exposed by the Linux kernel 5.4. 16 | const ( 17 | // CPU features 18 | hwcap_MIPS_MSA = 1 << 1 19 | ) 20 | 21 | func doinit() { 22 | options = []option{ 23 | {Name: "msa", Feature: &MIPS64X.HasMSA}, 24 | } 25 | 26 | // HWCAP feature bits 27 | MIPS64X.HasMSA = isSet(HWCap, hwcap_MIPS_MSA) 28 | } 29 | 30 | func isSet(hwc uint, value uint) bool { 31 | return hwc&value != 0 32 | } 33 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # UTLS Light 2 | 3 | This is a light version of 4 | [refraction-networking/utls](https://github.com/refraction-networking/utls) 5 | with a focus on parrotting a single browser and hence implementing only the 6 | strict minimal set of features needed for that. 7 | 8 | Design goals: 9 | * Parroting the most popular browser out there (Google Chrome) 10 | * Smallest number of changes to the go/tls codepath 11 | * It should be possible to easily inspect the diff with upstream (see the [diff for the last update](https://github.com/ooni/utls-light/compare/2b6c2ef3b403d1a30ddb395df58171ddd004a344...4dfb1fc05321b947dbee87f475f4159c40beb22d)) 12 | 13 | Non-goals: 14 | * Pluggable support for multiple TLS fingerprints 15 | 16 | Thanks to @FiloSottile for the insight and suggestion to take the approach of 17 | parsing the raw ClientHello bytes and re-serialising them. 18 | -------------------------------------------------------------------------------- /tls/cpu/cpu_ppc64x_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ppc64 || ppc64le 6 | 7 | package cpu 8 | 9 | // ppc64 doesn't have a 'cpuid' equivalent, so we rely on HWCAP/HWCAP2. 10 | // These are initialized by archauxv and should not be changed after they are 11 | // initialized. 12 | var HWCap uint 13 | var HWCap2 uint 14 | 15 | // HWCAP bits. These are exposed by Linux. 16 | const ( 17 | // ISA Level 18 | hwcap2_ARCH_3_00 = 0x00800000 19 | 20 | // CPU features 21 | hwcap2_DARN = 0x00200000 22 | hwcap2_SCV = 0x00100000 23 | ) 24 | 25 | func osinit() { 26 | PPC64.IsPOWER9 = isSet(HWCap2, hwcap2_ARCH_3_00) 27 | PPC64.HasDARN = isSet(HWCap2, hwcap2_DARN) 28 | PPC64.HasSCV = isSet(HWCap2, hwcap2_SCV) 29 | } 30 | -------------------------------------------------------------------------------- /tls/cpu/cpu_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu 6 | 7 | const CacheLinePadSize = 64 8 | 9 | func doinit() { 10 | options = []option{ 11 | {Name: "aes", Feature: &ARM64.HasAES}, 12 | {Name: "pmull", Feature: &ARM64.HasPMULL}, 13 | {Name: "sha1", Feature: &ARM64.HasSHA1}, 14 | {Name: "sha2", Feature: &ARM64.HasSHA2}, 15 | {Name: "crc32", Feature: &ARM64.HasCRC32}, 16 | {Name: "atomics", Feature: &ARM64.HasATOMICS}, 17 | {Name: "cpuid", Feature: &ARM64.HasCPUID}, 18 | {Name: "isNeoverseN1", Feature: &ARM64.IsNeoverseN1}, 19 | {Name: "isZeus", Feature: &ARM64.IsZeus}, 20 | } 21 | 22 | // arm64 uses different ways to detect CPU features at runtime depending on the operating system. 23 | osInit() 24 | } 25 | 26 | func getisar0() uint64 27 | 28 | func getMIDR() uint64 29 | -------------------------------------------------------------------------------- /tls/cpu/cpu_x86_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build 386 || amd64 6 | 7 | package cpu_test 8 | 9 | import ( 10 | . "internal/cpu" 11 | "internal/godebug" 12 | "testing" 13 | ) 14 | 15 | func TestX86ifAVX2hasAVX(t *testing.T) { 16 | if X86.HasAVX2 && !X86.HasAVX { 17 | t.Fatalf("HasAVX expected true when HasAVX2 is true, got false") 18 | } 19 | } 20 | 21 | func TestDisableSSE3(t *testing.T) { 22 | runDebugOptionsTest(t, "TestSSE3DebugOption", "cpu.sse3=off") 23 | } 24 | 25 | func TestSSE3DebugOption(t *testing.T) { 26 | MustHaveDebugOptionsSupport(t) 27 | 28 | if godebug.Get("cpu.sse3") != "off" { 29 | t.Skipf("skipping test: GODEBUG=cpu.sse3=off not set") 30 | } 31 | 32 | want := false 33 | if got := X86.HasSSE3; got != want { 34 | t.Errorf("X86.HasSSE3 expected %v, got %v", want, got) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tls/cpu/cpu_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu 6 | 7 | const CacheLinePadSize = 32 8 | 9 | // arm doesn't have a 'cpuid' equivalent, so we rely on HWCAP/HWCAP2. 10 | // These are initialized by archauxv() and should not be changed after they are 11 | // initialized. 12 | var HWCap uint 13 | var HWCap2 uint 14 | 15 | // HWCAP/HWCAP2 bits. These are exposed by Linux and FreeBSD. 16 | const ( 17 | hwcap_VFPv4 = 1 << 16 18 | hwcap_IDIVA = 1 << 17 19 | ) 20 | 21 | func doinit() { 22 | options = []option{ 23 | {Name: "vfpv4", Feature: &ARM.HasVFPv4}, 24 | {Name: "idiva", Feature: &ARM.HasIDIVA}, 25 | } 26 | 27 | // HWCAP feature bits 28 | ARM.HasVFPv4 = isSet(HWCap, hwcap_VFPv4) 29 | ARM.HasIDIVA = isSet(HWCap, hwcap_IDIVA) 30 | } 31 | 32 | func isSet(hwc uint, value uint) bool { 33 | return hwc&value != 0 34 | } 35 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv12-ALPN-NoMatch: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 9d 01 00 00 99 03 03 24 15 a8 f2 f5 |...........$....| 3 | 00000010 53 02 78 f0 4c f7 82 3c 68 7d a0 b1 9a 0f 29 32 |S.x.L..>> Flow 2 (server to client) 14 | 00000000 15 03 03 00 02 02 78 |......x| 15 | -------------------------------------------------------------------------------- /tls/cpu/cpu_arm64_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm64 6 | 7 | package cpu 8 | 9 | func osInit() { 10 | // Retrieve info from system register ID_AA64ISAR0_EL1. 11 | isar0 := getisar0() 12 | 13 | // ID_AA64ISAR0_EL1 14 | switch extractBits(isar0, 4, 7) { 15 | case 1: 16 | ARM64.HasAES = true 17 | case 2: 18 | ARM64.HasAES = true 19 | ARM64.HasPMULL = true 20 | } 21 | 22 | switch extractBits(isar0, 8, 11) { 23 | case 1: 24 | ARM64.HasSHA1 = true 25 | } 26 | 27 | switch extractBits(isar0, 12, 15) { 28 | case 1, 2: 29 | ARM64.HasSHA2 = true 30 | } 31 | 32 | switch extractBits(isar0, 16, 19) { 33 | case 1: 34 | ARM64.HasCRC32 = true 35 | } 36 | 37 | switch extractBits(isar0, 20, 23) { 38 | case 2: 39 | ARM64.HasATOMICS = true 40 | } 41 | } 42 | 43 | func extractBits(data uint64, start, end uint) uint { 44 | return (uint)(data>>start) & ((1 << (end - start + 1)) - 1) 45 | } 46 | -------------------------------------------------------------------------------- /tls/cpu/cpu_arm64_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm64 && darwin && !ios 6 | 7 | package cpu 8 | 9 | func osInit() { 10 | ARM64.HasATOMICS = sysctlEnabled([]byte("hw.optional.armv8_1_atomics\x00")) 11 | ARM64.HasCRC32 = sysctlEnabled([]byte("hw.optional.armv8_crc32\x00")) 12 | 13 | // There are no hw.optional sysctl values for the below features on Mac OS 11.0 14 | // to detect their supported state dynamically. Assume the CPU features that 15 | // Apple Silicon M1 supports to be available as a minimal set of features 16 | // to all Go programs running on darwin/arm64. 17 | ARM64.HasAES = true 18 | ARM64.HasPMULL = true 19 | ARM64.HasSHA1 = true 20 | ARM64.HasSHA2 = true 21 | } 22 | 23 | //go:noescape 24 | func getsysctlbyname(name []byte) (int32, int32) 25 | 26 | func sysctlEnabled(name []byte) bool { 27 | ret, value := getsysctlbyname(name) 28 | if ret < 0 { 29 | return false 30 | } 31 | return value > 0 32 | } 33 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv13-RSA-RSAPSS-TooSmall: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 b0 01 00 00 ac 03 03 15 df ef fb ff |................| 3 | 00000010 00 89 4d bf 59 d2 30 f1 f3 e7 20 24 c6 06 ba a4 |..M.Y.0... $....| 4 | 00000020 28 b4 ba 3d 00 f2 18 9b 98 a3 f2 20 7e d9 d0 58 |(..=....... ~..X| 5 | 00000030 50 25 90 2d f0 af 72 66 fb f8 54 33 6e d4 2b f0 |P%.-..rf..T3n.+.| 6 | 00000040 0f 1a ea dc 9e 08 34 ed 68 a8 d8 bd 00 04 13 03 |......4.h.......| 7 | 00000050 00 ff 01 00 00 5f 00 0b 00 04 03 00 01 02 00 0a |....._..........| 8 | 00000060 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| 9 | 00000070 00 00 00 17 00 00 00 0d 00 04 00 02 08 06 00 2b |...............+| 10 | 00000080 00 03 02 03 04 00 2d 00 02 01 01 00 33 00 26 00 |......-.....3.&.| 11 | 00000090 24 00 1d 00 20 6e 42 98 d4 04 32 d1 21 0f 64 c9 |$... nB...2.!.d.| 12 | 000000a0 b7 f2 b2 52 6f 2b b7 b1 95 4b 57 85 7b 69 d9 63 |...Ro+...KW.{i.c| 13 | 000000b0 19 48 d2 1c 1e |.H...| 14 | >>> Flow 2 (server to client) 15 | 00000000 15 03 03 00 02 02 28 |......(| 16 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= 2 | github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= 3 | github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= 4 | github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= 5 | golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM= 6 | golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 7 | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= 8 | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 9 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= 10 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 11 | golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= 12 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 13 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /tls/cpu/cpu_s390x_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu_test 6 | 7 | import ( 8 | "errors" 9 | . "internal/cpu" 10 | "os" 11 | "regexp" 12 | "testing" 13 | ) 14 | 15 | func getFeatureList() ([]string, error) { 16 | cpuinfo, err := os.ReadFile("/proc/cpuinfo") 17 | if err != nil { 18 | return nil, err 19 | } 20 | r := regexp.MustCompile("features\\s*:\\s*(.*)") 21 | b := r.FindSubmatch(cpuinfo) 22 | if len(b) < 2 { 23 | return nil, errors.New("no feature list in /proc/cpuinfo") 24 | } 25 | return regexp.MustCompile("\\s+").Split(string(b[1]), -1), nil 26 | } 27 | 28 | func TestS390XAgainstCPUInfo(t *testing.T) { 29 | // mapping of linux feature strings to S390X fields 30 | mapping := make(map[string]*bool) 31 | for _, option := range Options { 32 | mapping[option.Name] = option.Feature 33 | } 34 | 35 | // these must be true on the machines Go supports 36 | mandatory := make(map[string]bool) 37 | mandatory["zarch"] = false 38 | mandatory["eimm"] = false 39 | mandatory["ldisp"] = false 40 | mandatory["stfle"] = false 41 | 42 | features, err := getFeatureList() 43 | if err != nil { 44 | t.Error(err) 45 | } 46 | for _, feature := range features { 47 | if _, ok := mandatory[feature]; ok { 48 | mandatory[feature] = true 49 | } 50 | if flag, ok := mapping[feature]; ok { 51 | if !*flag { 52 | t.Errorf("feature '%v' not detected", feature) 53 | } 54 | } else { 55 | t.Logf("no entry for '%v'", feature) 56 | } 57 | } 58 | for k, v := range mandatory { 59 | if !v { 60 | t.Errorf("mandatory feature '%v' not detected", k) 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /tls/cpu/cpu_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package cpu_test 6 | 7 | import ( 8 | . "internal/cpu" 9 | "internal/godebug" 10 | "internal/testenv" 11 | "os" 12 | "os/exec" 13 | "strings" 14 | "testing" 15 | ) 16 | 17 | func MustHaveDebugOptionsSupport(t *testing.T) { 18 | if !DebugOptions { 19 | t.Skipf("skipping test: cpu feature options not supported by OS") 20 | } 21 | } 22 | 23 | func MustSupportFeatureDectection(t *testing.T) { 24 | // TODO: add platforms that do not have CPU feature detection support. 25 | } 26 | 27 | func runDebugOptionsTest(t *testing.T, test string, options string) { 28 | MustHaveDebugOptionsSupport(t) 29 | 30 | testenv.MustHaveExec(t) 31 | 32 | env := "GODEBUG=" + options 33 | 34 | cmd := exec.Command(os.Args[0], "-test.run="+test) 35 | cmd.Env = append(cmd.Env, env) 36 | 37 | output, err := cmd.CombinedOutput() 38 | lines := strings.Fields(string(output)) 39 | lastline := lines[len(lines)-1] 40 | 41 | got := strings.TrimSpace(lastline) 42 | want := "PASS" 43 | if err != nil || got != want { 44 | t.Fatalf("%s with %s: want %s, got %v", test, env, want, got) 45 | } 46 | } 47 | 48 | func TestDisableAllCapabilities(t *testing.T) { 49 | MustSupportFeatureDectection(t) 50 | runDebugOptionsTest(t, "TestAllCapabilitiesDisabled", "cpu.all=off") 51 | } 52 | 53 | func TestAllCapabilitiesDisabled(t *testing.T) { 54 | MustHaveDebugOptionsSupport(t) 55 | 56 | if godebug.Get("cpu.all") != "off" { 57 | t.Skipf("skipping test: GODEBUG=cpu.all=off not set") 58 | } 59 | 60 | for _, o := range Options { 61 | want := false 62 | if got := *o.Feature; got != want { 63 | t.Errorf("%v: expected %v, got %v", o.Name, want, got) 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv13-ALPN-NoMatch: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 e2 01 00 00 de 03 03 9f 73 81 5f 56 |............s._V| 3 | 00000010 a9 02 5f 8c 33 db dc 2a 92 d0 5e 7c e9 e6 01 d7 |.._.3..*..^|....| 4 | 00000020 67 b6 bb 74 da bb d0 c1 11 08 20 20 9f bd d6 f8 |g..t...... ....| 5 | 00000030 d7 8c e5 32 15 1d 4a 4c 36 ce 72 90 cb 68 ca dc |...2..JL6.r..h..| 6 | 00000040 ea b3 57 93 9a 12 e6 0e 9a bd 91 1a 00 04 13 03 |..W.............| 7 | 00000050 00 ff 01 00 00 91 00 0b 00 04 03 00 01 02 00 0a |................| 8 | 00000060 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 23 |...............#| 9 | 00000070 00 00 00 10 00 10 00 0e 06 70 72 6f 74 6f 32 06 |.........proto2.| 10 | 00000080 70 72 6f 74 6f 31 00 16 00 00 00 17 00 00 00 0d |proto1..........| 11 | 00000090 00 1e 00 1c 04 03 05 03 06 03 08 07 08 08 08 09 |................| 12 | 000000a0 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 |................| 13 | 000000b0 00 2b 00 03 02 03 04 00 2d 00 02 01 01 00 33 00 |.+......-.....3.| 14 | 000000c0 26 00 24 00 1d 00 20 79 79 04 d3 03 58 93 22 5d |&.$... yy...X."]| 15 | 000000d0 06 69 1a 03 11 4e 65 e5 30 85 29 02 22 c8 11 6d |.i...Ne.0.)."..m| 16 | 000000e0 21 86 d4 4d 58 93 74 |!..MX.t| 17 | >>> Flow 2 (server to client) 18 | 00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| 19 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 20 | 00000020 00 00 00 00 00 00 00 00 00 00 00 20 9f bd d6 f8 |........... ....| 21 | 00000030 d7 8c e5 32 15 1d 4a 4c 36 ce 72 90 cb 68 ca dc |...2..JL6.r..h..| 22 | 00000040 ea b3 57 93 9a 12 e6 0e 9a bd 91 1a 13 03 00 00 |..W.............| 23 | 00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| 24 | 00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| 25 | 00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| 26 | 00000080 03 03 00 01 01 17 03 03 00 13 7c ab 7f dd 94 cf |..........|.....| 27 | 00000090 d7 98 34 16 75 02 63 37 fa 4f 19 4e 18 |..4.u.c7.O.N.| 28 | -------------------------------------------------------------------------------- /tls/cpu/cpu_arm64_hwcap.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build arm64 && linux 6 | 7 | package cpu 8 | 9 | // HWCap may be initialized by archauxv and 10 | // should not be changed after it was initialized. 11 | var HWCap uint 12 | 13 | // HWCAP bits. These are exposed by Linux. 14 | const ( 15 | hwcap_AES = 1 << 3 16 | hwcap_PMULL = 1 << 4 17 | hwcap_SHA1 = 1 << 5 18 | hwcap_SHA2 = 1 << 6 19 | hwcap_CRC32 = 1 << 7 20 | hwcap_ATOMICS = 1 << 8 21 | hwcap_CPUID = 1 << 11 22 | ) 23 | 24 | func hwcapInit(os string) { 25 | // HWCap was populated by the runtime from the auxiliary vector. 26 | // Use HWCap information since reading aarch64 system registers 27 | // is not supported in user space on older linux kernels. 28 | ARM64.HasAES = isSet(HWCap, hwcap_AES) 29 | ARM64.HasPMULL = isSet(HWCap, hwcap_PMULL) 30 | ARM64.HasSHA1 = isSet(HWCap, hwcap_SHA1) 31 | ARM64.HasSHA2 = isSet(HWCap, hwcap_SHA2) 32 | ARM64.HasCRC32 = isSet(HWCap, hwcap_CRC32) 33 | ARM64.HasCPUID = isSet(HWCap, hwcap_CPUID) 34 | 35 | // The Samsung S9+ kernel reports support for atomics, but not all cores 36 | // actually support them, resulting in SIGILL. See issue #28431. 37 | // TODO(elias.naur): Only disable the optimization on bad chipsets on android. 38 | ARM64.HasATOMICS = isSet(HWCap, hwcap_ATOMICS) && os != "android" 39 | 40 | // Check to see if executing on a NeoverseN1 and in order to do that, 41 | // check the AUXV for the CPUID bit. The getMIDR function executes an 42 | // instruction which would normally be an illegal instruction, but it's 43 | // trapped by the kernel, the value sanitized and then returned. Without 44 | // the CPUID bit the kernel will not trap the instruction and the process 45 | // will be terminated with SIGILL. 46 | if ARM64.HasCPUID { 47 | midr := getMIDR() 48 | part_num := uint16((midr >> 4) & 0xfff) 49 | implementor := byte((midr >> 24) & 0xff) 50 | 51 | if implementor == 'A' && part_num == 0xd0c { 52 | ARM64.IsNeoverseN1 = true 53 | } 54 | if implementor == 'A' && part_num == 0xd40 { 55 | ARM64.IsZeus = true 56 | } 57 | } 58 | } 59 | 60 | func isSet(hwc uint, value uint) bool { 61 | return hwc&value != 0 62 | } 63 | -------------------------------------------------------------------------------- /tls/cpu/cpu_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | // func stfle() facilityList 8 | TEXT ·stfle(SB), NOSPLIT|NOFRAME, $0-32 9 | MOVD $ret+0(FP), R1 10 | MOVD $3, R0 // last doubleword index to store 11 | XC $32, (R1), (R1) // clear 4 doublewords (32 bytes) 12 | WORD $0xb2b01000 // store facility list extended (STFLE) 13 | RET 14 | 15 | // func kmQuery() queryResult 16 | TEXT ·kmQuery(SB), NOSPLIT|NOFRAME, $0-16 17 | MOVD $0, R0 // set function code to 0 (KM-Query) 18 | MOVD $ret+0(FP), R1 // address of 16-byte return value 19 | WORD $0xB92E0024 // cipher message (KM) 20 | RET 21 | 22 | // func kmcQuery() queryResult 23 | TEXT ·kmcQuery(SB), NOSPLIT|NOFRAME, $0-16 24 | MOVD $0, R0 // set function code to 0 (KMC-Query) 25 | MOVD $ret+0(FP), R1 // address of 16-byte return value 26 | WORD $0xB92F0024 // cipher message with chaining (KMC) 27 | RET 28 | 29 | // func kmctrQuery() queryResult 30 | TEXT ·kmctrQuery(SB), NOSPLIT|NOFRAME, $0-16 31 | MOVD $0, R0 // set function code to 0 (KMCTR-Query) 32 | MOVD $ret+0(FP), R1 // address of 16-byte return value 33 | WORD $0xB92D4024 // cipher message with counter (KMCTR) 34 | RET 35 | 36 | // func kmaQuery() queryResult 37 | TEXT ·kmaQuery(SB), NOSPLIT|NOFRAME, $0-16 38 | MOVD $0, R0 // set function code to 0 (KMA-Query) 39 | MOVD $ret+0(FP), R1 // address of 16-byte return value 40 | WORD $0xb9296024 // cipher message with authentication (KMA) 41 | RET 42 | 43 | // func kimdQuery() queryResult 44 | TEXT ·kimdQuery(SB), NOSPLIT|NOFRAME, $0-16 45 | MOVD $0, R0 // set function code to 0 (KIMD-Query) 46 | MOVD $ret+0(FP), R1 // address of 16-byte return value 47 | WORD $0xB93E0024 // compute intermediate message digest (KIMD) 48 | RET 49 | 50 | // func klmdQuery() queryResult 51 | TEXT ·klmdQuery(SB), NOSPLIT|NOFRAME, $0-16 52 | MOVD $0, R0 // set function code to 0 (KLMD-Query) 53 | MOVD $ret+0(FP), R1 // address of 16-byte return value 54 | WORD $0xB93F0024 // compute last message digest (KLMD) 55 | RET 56 | 57 | // func kdsaQuery() queryResult 58 | TEXT ·kdsaQuery(SB), NOSPLIT|NOFRAME, $0-16 59 | MOVD $0, R0 // set function code to 0 (KLMD-Query) 60 | MOVD $ret+0(FP), R1 // address of 16-byte return value 61 | WORD $0xB93A0008 // compute digital signature authentication 62 | RET 63 | 64 | -------------------------------------------------------------------------------- /tls/link_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package tls 6 | 7 | import ( 8 | "bytes" 9 | "internal/testenv" 10 | "os" 11 | "os/exec" 12 | "path/filepath" 13 | "testing" 14 | ) 15 | 16 | // Tests that the linker is able to remove references to the Client or Server if unused. 17 | func TestLinkerGC(t *testing.T) { 18 | if testing.Short() { 19 | t.Skip("skipping in short mode") 20 | } 21 | t.Parallel() 22 | goBin := testenv.GoToolPath(t) 23 | testenv.MustHaveGoBuild(t) 24 | 25 | tests := []struct { 26 | name string 27 | program string 28 | want []string 29 | bad []string 30 | }{ 31 | { 32 | name: "empty_import", 33 | program: `package main 34 | import _ "crypto/tls" 35 | func main() {} 36 | `, 37 | bad: []string{ 38 | "tls.(*Conn)", 39 | "type.crypto/tls.clientHandshakeState", 40 | "type.crypto/tls.serverHandshakeState", 41 | }, 42 | }, 43 | { 44 | name: "client_and_server", 45 | program: `package main 46 | import "crypto/tls" 47 | func main() { 48 | tls.Dial("", "", nil) 49 | tls.Server(nil, nil) 50 | } 51 | `, 52 | want: []string{ 53 | "crypto/tls.(*Conn).clientHandshake", 54 | "crypto/tls.(*Conn).serverHandshake", 55 | }, 56 | }, 57 | { 58 | name: "only_client", 59 | program: `package main 60 | import "crypto/tls" 61 | func main() { tls.Dial("", "", nil) } 62 | `, 63 | want: []string{ 64 | "crypto/tls.(*Conn).clientHandshake", 65 | }, 66 | bad: []string{ 67 | "crypto/tls.(*Conn).serverHandshake", 68 | }, 69 | }, 70 | // TODO: add only_server like func main() { tls.Server(nil, nil) } 71 | // That currently brings in the client via Conn.handleRenegotiation. 72 | 73 | } 74 | tmpDir := t.TempDir() 75 | goFile := filepath.Join(tmpDir, "x.go") 76 | exeFile := filepath.Join(tmpDir, "x.exe") 77 | for _, tt := range tests { 78 | t.Run(tt.name, func(t *testing.T) { 79 | if err := os.WriteFile(goFile, []byte(tt.program), 0644); err != nil { 80 | t.Fatal(err) 81 | } 82 | os.Remove(exeFile) 83 | cmd := exec.Command(goBin, "build", "-o", "x.exe", "x.go") 84 | cmd.Dir = tmpDir 85 | if out, err := cmd.CombinedOutput(); err != nil { 86 | t.Fatalf("compile: %v, %s", err, out) 87 | } 88 | 89 | cmd = exec.Command(goBin, "tool", "nm", "x.exe") 90 | cmd.Dir = tmpDir 91 | nm, err := cmd.CombinedOutput() 92 | if err != nil { 93 | t.Fatalf("nm: %v, %s", err, nm) 94 | } 95 | for _, sym := range tt.want { 96 | if !bytes.Contains(nm, []byte(sym)) { 97 | t.Errorf("expected symbol %q not found", sym) 98 | } 99 | } 100 | for _, sym := range tt.bad { 101 | if bytes.Contains(nm, []byte(sym)) { 102 | t.Errorf("unexpected symbol %q found", sym) 103 | } 104 | } 105 | }) 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /tests/lint-lists.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "errors" 6 | "fmt" 7 | "log" 8 | "math/rand" 9 | "net" 10 | "net/http" 11 | "net/url" 12 | "os" 13 | "time" 14 | 15 | "golang.org/x/net/http2" 16 | 17 | tls "github.com/hellais/utls-light/tls" 18 | ) 19 | 20 | func getRequest(conn net.Conn, requestHostname string, alpn string) (*http.Response, error) { 21 | req := &http.Request{ 22 | Method: "GET", 23 | URL: &url.URL{Host: requestHostname, Scheme: "https"}, 24 | Header: make(http.Header), 25 | Host: requestHostname, 26 | } 27 | 28 | switch alpn { 29 | case "h2": 30 | req.Proto = "HTTP/2.0" 31 | req.ProtoMajor = 2 32 | req.ProtoMinor = 0 33 | 34 | tr := http2.Transport{} 35 | cConn, err := tr.NewClientConn(conn) 36 | if err != nil { 37 | return nil, err 38 | } 39 | return cConn.RoundTrip(req) 40 | case "http/1.1", "": 41 | req.Proto = "HTTP/1.1" 42 | req.ProtoMajor = 1 43 | req.ProtoMinor = 1 44 | 45 | err := req.Write(conn) 46 | if err != nil { 47 | return nil, err 48 | } 49 | return http.ReadResponse(bufio.NewReader(conn), req) 50 | default: 51 | return nil, fmt.Errorf("unsupported ALPN: %v", alpn) 52 | } 53 | } 54 | 55 | func logStatus(status string, serverName string, addr string) { 56 | f, err := os.OpenFile("domain-status.txt", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600) 57 | if err != nil { 58 | panic(err) 59 | } 60 | defer f.Close() 61 | logline := fmt.Sprintf("%s,%s,%s\n", status, serverName, addr) 62 | fmt.Print(logline) 63 | if _, err = f.WriteString(logline); err != nil { 64 | panic(err) 65 | } 66 | } 67 | 68 | func testURL(serverName string) error { 69 | ips, err := net.LookupIP(serverName) 70 | if len(ips) == 0 || err != nil { 71 | logStatus("FAIL-DNS", serverName, "") 72 | return errors.New("failed to lookup IP") 73 | } 74 | addr := fmt.Sprintf("%s:443", ips[0].String()) 75 | config := tls.Config{ServerName: serverName, NextProtos: []string{"h2", "http/1.1"}} 76 | dialConn, err := net.DialTimeout("tcp", addr, time.Duration(2)*time.Second) 77 | if err != nil { 78 | logStatus("FAIL-CONNECT", serverName, addr) 79 | return err 80 | } 81 | tlsConn := tls.Client(dialConn, &config) 82 | tlsConn.Handshake() 83 | defer tlsConn.Close() 84 | _, err = getRequest(tlsConn, serverName, tlsConn.ConnectionState().NegotiatedProtocol) 85 | if err != nil { 86 | logStatus("FAIL-GET", serverName, addr) 87 | return err 88 | } 89 | logStatus("OK", serverName, addr) 90 | return nil 91 | } 92 | 93 | func main() { 94 | file, err := os.Open("tests/citizenlab-domains.txt") 95 | if err != nil { 96 | log.Fatal("Cannot open file") 97 | } 98 | defer file.Close() 99 | 100 | testDomains := []string{} 101 | scanner := bufio.NewScanner(file) 102 | for scanner.Scan() { 103 | domain := scanner.Text() 104 | testDomains = append(testDomains, domain) 105 | } 106 | 107 | rand.Seed(time.Now().UnixNano()) 108 | rand.Shuffle(len(testDomains), func(i, j int) { testDomains[i], testDomains[j] = testDomains[j], testDomains[i] }) 109 | 110 | for idx := range testDomains { 111 | domain := testDomains[idx] 112 | err := testURL(domain) 113 | if err != nil { 114 | log.Printf("Failed to check %s %v", domain, err) 115 | } 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv12-Resume: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 01 12 01 00 01 0e 03 03 90 27 78 df 71 |............'x.q| 3 | 00000010 d3 0e ce 1d de ec d2 1b 70 e0 89 da 98 a9 45 3e |........p.....E>| 4 | 00000020 9c ee 93 90 8f 61 d0 a3 b4 a4 5a 20 9d cd d4 81 |.....a....Z ....| 5 | 00000030 e2 c0 59 81 21 bc 9f 2a 84 3e 91 15 3e b9 c0 a1 |..Y.!..*.>..>...| 6 | 00000040 e0 6b 73 9c 45 53 03 ad b9 e6 c2 77 00 04 00 2f |.ks.ES.....w.../| 7 | 00000050 00 ff 01 00 00 c1 00 23 00 81 50 46 ad c1 db a8 |.......#..PF....| 8 | 00000060 38 86 7b 2b bb fd d0 c3 42 3e 00 00 00 00 00 00 |8.{+....B>......| 9 | 00000070 00 00 00 00 00 00 00 00 00 00 94 6f 2c 9f 83 51 |...........o,..Q| 10 | 00000080 ed 14 ef 68 ca 42 c5 4c 75 5e a5 6f d2 49 61 e4 |...h.B.Lu^.o.Ia.| 11 | 00000090 fb 83 46 7c 4c ab f9 c6 d1 3c 9e 5b 8d d8 bc c0 |..F|L....<.[....| 12 | 000000a0 a5 2d 84 db 24 dd a0 16 60 1d 87 a0 52 88 25 6c |.-..$...`...R.%l| 13 | 000000b0 c6 8e 5b 71 0f 74 c3 48 49 38 16 92 8c de 77 bd |..[q.t.HI8....w.| 14 | 000000c0 8a 2b 45 4d 58 86 40 b1 d6 0f 99 de 27 41 b2 41 |.+EMX.@.....'A.A| 15 | 000000d0 27 aa fe 26 e9 24 91 2a 00 ff 08 00 16 00 00 00 |'..&.$.*........| 16 | 000000e0 17 00 00 00 0d 00 30 00 2e 04 03 05 03 06 03 08 |......0.........| 17 | 000000f0 07 08 08 08 09 08 0a 08 0b 08 04 08 05 08 06 04 |................| 18 | 00000100 01 05 01 06 01 03 03 02 03 03 01 02 01 03 02 02 |................| 19 | 00000110 02 04 02 05 02 06 02 |.......| 20 | >>> Flow 2 (server to client) 21 | 00000000 16 03 03 00 51 02 00 00 4d 03 03 00 00 00 00 00 |....Q...M.......| 22 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 23 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 20 9d cd d4 81 |...DOWNGRD. ....| 24 | 00000030 e2 c0 59 81 21 bc 9f 2a 84 3e 91 15 3e b9 c0 a1 |..Y.!..*.>..>...| 25 | 00000040 e0 6b 73 9c 45 53 03 ad b9 e6 c2 77 00 2f 00 00 |.ks.ES.....w./..| 26 | 00000050 05 ff 01 00 01 00 14 03 03 00 01 01 16 03 03 00 |................| 27 | 00000060 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |@...............| 28 | 00000070 00 57 8e 5f 0a f6 3f 3b 43 f1 33 bc ef 5e c6 8d |.W._..?;C.3..^..| 29 | 00000080 86 92 58 58 71 51 e8 54 57 96 5f bd 36 3a 9f d3 |..XXqQ.TW._.6:..| 30 | 00000090 e9 27 01 bf fb 6a 05 57 de 2d db b2 79 38 72 95 |.'...j.W.-..y8r.| 31 | 000000a0 fd |.| 32 | >>> Flow 3 (client to server) 33 | 00000000 14 03 03 00 01 01 16 03 03 00 40 6d 3c 76 31 a4 |..........@m.5v...K.| 35 | 00000020 01 f8 a8 83 0c eb 58 f7 d6 93 c6 b6 40 0e c8 24 |......X.....@..$| 36 | 00000030 46 58 0c 79 4a c6 b4 15 65 1e 9c bd ff 51 4d d0 |FX.yJ...e....QM.| 37 | 00000040 44 66 fe c0 98 d5 26 11 98 cf 52 |Df....&...R| 38 | >>> Flow 4 (server to client) 39 | 00000000 17 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........| 40 | 00000010 00 00 00 00 00 4e 8e bd e5 c8 d4 1a 14 00 f1 ed |.....N..........| 41 | 00000020 c4 88 b3 5c 92 b9 ad 8a 68 d4 f3 85 1b 02 25 aa |...\....h.....%.| 42 | 00000030 a0 65 49 08 0d 2a b4 0a 64 eb ea ab 06 73 08 ca |.eI..*..d....s..| 43 | 00000040 62 c9 56 45 a9 15 03 03 00 30 00 00 00 00 00 00 |b.VE.....0......| 44 | 00000050 00 00 00 00 00 00 00 00 00 00 60 51 ae 81 79 6d |..........`Q..ym| 45 | 00000060 91 95 02 42 30 3f c4 3c 2b fc 74 47 a7 a9 17 22 |...B0?.<+.tG..."| 46 | 00000070 88 26 6d 18 b9 8f ad 43 e3 b0 |.&m....C..| 47 | -------------------------------------------------------------------------------- /tls/common_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=SignatureScheme,CurveID,ClientAuthType -output=common_string.go"; DO NOT EDIT. 2 | 3 | package tls 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[PKCS1WithSHA256-1025] 12 | _ = x[PKCS1WithSHA384-1281] 13 | _ = x[PKCS1WithSHA512-1537] 14 | _ = x[PSSWithSHA256-2052] 15 | _ = x[PSSWithSHA384-2053] 16 | _ = x[PSSWithSHA512-2054] 17 | _ = x[ECDSAWithP256AndSHA256-1027] 18 | _ = x[ECDSAWithP384AndSHA384-1283] 19 | _ = x[ECDSAWithP521AndSHA512-1539] 20 | _ = x[Ed25519-2055] 21 | _ = x[PKCS1WithSHA1-513] 22 | _ = x[ECDSAWithSHA1-515] 23 | } 24 | 25 | const ( 26 | _SignatureScheme_name_0 = "PKCS1WithSHA1" 27 | _SignatureScheme_name_1 = "ECDSAWithSHA1" 28 | _SignatureScheme_name_2 = "PKCS1WithSHA256" 29 | _SignatureScheme_name_3 = "ECDSAWithP256AndSHA256" 30 | _SignatureScheme_name_4 = "PKCS1WithSHA384" 31 | _SignatureScheme_name_5 = "ECDSAWithP384AndSHA384" 32 | _SignatureScheme_name_6 = "PKCS1WithSHA512" 33 | _SignatureScheme_name_7 = "ECDSAWithP521AndSHA512" 34 | _SignatureScheme_name_8 = "PSSWithSHA256PSSWithSHA384PSSWithSHA512Ed25519" 35 | ) 36 | 37 | var ( 38 | _SignatureScheme_index_8 = [...]uint8{0, 13, 26, 39, 46} 39 | ) 40 | 41 | func (i SignatureScheme) String() string { 42 | switch { 43 | case i == 513: 44 | return _SignatureScheme_name_0 45 | case i == 515: 46 | return _SignatureScheme_name_1 47 | case i == 1025: 48 | return _SignatureScheme_name_2 49 | case i == 1027: 50 | return _SignatureScheme_name_3 51 | case i == 1281: 52 | return _SignatureScheme_name_4 53 | case i == 1283: 54 | return _SignatureScheme_name_5 55 | case i == 1537: 56 | return _SignatureScheme_name_6 57 | case i == 1539: 58 | return _SignatureScheme_name_7 59 | case 2052 <= i && i <= 2055: 60 | i -= 2052 61 | return _SignatureScheme_name_8[_SignatureScheme_index_8[i]:_SignatureScheme_index_8[i+1]] 62 | default: 63 | return "SignatureScheme(" + strconv.FormatInt(int64(i), 10) + ")" 64 | } 65 | } 66 | func _() { 67 | // An "invalid array index" compiler error signifies that the constant values have changed. 68 | // Re-run the stringer command to generate them again. 69 | var x [1]struct{} 70 | _ = x[CurveP256-23] 71 | _ = x[CurveP384-24] 72 | _ = x[CurveP521-25] 73 | _ = x[X25519-29] 74 | } 75 | 76 | const ( 77 | _CurveID_name_0 = "CurveP256CurveP384CurveP521" 78 | _CurveID_name_1 = "X25519" 79 | ) 80 | 81 | var ( 82 | _CurveID_index_0 = [...]uint8{0, 9, 18, 27} 83 | ) 84 | 85 | func (i CurveID) String() string { 86 | switch { 87 | case 23 <= i && i <= 25: 88 | i -= 23 89 | return _CurveID_name_0[_CurveID_index_0[i]:_CurveID_index_0[i+1]] 90 | case i == 29: 91 | return _CurveID_name_1 92 | default: 93 | return "CurveID(" + strconv.FormatInt(int64(i), 10) + ")" 94 | } 95 | } 96 | func _() { 97 | // An "invalid array index" compiler error signifies that the constant values have changed. 98 | // Re-run the stringer command to generate them again. 99 | var x [1]struct{} 100 | _ = x[NoClientCert-0] 101 | _ = x[RequestClientCert-1] 102 | _ = x[RequireAnyClientCert-2] 103 | _ = x[VerifyClientCertIfGiven-3] 104 | _ = x[RequireAndVerifyClientCert-4] 105 | } 106 | 107 | const _ClientAuthType_name = "NoClientCertRequestClientCertRequireAnyClientCertVerifyClientCertIfGivenRequireAndVerifyClientCert" 108 | 109 | var _ClientAuthType_index = [...]uint8{0, 12, 29, 49, 72, 98} 110 | 111 | func (i ClientAuthType) String() string { 112 | if i < 0 || i >= ClientAuthType(len(_ClientAuthType_index)-1) { 113 | return "ClientAuthType(" + strconv.FormatInt(int64(i), 10) + ")" 114 | } 115 | return _ClientAuthType_name[_ClientAuthType_index[i]:_ClientAuthType_index[i+1]] 116 | } 117 | -------------------------------------------------------------------------------- /tls/alert.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package tls 6 | 7 | import "strconv" 8 | 9 | type alert uint8 10 | 11 | const ( 12 | // alert level 13 | alertLevelWarning = 1 14 | alertLevelError = 2 15 | ) 16 | 17 | const ( 18 | alertCloseNotify alert = 0 19 | alertUnexpectedMessage alert = 10 20 | alertBadRecordMAC alert = 20 21 | alertDecryptionFailed alert = 21 22 | alertRecordOverflow alert = 22 23 | alertDecompressionFailure alert = 30 24 | alertHandshakeFailure alert = 40 25 | alertBadCertificate alert = 42 26 | alertUnsupportedCertificate alert = 43 27 | alertCertificateRevoked alert = 44 28 | alertCertificateExpired alert = 45 29 | alertCertificateUnknown alert = 46 30 | alertIllegalParameter alert = 47 31 | alertUnknownCA alert = 48 32 | alertAccessDenied alert = 49 33 | alertDecodeError alert = 50 34 | alertDecryptError alert = 51 35 | alertExportRestriction alert = 60 36 | alertProtocolVersion alert = 70 37 | alertInsufficientSecurity alert = 71 38 | alertInternalError alert = 80 39 | alertInappropriateFallback alert = 86 40 | alertUserCanceled alert = 90 41 | alertNoRenegotiation alert = 100 42 | alertMissingExtension alert = 109 43 | alertUnsupportedExtension alert = 110 44 | alertCertificateUnobtainable alert = 111 45 | alertUnrecognizedName alert = 112 46 | alertBadCertificateStatusResponse alert = 113 47 | alertBadCertificateHashValue alert = 114 48 | alertUnknownPSKIdentity alert = 115 49 | alertCertificateRequired alert = 116 50 | alertNoApplicationProtocol alert = 120 51 | ) 52 | 53 | var alertText = map[alert]string{ 54 | alertCloseNotify: "close notify", 55 | alertUnexpectedMessage: "unexpected message", 56 | alertBadRecordMAC: "bad record MAC", 57 | alertDecryptionFailed: "decryption failed", 58 | alertRecordOverflow: "record overflow", 59 | alertDecompressionFailure: "decompression failure", 60 | alertHandshakeFailure: "handshake failure", 61 | alertBadCertificate: "bad certificate", 62 | alertUnsupportedCertificate: "unsupported certificate", 63 | alertCertificateRevoked: "revoked certificate", 64 | alertCertificateExpired: "expired certificate", 65 | alertCertificateUnknown: "unknown certificate", 66 | alertIllegalParameter: "illegal parameter", 67 | alertUnknownCA: "unknown certificate authority", 68 | alertAccessDenied: "access denied", 69 | alertDecodeError: "error decoding message", 70 | alertDecryptError: "error decrypting message", 71 | alertExportRestriction: "export restriction", 72 | alertProtocolVersion: "protocol version not supported", 73 | alertInsufficientSecurity: "insufficient security level", 74 | alertInternalError: "internal error", 75 | alertInappropriateFallback: "inappropriate fallback", 76 | alertUserCanceled: "user canceled", 77 | alertNoRenegotiation: "no renegotiation", 78 | alertMissingExtension: "missing extension", 79 | alertUnsupportedExtension: "unsupported extension", 80 | alertCertificateUnobtainable: "certificate unobtainable", 81 | alertUnrecognizedName: "unrecognized name", 82 | alertBadCertificateStatusResponse: "bad certificate status response", 83 | alertBadCertificateHashValue: "bad certificate hash value", 84 | alertUnknownPSKIdentity: "unknown PSK identity", 85 | alertCertificateRequired: "certificate required", 86 | alertNoApplicationProtocol: "no application protocol", 87 | } 88 | 89 | func (e alert) String() string { 90 | s, ok := alertText[e] 91 | if ok { 92 | return "tls: " + s 93 | } 94 | return "tls: alert(" + strconv.Itoa(int(e)) + ")" 95 | } 96 | 97 | func (e alert) Error() string { 98 | return e.String() 99 | } 100 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv12-Ed25519: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 85 01 00 00 81 03 03 f0 8d 1b 90 67 |...............g| 3 | 00000010 3b 23 46 ac f7 79 f2 f9 e8 90 98 b3 52 b2 55 2a |;#F..y......R.U*| 4 | 00000020 fb 0f 1e dd 4f b3 75 4b 9b 88 0e 00 00 04 cc a9 |....O.uK........| 5 | 00000030 00 ff 01 00 00 54 00 0b 00 04 03 00 01 02 00 0a |.....T..........| 6 | 00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| 7 | 00000050 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 05 03 |.........0......| 8 | 00000060 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| 9 | 00000070 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................| 10 | 00000080 03 02 02 02 04 02 05 02 06 02 |..........| 11 | >>> Flow 2 (server to client) 12 | 00000000 16 03 03 00 37 02 00 00 33 03 03 00 00 00 00 00 |....7...3.......| 13 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 14 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 cc a9 00 00 |...DOWNGRD......| 15 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 03 01 |................| 16 | 00000040 3c 0b 00 01 38 00 01 35 00 01 32 30 82 01 2e 30 |<...8..5..20...0| 17 | 00000050 81 e1 a0 03 02 01 02 02 10 0f 43 1c 42 57 93 94 |..........C.BW..| 18 | 00000060 1d e9 87 e4 f1 ad 15 00 5d 30 05 06 03 2b 65 70 |........]0...+ep| 19 | 00000070 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 6d |0.1.0...U....Acm| 20 | 00000080 65 20 43 6f 30 1e 17 0d 31 39 30 35 31 36 32 31 |e Co0...19051621| 21 | 00000090 33 38 30 31 5a 17 0d 32 30 30 35 31 35 32 31 33 |3801Z..200515213| 22 | 000000a0 38 30 31 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 |801Z0.1.0...U...| 23 | 000000b0 07 41 63 6d 65 20 43 6f 30 2a 30 05 06 03 2b 65 |.Acme Co0*0...+e| 24 | 000000c0 70 03 21 00 3f e2 15 2e e6 e3 ef 3f 4e 85 4a 75 |p.!.?......?N.Ju| 25 | 000000d0 77 a3 64 9e ed e0 bf 84 2c cc 92 26 8f fa 6f 34 |w.d.....,..&..o4| 26 | 000000e0 83 aa ec 8f a3 4d 30 4b 30 0e 06 03 55 1d 0f 01 |.....M0K0...U...| 27 | 000000f0 01 ff 04 04 03 02 05 a0 30 13 06 03 55 1d 25 04 |........0...U.%.| 28 | 00000100 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 30 0c 06 |.0...+.......0..| 29 | 00000110 03 55 1d 13 01 01 ff 04 02 30 00 30 16 06 03 55 |.U.......0.0...U| 30 | 00000120 1d 11 04 0f 30 0d 82 0b 65 78 61 6d 70 6c 65 2e |....0...example.| 31 | 00000130 63 6f 6d 30 05 06 03 2b 65 70 03 41 00 63 44 ed |com0...+ep.A.cD.| 32 | 00000140 9c c4 be 53 24 53 9f d2 10 8d 9f e8 21 08 90 95 |...S$S......!...| 33 | 00000150 39 e5 0d c1 55 ff 2c 16 b7 1d fc ab 7d 4d d4 e0 |9...U.,.....}M..| 34 | 00000160 93 13 d0 a9 42 e0 b6 6b fe 5d 67 48 d7 9f 50 bc |....B..k.]gH..P.| 35 | 00000170 6c cd 4b 03 83 7c f2 08 58 cd ac cf 0c 16 03 03 |l.K..|..X.......| 36 | 00000180 00 6c 0c 00 00 68 03 00 1d 20 2f e5 7d a3 47 cd |.l...h... /.}.G.| 37 | 00000190 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 38 | 000001a0 cf c2 ed 90 99 5f 58 cb 3b 74 08 07 00 40 1f 56 |....._X.;t...@.V| 39 | 000001b0 21 8a 44 04 69 65 ee f8 93 52 4c f0 49 42 57 4c |!.D.ie...RL.IBWL| 40 | 000001c0 5b f5 1a ef 43 ad 39 93 03 a3 64 84 da e5 82 32 |[...C.9...d....2| 41 | 000001d0 fc 77 12 61 f3 f4 2c d8 61 9e 86 01 1f c0 a0 98 |.w.a..,.a.......| 42 | 000001e0 94 a3 7f 15 75 c8 e6 2f 20 bd af 7c be 0e 16 03 |....u../ ..|....| 43 | 000001f0 03 00 04 0e 00 00 00 |.......| 44 | >>> Flow 3 (client to server) 45 | 00000000 16 03 03 00 25 10 00 00 21 20 26 b0 6c 90 e7 71 |....%...! &.l..q| 46 | 00000010 23 78 4b a1 a1 32 7c 28 e9 df 7e 98 e9 78 be 8d |#xK..2|(..~..x..| 47 | 00000020 0d ec fc 30 82 99 16 f0 9f 20 14 03 03 00 01 01 |...0..... ......| 48 | 00000030 16 03 03 00 20 e9 81 b0 ea b3 f3 21 40 9a 3b 3e |.... ......!@.;>| 49 | 00000040 71 a7 13 f5 3a 8a cd 86 34 8b 7e 41 b5 2a 1b 03 |q...:...4.~A.*..| 50 | 00000050 29 77 b3 b2 da |)w...| 51 | >>> Flow 4 (server to client) 52 | 00000000 14 03 03 00 01 01 16 03 03 00 20 54 5a ff 09 7d |.......... TZ..}| 53 | 00000010 46 04 40 62 c5 63 71 85 c7 b4 6c 09 ee 15 71 6b |F.@b.cq...l...qk| 54 | 00000020 60 3b 00 3d 46 47 13 a5 f7 15 16 17 03 03 00 1d |`;.=FG..........| 55 | 00000030 13 8d 00 50 58 d0 2a 47 a8 d8 de 87 d4 3e ff ee |...PX.*G.....>..| 56 | 00000040 f1 4d 6b 25 94 6f 01 7b 70 ee 53 d9 be 15 03 03 |.Mk%.o.{p.S.....| 57 | 00000050 00 12 13 ea 17 69 00 0e 2b ae 21 a9 5e 0a 41 2d |.....i..+.!.^.A-| 58 | 00000060 1b 73 f0 2d |.s.-| 59 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv13-Resume: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 01 6e 01 00 01 6a 03 03 b6 39 89 61 fd |....n...j...9.a.| 3 | 00000010 11 84 b3 4b a9 18 23 b2 35 3d 82 85 75 5c e2 f3 |...K..#.5=..u\..| 4 | 00000020 c9 f4 b0 2f 05 fb 5a 90 da 73 38 20 7f 06 81 e5 |.../..Z..s8 ....| 5 | 00000030 d0 10 08 d1 b0 3c 3c 4b 28 39 34 9a 56 ca 47 4a |.....<.....| 17 | 000000f0 00 00 00 00 00 00 00 00 00 00 00 94 68 2c a3 82 |............h,..| 18 | 00000100 51 ed 14 ef 68 ca 42 c5 5c ab 26 c2 91 a9 01 83 |Q...h.B.\.&.....| 19 | 00000110 13 26 8f 62 7c 89 c0 a2 b5 9b 6d 4f a4 c9 e2 49 |.&.b|.....mO...I| 20 | 00000120 34 03 2c b2 7d d9 af eb 1a 99 76 3c a5 ef 70 78 |4.,.}.....v<..px| 21 | 00000130 59 58 1c 45 80 c5 f1 b8 91 b2 54 71 3f bf 4f 2a |YX.E......Tq?.O*| 22 | 00000140 b2 9d 9d 6f 6f 1c f1 3c 6c e6 a2 73 00 00 00 00 |...oo..>> Flow 2 (server to client) 27 | 00000000 16 03 03 00 80 02 00 00 7c 03 03 00 00 00 00 00 |........|.......| 28 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 29 | 00000020 00 00 00 00 00 00 00 00 00 00 00 20 7f 06 81 e5 |........... ....| 30 | 00000030 d0 10 08 d1 b0 3c 3c 4b 28 39 34 9a 56 ca 47 4a |.....<>> Flow 3 (client to server) 52 | 00000000 14 03 03 00 01 01 17 03 03 00 35 69 08 b0 a0 71 |..........5i...q| 53 | 00000010 1f 95 45 c4 b2 11 43 a9 b5 da ba 11 0a 2b 24 49 |..E...C......+$I| 54 | 00000020 ac 3d 8e ec 32 c9 7f 3e cc 1b fc 9a 68 d0 22 cb |.=..2..>....h.".| 55 | 00000030 37 0e 8f fe 4f 75 1a 62 44 20 60 c2 64 de 48 6d |7...Ou.bD `.d.Hm| 56 | >>> Flow 4 (server to client) 57 | 00000000 17 03 03 00 1e d5 71 aa 53 2d 55 b7 76 11 45 b0 |......q.S-U.v.E.| 58 | 00000010 f3 de f7 f1 78 0b 10 3f 49 7f ea 83 17 2e b9 50 |....x..?I......P| 59 | 00000020 ec d2 0f 17 03 03 00 13 0a 22 58 66 d8 f7 ad fc |........."Xf....| 60 | 00000030 9c f2 da d1 ae 02 f8 99 d2 26 63 |.........&c| 61 | -------------------------------------------------------------------------------- /tls/testdata/Client-TLSv12-Ed25519: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 3 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 4 | 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 5 | 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 6 | 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| 7 | 00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| 8 | 00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| 9 | 00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| 10 | 00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 11 | 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| 12 | 000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| 13 | 000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| 14 | 000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| 15 | 000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| 16 | 000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| 17 | 000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| 18 | >>> Flow 2 (server to client) 19 | 00000000 16 03 03 00 59 02 00 00 55 03 03 6c 5f 04 9e a6 |....Y...U..l_...| 20 | 00000010 c6 41 0c ee a2 2c af 45 f0 bc de 67 2d 20 1c 9c |.A...,.E...g- ..| 21 | 00000020 82 33 fd 86 86 b3 50 04 77 ec da 20 f3 09 fb 8c |.3....P.w.. ....| 22 | 00000030 79 83 f9 82 58 b9 76 bb d3 58 44 3d 52 0c 37 ae |y...X.v..XD=R.7.| 23 | 00000040 18 98 84 9a 56 af 5d 2b 68 68 c7 30 cc a9 00 00 |....V.]+hh.0....| 24 | 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 25 | 00000060 03 01 3c 0b 00 01 38 00 01 35 00 01 32 30 82 01 |..<...8..5..20..| 26 | 00000070 2e 30 81 e1 a0 03 02 01 02 02 10 0f 43 1c 42 57 |.0..........C.BW| 27 | 00000080 93 94 1d e9 87 e4 f1 ad 15 00 5d 30 05 06 03 2b |..........]0...+| 28 | 00000090 65 70 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 |ep0.1.0...U....A| 29 | 000000a0 63 6d 65 20 43 6f 30 1e 17 0d 31 39 30 35 31 36 |cme Co0...190516| 30 | 000000b0 32 31 33 38 30 31 5a 17 0d 32 30 30 35 31 35 32 |213801Z..2005152| 31 | 000000c0 31 33 38 30 31 5a 30 12 31 10 30 0e 06 03 55 04 |13801Z0.1.0...U.| 32 | 000000d0 0a 13 07 41 63 6d 65 20 43 6f 30 2a 30 05 06 03 |...Acme Co0*0...| 33 | 000000e0 2b 65 70 03 21 00 3f e2 15 2e e6 e3 ef 3f 4e 85 |+ep.!.?......?N.| 34 | 000000f0 4a 75 77 a3 64 9e ed e0 bf 84 2c cc 92 26 8f fa |Juw.d.....,..&..| 35 | 00000100 6f 34 83 aa ec 8f a3 4d 30 4b 30 0e 06 03 55 1d |o4.....M0K0...U.| 36 | 00000110 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 1d |..........0...U.| 37 | 00000120 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 30 |%..0...+.......0| 38 | 00000130 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 16 06 |...U.......0.0..| 39 | 00000140 03 55 1d 11 04 0f 30 0d 82 0b 65 78 61 6d 70 6c |.U....0...exampl| 40 | 00000150 65 2e 63 6f 6d 30 05 06 03 2b 65 70 03 41 00 63 |e.com0...+ep.A.c| 41 | 00000160 44 ed 9c c4 be 53 24 53 9f d2 10 8d 9f e8 21 08 |D....S$S......!.| 42 | 00000170 90 95 39 e5 0d c1 55 ff 2c 16 b7 1d fc ab 7d 4d |..9...U.,.....}M| 43 | 00000180 d4 e0 93 13 d0 a9 42 e0 b6 6b fe 5d 67 48 d7 9f |......B..k.]gH..| 44 | 00000190 50 bc 6c cd 4b 03 83 7c f2 08 58 cd ac cf 0c 16 |P.l.K..|..X.....| 45 | 000001a0 03 03 00 6c 0c 00 00 68 03 00 1d 20 a7 28 ef 3e |...l...h... .(.>| 46 | 000001b0 1c 65 9f 8e 9a 80 0b 7d ac 9c ce d6 1e 97 54 30 |.e.....}......T0| 47 | 000001c0 53 9b e6 0c 61 e0 ea 9c ae 70 f2 78 08 07 00 40 |S...a....p.x...@| 48 | 000001d0 0c 49 38 23 a0 75 28 fb ec 71 a4 89 79 45 d1 ca |.I8#.u(..q..yE..| 49 | 000001e0 83 6f 5d dd 01 d4 c6 63 53 5d 6e 8f 06 09 80 a1 |.o]....cS]n.....| 50 | 000001f0 f7 ef af 2d 29 af aa 10 86 1c 18 19 3f be bb 90 |...-).......?...| 51 | 00000200 0e c3 9d 1e 6e 60 49 7f fc c8 42 61 89 c2 e3 04 |....n`I...Ba....| 52 | 00000210 16 03 03 00 04 0e 00 00 00 |.........| 53 | >>> Flow 3 (client to server) 54 | 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 55 | 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 56 | 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| 57 | 00000030 16 03 03 00 20 b2 7f b6 1b 9c ec bf 2e ae a5 70 |.... ..........p| 58 | 00000040 d5 33 9b 63 02 66 77 7d 00 ec 86 e4 bb d4 57 68 |.3.c.fw}......Wh| 59 | 00000050 49 2a d3 be e7 |I*...| 60 | >>> Flow 4 (server to client) 61 | 00000000 14 03 03 00 01 01 16 03 03 00 20 4c 7d ef ed ea |.......... L}...| 62 | 00000010 ab 8d 4f 38 46 6e 8f 56 b4 1d f2 1f 2c df 57 c0 |..O8Fn.V....,.W.| 63 | 00000020 f9 8a c2 71 f8 6d df b7 c7 1e 23 |...q.m....#| 64 | >>> Flow 5 (client to server) 65 | 00000000 17 03 03 00 16 26 f1 7c ee c8 3a 61 b0 f7 5a bd |.....&.|..:a..Z.| 66 | 00000010 b7 61 61 60 69 db cd ea 10 ee 63 15 03 03 00 12 |.aa`i.....c.....| 67 | 00000020 22 c0 65 a4 5d 0e 48 9c 56 f8 54 17 82 5f 29 97 |".e.].H.V.T.._).| 68 | 00000030 be 6b |.k| 69 | -------------------------------------------------------------------------------- /tls/cpu/cpu_x86.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build 386 || amd64 6 | 7 | package cpu 8 | 9 | const CacheLinePadSize = 64 10 | 11 | // cpuid is implemented in cpu_x86.s. 12 | func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) 13 | 14 | // xgetbv with ecx = 0 is implemented in cpu_x86.s. 15 | func xgetbv() (eax, edx uint32) 16 | 17 | const ( 18 | // edx bits 19 | cpuid_SSE2 = 1 << 26 20 | 21 | // ecx bits 22 | cpuid_SSE3 = 1 << 0 23 | cpuid_PCLMULQDQ = 1 << 1 24 | cpuid_SSSE3 = 1 << 9 25 | cpuid_FMA = 1 << 12 26 | cpuid_SSE41 = 1 << 19 27 | cpuid_SSE42 = 1 << 20 28 | cpuid_POPCNT = 1 << 23 29 | cpuid_AES = 1 << 25 30 | cpuid_OSXSAVE = 1 << 27 31 | cpuid_AVX = 1 << 28 32 | 33 | // ebx bits 34 | cpuid_BMI1 = 1 << 3 35 | cpuid_AVX2 = 1 << 5 36 | cpuid_BMI2 = 1 << 8 37 | cpuid_ERMS = 1 << 9 38 | cpuid_ADX = 1 << 19 39 | 40 | // edx bits for CPUID 0x80000001 41 | cpuid_RDTSCP = 1 << 27 42 | ) 43 | 44 | var maxExtendedFunctionInformation uint32 45 | 46 | func doinit() { 47 | options = []option{ 48 | {Name: "adx", Feature: &X86.HasADX}, 49 | {Name: "aes", Feature: &X86.HasAES}, 50 | {Name: "avx", Feature: &X86.HasAVX}, 51 | {Name: "avx2", Feature: &X86.HasAVX2}, 52 | {Name: "bmi1", Feature: &X86.HasBMI1}, 53 | {Name: "bmi2", Feature: &X86.HasBMI2}, 54 | {Name: "erms", Feature: &X86.HasERMS}, 55 | {Name: "fma", Feature: &X86.HasFMA}, 56 | {Name: "pclmulqdq", Feature: &X86.HasPCLMULQDQ}, 57 | {Name: "popcnt", Feature: &X86.HasPOPCNT}, 58 | {Name: "rdtscp", Feature: &X86.HasRDTSCP}, 59 | {Name: "sse3", Feature: &X86.HasSSE3}, 60 | {Name: "sse41", Feature: &X86.HasSSE41}, 61 | {Name: "sse42", Feature: &X86.HasSSE42}, 62 | {Name: "ssse3", Feature: &X86.HasSSSE3}, 63 | } 64 | 65 | maxID, _, _, _ := cpuid(0, 0) 66 | 67 | if maxID < 1 { 68 | return 69 | } 70 | 71 | maxExtendedFunctionInformation, _, _, _ = cpuid(0x80000000, 0) 72 | 73 | _, _, ecx1, _ := cpuid(1, 0) 74 | 75 | X86.HasSSE3 = isSet(ecx1, cpuid_SSE3) 76 | X86.HasPCLMULQDQ = isSet(ecx1, cpuid_PCLMULQDQ) 77 | X86.HasSSSE3 = isSet(ecx1, cpuid_SSSE3) 78 | X86.HasSSE41 = isSet(ecx1, cpuid_SSE41) 79 | X86.HasSSE42 = isSet(ecx1, cpuid_SSE42) 80 | X86.HasPOPCNT = isSet(ecx1, cpuid_POPCNT) 81 | X86.HasAES = isSet(ecx1, cpuid_AES) 82 | 83 | // OSXSAVE can be false when using older Operating Systems 84 | // or when explicitly disabled on newer Operating Systems by 85 | // e.g. setting the xsavedisable boot option on Windows 10. 86 | X86.HasOSXSAVE = isSet(ecx1, cpuid_OSXSAVE) 87 | 88 | // The FMA instruction set extension only has VEX prefixed instructions. 89 | // VEX prefixed instructions require OSXSAVE to be enabled. 90 | // See Intel 64 and IA-32 Architecture Software Developer’s Manual Volume 2 91 | // Section 2.4 "AVX and SSE Instruction Exception Specification" 92 | X86.HasFMA = isSet(ecx1, cpuid_FMA) && X86.HasOSXSAVE 93 | 94 | osSupportsAVX := false 95 | // For XGETBV, OSXSAVE bit is required and sufficient. 96 | if X86.HasOSXSAVE { 97 | eax, _ := xgetbv() 98 | // Check if XMM and YMM registers have OS support. 99 | osSupportsAVX = isSet(eax, 1<<1) && isSet(eax, 1<<2) 100 | } 101 | 102 | X86.HasAVX = isSet(ecx1, cpuid_AVX) && osSupportsAVX 103 | 104 | if maxID < 7 { 105 | return 106 | } 107 | 108 | _, ebx7, _, _ := cpuid(7, 0) 109 | X86.HasBMI1 = isSet(ebx7, cpuid_BMI1) 110 | X86.HasAVX2 = isSet(ebx7, cpuid_AVX2) && osSupportsAVX 111 | X86.HasBMI2 = isSet(ebx7, cpuid_BMI2) 112 | X86.HasERMS = isSet(ebx7, cpuid_ERMS) 113 | X86.HasADX = isSet(ebx7, cpuid_ADX) 114 | 115 | var maxExtendedInformation uint32 116 | maxExtendedInformation, _, _, _ = cpuid(0x80000000, 0) 117 | 118 | if maxExtendedInformation < 0x80000001 { 119 | return 120 | } 121 | 122 | _, _, _, edxExt1 := cpuid(0x80000001, 0) 123 | X86.HasRDTSCP = isSet(edxExt1, cpuid_RDTSCP) 124 | } 125 | 126 | func isSet(hwc uint32, value uint32) bool { 127 | return hwc&value != 0 128 | } 129 | 130 | // Name returns the CPU name given by the vendor. 131 | // If the CPU name can not be determined an 132 | // empty string is returned. 133 | func Name() string { 134 | if maxExtendedFunctionInformation < 0x80000004 { 135 | return "" 136 | } 137 | 138 | data := make([]byte, 0, 3*4*4) 139 | 140 | var eax, ebx, ecx, edx uint32 141 | eax, ebx, ecx, edx = cpuid(0x80000002, 0) 142 | data = appendBytes(data, eax, ebx, ecx, edx) 143 | eax, ebx, ecx, edx = cpuid(0x80000003, 0) 144 | data = appendBytes(data, eax, ebx, ecx, edx) 145 | eax, ebx, ecx, edx = cpuid(0x80000004, 0) 146 | data = appendBytes(data, eax, ebx, ecx, edx) 147 | 148 | // Trim leading spaces. 149 | for len(data) > 0 && data[0] == ' ' { 150 | data = data[1:] 151 | } 152 | 153 | // Trim tail after and including the first null byte. 154 | for i, c := range data { 155 | if c == '\x00' { 156 | data = data[:i] 157 | break 158 | } 159 | } 160 | 161 | return string(data) 162 | } 163 | 164 | func appendBytes(b []byte, args ...uint32) []byte { 165 | for _, arg := range args { 166 | b = append(b, 167 | byte((arg >> 0)), 168 | byte((arg >> 8)), 169 | byte((arg >> 16)), 170 | byte((arg >> 24))) 171 | } 172 | return b 173 | } 174 | -------------------------------------------------------------------------------- /tls/testdata/Client-TLSv13-Ed25519: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 3 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 4 | 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 5 | 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 6 | 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| 7 | 00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| 8 | 00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| 9 | 00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| 10 | 00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 11 | 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| 12 | 000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| 13 | 000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| 14 | 000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| 15 | 000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| 16 | 000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| 17 | 000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| 18 | >>> Flow 2 (server to client) 19 | 00000000 16 03 03 00 7a 02 00 00 76 03 03 6f b6 d3 79 9b |....z...v..o..y.| 20 | 00000010 00 17 a8 46 3f e4 bc fc 08 1e 56 6c d8 63 86 f3 |...F?.....Vl.c..| 21 | 00000020 83 1b d8 26 6d 86 d6 4c f3 4f e1 20 00 00 00 00 |...&m..L.O. ....| 22 | 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 23 | 00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 03 00 00 |................| 24 | 00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 5b |..+.....3.$... [| 25 | 00000060 8f 4f 5a a9 95 6b 04 07 31 d3 ed 91 8b 25 b4 7b |.OZ..k..1....%.{| 26 | 00000070 5c a1 0a a6 26 09 92 9b b0 72 26 f9 0d 09 60 14 |\...&....r&...`.| 27 | 00000080 03 03 00 01 01 17 03 03 00 17 a8 99 d3 76 1f 12 |.............v..| 28 | 00000090 19 18 15 8e 4c 59 43 92 11 4a aa 50 98 7e 4c d9 |....LYC..J.P.~L.| 29 | 000000a0 63 17 03 03 01 50 66 f5 d6 ce 35 0f 10 e5 ab 34 |c....Pf...5....4| 30 | 000000b0 78 17 c6 b6 60 40 eb 53 34 9f ce 02 c4 36 51 18 |x...`@.S4....6Q.| 31 | 000000c0 c2 b3 fb f3 98 92 d0 f2 b7 be 28 f5 c7 2d fa 1f |..........(..-..| 32 | 000000d0 9b 8b aa e5 45 54 6b 0e ed 6b 44 cb d4 4d 62 b2 |....ETk..kD..Mb.| 33 | 000000e0 30 c9 df ac cf a3 7e 43 58 1e bf 6e 5b 69 4e 48 |0.....~CX..n[iNH| 34 | 000000f0 1c 39 49 eb 8a 0c 22 f3 70 4a 80 50 39 d6 68 29 |.9I...".pJ.P9.h)| 35 | 00000100 d0 6d 08 20 26 39 6d 37 5a 9f 79 e9 16 e3 7e 94 |.m. &9m7Z.y...~.| 36 | 00000110 8f 5f 9b 97 2d e1 b1 48 e4 a3 36 63 40 5a 80 93 |._..-..H..6c@Z..| 37 | 00000120 06 27 3b 93 d9 ed 2d b1 3e 74 ed bc 38 a1 cb 17 |.';...-.>t..8...| 38 | 00000130 06 4a 9b c1 c1 d7 7a 1c ca ff 4d ee 91 6d d0 3c |.J....z...M..m.<| 39 | 00000140 c2 4b cc 33 c6 7c 76 8e db a2 e0 fe 15 e2 ec db |.K.3.|v.........| 40 | 00000150 1f 5d 05 c8 5e 0e 7f 2c 7a 95 08 34 68 a2 2c 7c |.]..^..,z..4h.,|| 41 | 00000160 04 16 92 7a c8 ec 52 2d 1a c4 7a ea 12 cd 0f b9 |...z..R-..z.....| 42 | 00000170 7c 00 51 55 02 5b 02 7d ec 89 af f5 6d 76 89 0e ||.QU.[.}....mv..| 43 | 00000180 67 42 f0 e4 67 4d 3f 70 ff 2c 64 81 1c 4a 92 1f |gB..gM?p.,d..J..| 44 | 00000190 26 8b a4 4f 15 18 b5 11 4a 61 df 45 53 74 fd 8d |&..O....Ja.ESt..| 45 | 000001a0 ff 22 32 91 af c7 7f a4 7b 62 c3 3b 30 51 b6 34 |."2.....{b.;0Q.4| 46 | 000001b0 b6 01 21 f9 86 74 be 62 27 1a 41 1f f0 0d 8b 5c |..!..t.b'.A....\| 47 | 000001c0 4b 82 ea 76 23 9c 36 af 25 1f f6 2d 5f 9c 28 bd |K..v#.6.%..-_.(.| 48 | 000001d0 b6 d5 1e 26 8b c1 dc ac ed 6d 10 ff 13 ed fc 08 |...&.....m......| 49 | 000001e0 08 0a 74 1c b1 5b f8 45 e4 83 44 f2 be ce 8d ac |..t..[.E..D.....| 50 | 000001f0 ee ae e6 21 da c7 17 03 03 00 59 d9 b3 95 0a f7 |...!......Y.....| 51 | 00000200 1a 1a 54 fa ab 09 38 6d 6d 53 0a ef 11 73 bc a2 |..T...8mmS...s..| 52 | 00000210 20 03 31 48 e2 0a d1 af 56 6c ca dd 88 ba 72 3a | .1H....Vl....r:| 53 | 00000220 c1 e0 c5 60 44 74 d6 c9 18 23 96 2c e7 88 c8 3e |...`Dt...#.,...>| 54 | 00000230 02 73 c0 38 d4 bd 85 a4 bb 78 a0 ba d3 fd f1 c4 |.s.8.....x......| 55 | 00000240 27 08 05 fb 2c 26 20 b7 1a 41 87 a6 b7 97 19 26 |'...,& ..A.....&| 56 | 00000250 50 ed 9a e4 17 03 03 00 35 68 36 c7 78 c3 5e ff |P.......5h6.x.^.| 57 | 00000260 b3 92 a7 25 31 2a a2 fa 24 d9 da 69 16 03 8b db |...%1*..$..i....| 58 | 00000270 fe b2 3f 63 88 49 f1 14 63 7a 58 a9 6f c5 64 92 |..?c.I..czX.o.d.| 59 | 00000280 21 84 82 d8 49 98 fb f3 f1 fd 52 83 32 97 |!...I.....R.2.| 60 | >>> Flow 3 (client to server) 61 | 00000000 14 03 03 00 01 01 17 03 03 00 35 07 7b a2 7a 4f |..........5.{.zO| 62 | 00000010 40 e9 a2 94 9f b7 2d 91 87 1e 37 b0 ca b7 ea 91 |@.....-...7.....| 63 | 00000020 53 f1 bf 7d 56 6a 0c 6a 9d 07 ac 93 9c db ca ac |S..}Vj.j........| 64 | 00000030 43 7b eb 56 9d 6c 79 f2 72 f8 0b 8d 15 08 84 d5 |C{.V.ly.r.......| 65 | 00000040 17 03 03 00 17 07 b3 7d a9 56 c4 76 e5 12 97 29 |.......}.V.v...)| 66 | 00000050 b7 99 e6 3e 08 79 2d fb 1a 5b eb 7a 17 03 03 00 |...>.y-..[.z....| 67 | 00000060 13 66 b7 65 57 0d 54 7b 6a 34 98 a1 4e 29 d5 92 |.f.eW.T{j4..N)..| 68 | 00000070 1e b6 52 bc |..R.| 69 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv10-RSA-RC4: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 63 01 00 00 5f 03 01 55 31 1a ed 02 |....c..._..U1...| 3 | 00000010 35 fe 3c ea 62 08 52 96 93 bc 2a 1b 82 fe b9 8f |5.<.b.R...*.....| 4 | 00000020 7a 47 0e 6a 9b e8 86 ca 89 a0 e6 00 00 04 00 05 |zG.j............| 5 | 00000030 00 ff 01 00 00 32 00 00 00 0e 00 0c 00 00 09 31 |.....2.........1| 6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| 8 | 00000060 00 16 00 00 00 17 00 00 |........| 9 | >>> Flow 2 (server to client) 10 | 00000000 16 03 01 00 37 02 00 00 33 03 01 00 00 00 00 00 |....7...3.......| 11 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 12 | 00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 05 00 00 |...DOWNGRD......| 13 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 01 02 |................| 14 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 15 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 16 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 17 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 18 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 19 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 20 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 21 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 22 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 23 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 24 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 25 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 26 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 27 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 28 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 29 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 30 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 31 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 32 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 33 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 34 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 35 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 36 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 37 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 38 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 39 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 40 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 41 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 42 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 43 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 44 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 45 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 46 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 47 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 48 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 49 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 50 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 51 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 01 00 04 0e |.`.\!.;.........| 52 | 000002a0 00 00 00 |...| 53 | >>> Flow 3 (client to server) 54 | 00000000 16 03 01 00 86 10 00 00 82 00 80 75 7d be e3 5b |...........u}..[| 55 | 00000010 66 4b 58 09 f7 86 6a ca 93 8e ba 3c 18 11 47 5e |fKX...j....<..G^| 56 | 00000020 7e c2 b1 0c 5e a4 c1 07 ef 25 00 d7 bf c7 b0 03 |~...^....%......| 57 | 00000030 0d f6 ff a9 c2 73 a2 c0 dc 8d db f9 5a a9 18 7d |.....s......Z..}| 58 | 00000040 1f 8e 0b 9c 24 6c c8 49 99 e1 42 e0 86 d5 e1 e1 |....$l.I..B.....| 59 | 00000050 d1 ae fd d2 c4 ef 07 8c 28 95 b7 54 25 57 40 1c |........(..T%W@.| 60 | 00000060 c6 af 85 46 a0 31 d4 39 b8 47 43 88 a0 a6 5d d7 |...F.1.9.GC...].| 61 | 00000070 95 fb 88 64 ce 36 2b c5 56 85 56 40 f8 d4 d3 90 |...d.6+.V.V@....| 62 | 00000080 d1 25 53 06 d8 ab a0 f2 21 8f 88 14 03 01 00 01 |.%S.....!.......| 63 | 00000090 01 16 03 01 00 24 26 50 7a 2c ab 3f db 41 06 cf |.....$&Pz,.?.A..| 64 | 000000a0 8b 7b f8 46 ad a4 77 b6 06 f0 44 23 04 34 88 9d |.{.F..w...D#.4..| 65 | 000000b0 48 d7 5e cc 9e e6 46 a3 04 69 |H.^...F..i| 66 | >>> Flow 4 (server to client) 67 | 00000000 14 03 01 00 01 01 16 03 01 00 24 57 fc eb dd 40 |..........$W...@| 68 | 00000010 83 1d 9a 9a 80 a3 62 a0 08 23 c3 97 fd d5 fb d7 |......b..#......| 69 | 00000020 98 f8 14 ae 61 c7 21 fb 8a 18 1e c8 15 05 e7 17 |....a.!.........| 70 | 00000030 03 01 00 21 7c 2b 2d 72 2f 63 56 3a 09 51 4e ab |...!|+-r/cV:.QN.| 71 | 00000040 31 25 c8 7e 34 5b a4 ab 30 87 50 07 ed 32 3f 79 |1%.~4[..0.P..2?y| 72 | 00000050 f1 db c0 17 f3 15 03 01 00 16 fc ce c9 0c b6 0c |................| 73 | 00000060 c5 2d d9 3f 2a 9e 9a 83 40 e1 a3 b9 5f 89 aa 75 |.-.?*...@..._..u| 74 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv11-RSA-RC4: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 63 01 00 00 5f 03 02 2b b6 22 28 e3 |....c..._..+."(.| 3 | 00000010 1f 42 f4 2e d0 43 4b 9a ea 2b 36 44 ca 93 6c 71 |.B...CK..+6D..lq| 4 | 00000020 b9 4d 52 44 64 57 b2 05 9b 41 da 00 00 04 00 05 |.MRDdW...A......| 5 | 00000030 00 ff 01 00 00 32 00 00 00 0e 00 0c 00 00 09 31 |.....2.........1| 6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| 8 | 00000060 00 16 00 00 00 17 00 00 |........| 9 | >>> Flow 2 (server to client) 10 | 00000000 16 03 02 00 37 02 00 00 33 03 02 00 00 00 00 00 |....7...3.......| 11 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 12 | 00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 05 00 00 |...DOWNGRD......| 13 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 02 02 |................| 14 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 15 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 16 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 17 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 18 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 19 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 20 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 21 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 22 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 23 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 24 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 25 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 26 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 27 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 28 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 29 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 30 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 31 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 32 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 33 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 34 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 35 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 36 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 37 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 38 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 39 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 40 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 41 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 42 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 43 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 44 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 45 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 46 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 47 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 48 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 49 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 50 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 51 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 02 00 04 0e |.`.\!.;.........| 52 | 000002a0 00 00 00 |...| 53 | >>> Flow 3 (client to server) 54 | 00000000 16 03 02 00 86 10 00 00 82 00 80 3d 47 85 0a ef |...........=G...| 55 | 00000010 47 7c c5 93 bb 6f 7c 57 dc 2b 3f f4 e7 da 4e fc |G|...o|W.+?...N.| 56 | 00000020 04 52 36 71 c5 63 1f 6f e6 43 91 06 bc 5c 14 b0 |.R6q.c.o.C...\..| 57 | 00000030 ee 83 ed 3d 7a d2 4e 2c d2 2c bb f0 0c b5 82 d5 |...=z.N,.,......| 58 | 00000040 9d c2 5a 03 12 b6 70 20 3c 89 84 af 1b 2c 2f b7 |..Z...p <....,/.| 59 | 00000050 9b fe dd 71 06 ac 46 30 a7 b5 9f 0b aa 6e 58 50 |...q..F0.....nXP| 60 | 00000060 9d da 6b ba 00 51 e9 2a e9 d2 e9 0f 83 62 73 19 |..k..Q.*.....bs.| 61 | 00000070 91 a4 46 bd 53 42 f7 15 ab ab 6b 8f f3 6f d1 07 |..F.SB....k..o..| 62 | 00000080 44 41 97 4c 7d 89 4b 33 55 30 30 14 03 02 00 01 |DA.L}.K3U00.....| 63 | 00000090 01 16 03 02 00 24 54 fe a0 7c 16 47 de 0b 8f 7d |.....$T..|.G...}| 64 | 000000a0 51 68 05 da 1e 6d 96 c9 e1 94 68 fa 79 46 02 db |Qh...m....h.yF..| 65 | 000000b0 03 4e 2e 70 9f 7e 14 85 fd 1d |.N.p.~....| 66 | >>> Flow 4 (server to client) 67 | 00000000 14 03 02 00 01 01 16 03 02 00 24 4b c5 cf 20 3f |..........$K.. ?| 68 | 00000010 0a 13 1f 55 25 26 9b 33 fd 14 61 0f 44 32 26 b3 |...U%&.3..a.D2&.| 69 | 00000020 ab 01 ee c2 1f d3 38 08 f0 af 76 6a 0d e1 b7 17 |......8...vj....| 70 | 00000030 03 02 00 21 97 16 df 99 06 81 f2 00 d3 fd b4 03 |...!............| 71 | 00000040 be 16 b6 aa 74 d4 c7 25 67 94 14 34 25 ec 0d 12 |....t..%g..4%...| 72 | 00000050 c7 43 2d a2 1d 15 03 02 00 16 94 58 af 6b 55 5f |.C-........X.kU_| 73 | 00000060 25 0c 80 28 99 2d 75 1a ce 24 cd 75 0d 7f b9 71 |%..(.-u..$.u...q| 74 | -------------------------------------------------------------------------------- /tls/generate_cert.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build ignore 6 | 7 | // Generate a self-signed X.509 certificate for a TLS server. Outputs to 8 | // 'cert.pem' and 'key.pem' and will overwrite existing files. 9 | 10 | package main 11 | 12 | import ( 13 | "crypto/ecdsa" 14 | "crypto/ed25519" 15 | "crypto/elliptic" 16 | "crypto/rand" 17 | "crypto/rsa" 18 | "crypto/x509" 19 | "crypto/x509/pkix" 20 | "encoding/pem" 21 | "flag" 22 | "log" 23 | "math/big" 24 | "net" 25 | "os" 26 | "strings" 27 | "time" 28 | ) 29 | 30 | var ( 31 | host = flag.String("host", "", "Comma-separated hostnames and IPs to generate a certificate for") 32 | validFrom = flag.String("start-date", "", "Creation date formatted as Jan 1 15:04:05 2011") 33 | validFor = flag.Duration("duration", 365*24*time.Hour, "Duration that certificate is valid for") 34 | isCA = flag.Bool("ca", false, "whether this cert should be its own Certificate Authority") 35 | rsaBits = flag.Int("rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set") 36 | ecdsaCurve = flag.String("ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256 (recommended), P384, P521") 37 | ed25519Key = flag.Bool("ed25519", false, "Generate an Ed25519 key") 38 | ) 39 | 40 | func publicKey(priv any) any { 41 | switch k := priv.(type) { 42 | case *rsa.PrivateKey: 43 | return &k.PublicKey 44 | case *ecdsa.PrivateKey: 45 | return &k.PublicKey 46 | case ed25519.PrivateKey: 47 | return k.Public().(ed25519.PublicKey) 48 | default: 49 | return nil 50 | } 51 | } 52 | 53 | func main() { 54 | flag.Parse() 55 | 56 | if len(*host) == 0 { 57 | log.Fatalf("Missing required --host parameter") 58 | } 59 | 60 | var priv any 61 | var err error 62 | switch *ecdsaCurve { 63 | case "": 64 | if *ed25519Key { 65 | _, priv, err = ed25519.GenerateKey(rand.Reader) 66 | } else { 67 | priv, err = rsa.GenerateKey(rand.Reader, *rsaBits) 68 | } 69 | case "P224": 70 | priv, err = ecdsa.GenerateKey(elliptic.P224(), rand.Reader) 71 | case "P256": 72 | priv, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) 73 | case "P384": 74 | priv, err = ecdsa.GenerateKey(elliptic.P384(), rand.Reader) 75 | case "P521": 76 | priv, err = ecdsa.GenerateKey(elliptic.P521(), rand.Reader) 77 | default: 78 | log.Fatalf("Unrecognized elliptic curve: %q", *ecdsaCurve) 79 | } 80 | if err != nil { 81 | log.Fatalf("Failed to generate private key: %v", err) 82 | } 83 | 84 | // ECDSA, ED25519 and RSA subject keys should have the DigitalSignature 85 | // KeyUsage bits set in the x509.Certificate template 86 | keyUsage := x509.KeyUsageDigitalSignature 87 | // Only RSA subject keys should have the KeyEncipherment KeyUsage bits set. In 88 | // the context of TLS this KeyUsage is particular to RSA key exchange and 89 | // authentication. 90 | if _, isRSA := priv.(*rsa.PrivateKey); isRSA { 91 | keyUsage |= x509.KeyUsageKeyEncipherment 92 | } 93 | 94 | var notBefore time.Time 95 | if len(*validFrom) == 0 { 96 | notBefore = time.Now() 97 | } else { 98 | notBefore, err = time.Parse("Jan 2 15:04:05 2006", *validFrom) 99 | if err != nil { 100 | log.Fatalf("Failed to parse creation date: %v", err) 101 | } 102 | } 103 | 104 | notAfter := notBefore.Add(*validFor) 105 | 106 | serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) 107 | serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) 108 | if err != nil { 109 | log.Fatalf("Failed to generate serial number: %v", err) 110 | } 111 | 112 | template := x509.Certificate{ 113 | SerialNumber: serialNumber, 114 | Subject: pkix.Name{ 115 | Organization: []string{"Acme Co"}, 116 | }, 117 | NotBefore: notBefore, 118 | NotAfter: notAfter, 119 | 120 | KeyUsage: keyUsage, 121 | ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, 122 | BasicConstraintsValid: true, 123 | } 124 | 125 | hosts := strings.Split(*host, ",") 126 | for _, h := range hosts { 127 | if ip := net.ParseIP(h); ip != nil { 128 | template.IPAddresses = append(template.IPAddresses, ip) 129 | } else { 130 | template.DNSNames = append(template.DNSNames, h) 131 | } 132 | } 133 | 134 | if *isCA { 135 | template.IsCA = true 136 | template.KeyUsage |= x509.KeyUsageCertSign 137 | } 138 | 139 | derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, publicKey(priv), priv) 140 | if err != nil { 141 | log.Fatalf("Failed to create certificate: %v", err) 142 | } 143 | 144 | certOut, err := os.Create("cert.pem") 145 | if err != nil { 146 | log.Fatalf("Failed to open cert.pem for writing: %v", err) 147 | } 148 | if err := pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil { 149 | log.Fatalf("Failed to write data to cert.pem: %v", err) 150 | } 151 | if err := certOut.Close(); err != nil { 152 | log.Fatalf("Error closing cert.pem: %v", err) 153 | } 154 | log.Print("wrote cert.pem\n") 155 | 156 | keyOut, err := os.OpenFile("key.pem", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) 157 | if err != nil { 158 | log.Fatalf("Failed to open key.pem for writing: %v", err) 159 | return 160 | } 161 | privBytes, err := x509.MarshalPKCS8PrivateKey(priv) 162 | if err != nil { 163 | log.Fatalf("Unable to marshal private key: %v", err) 164 | } 165 | if err := pem.Encode(keyOut, &pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}); err != nil { 166 | log.Fatalf("Failed to write data to key.pem: %v", err) 167 | } 168 | if err := keyOut.Close(); err != nil { 169 | log.Fatalf("Error closing key.pem: %v", err) 170 | } 171 | log.Print("wrote key.pem\n") 172 | } 173 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv10-RSA-3DES: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 63 01 00 00 5f 03 01 25 03 63 bf 34 |....c..._..%.c.4| 3 | 00000010 89 c8 9e f6 e0 46 f8 30 5c e8 62 0a f7 db 68 c9 |.....F.0\.b...h.| 4 | 00000020 50 54 0e c2 15 f1 cb 07 66 06 3d 00 00 04 00 0a |PT......f.=.....| 5 | 00000030 00 ff 01 00 00 32 00 00 00 0e 00 0c 00 00 09 31 |.....2.........1| 6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| 8 | 00000060 00 16 00 00 00 17 00 00 |........| 9 | >>> Flow 2 (server to client) 10 | 00000000 16 03 01 00 37 02 00 00 33 03 01 00 00 00 00 00 |....7...3.......| 11 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 12 | 00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 0a 00 00 |...DOWNGRD......| 13 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 01 02 |................| 14 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 15 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 16 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 17 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 18 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 19 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 20 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 21 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 22 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 23 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 24 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 25 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 26 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 27 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 28 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 29 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 30 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 31 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 32 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 33 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 34 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 35 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 36 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 37 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 38 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 39 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 40 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 41 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 42 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 43 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 44 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 45 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 46 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 47 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 48 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 49 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 50 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 51 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 01 00 04 0e |.`.\!.;.........| 52 | 000002a0 00 00 00 |...| 53 | >>> Flow 3 (client to server) 54 | 00000000 16 03 01 00 86 10 00 00 82 00 80 0f e9 83 ca 77 |...............w| 55 | 00000010 c8 26 16 24 00 b7 09 d2 73 aa c1 d9 77 f3 fc 38 |.&.$....s...w..8| 56 | 00000020 1c 2e c0 26 b4 a6 40 e1 1b 93 39 8f a2 1f f2 f9 |...&..@...9.....| 57 | 00000030 18 2a 7b 0e cd 9b 9b 9c 49 86 43 3d 48 fd 40 d7 |.*{.....I.C=H.@.| 58 | 00000040 af f9 2b 5e c6 cc c6 2d 8d 36 fe b1 75 c1 b5 a0 |..+^...-.6..u...| 59 | 00000050 57 97 0f 01 ee b4 6a af 0c fe f0 68 78 04 6a 3e |W.....j....hx.j>| 60 | 00000060 83 d0 72 34 80 d8 7d cd 8b 83 06 5b 36 50 10 8e |..r4..}....[6P..| 61 | 00000070 b4 27 3d 6a ae b7 7f 8b 2a b1 0b 51 49 05 b5 01 |.'=j....*..QI...| 62 | 00000080 3c 27 9a 59 e3 41 18 38 d6 8f 7a 14 03 01 00 01 |<'.Y.A.8..z.....| 63 | 00000090 01 16 03 01 00 28 c0 46 65 9f 7f d8 c3 c4 a7 33 |.....(.Fe......3| 64 | 000000a0 50 f9 07 41 95 12 a6 f3 ca 53 b9 96 f8 a8 a6 5f |P..A.....S....._| 65 | 000000b0 1e c8 20 e5 8b 87 4e 12 73 13 e0 e4 c6 89 |.. ...N.s.....| 66 | >>> Flow 4 (server to client) 67 | 00000000 14 03 01 00 01 01 16 03 01 00 28 e2 47 2b 57 fe |..........(.G+W.| 68 | 00000010 74 71 95 6a ee 68 2b f3 48 40 13 52 35 46 58 d4 |tq.j.h+.H@.R5FX.| 69 | 00000020 ee aa 4c a8 53 0f 3a 19 ed 18 37 2d e4 b9 1e e6 |..L.S.:...7-....| 70 | 00000030 28 42 a1 17 03 01 00 18 d8 7c 20 f2 03 6d a9 ed |(B.......| ..m..| 71 | 00000040 c9 73 50 d7 56 4f 0b d8 4b 44 f6 80 e4 c1 a9 f5 |.sP.VO..KD......| 72 | 00000050 17 03 01 00 28 f5 b2 11 6b a6 4b 22 30 42 3c cc |....(...k.K"0B<.| 73 | 00000060 07 0d ed 10 d0 c7 7b ec b3 60 0b 2b 3c fb ec 3a |......{..`.+<..:| 74 | 00000070 c0 be 44 e7 76 b6 9e db 17 36 92 df 88 15 03 01 |..D.v....6......| 75 | 00000080 00 18 7a d9 2f 46 2e 0f ec c5 ee 7b ef bd fb e5 |..z./F.....{....| 76 | 00000090 26 40 0a a2 4e eb 56 0e ca 03 |&@..N.V...| 77 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv12-RSA-RC4: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 97 01 00 00 93 03 03 2c 3c 18 04 94 |...........,<...| 3 | 00000010 e0 bb 10 99 7c 0c cd 0e e7 72 bc 83 4d f0 cf d7 |....|....r..M...| 4 | 00000020 4b 8e 2c 8b 52 bf ed 86 65 d2 a3 00 00 04 00 05 |K.,.R...e.......| 5 | 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| 6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| 8 | 00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....| 9 | 00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................| 10 | 00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................| 11 | 00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............| 12 | >>> Flow 2 (server to client) 13 | 00000000 16 03 03 00 37 02 00 00 33 03 03 00 00 00 00 00 |....7...3.......| 14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 05 00 00 |...DOWNGRD......| 16 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 03 02 |................| 17 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 18 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 19 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 20 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 21 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 22 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 23 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 24 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 25 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 26 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 27 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 28 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 29 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 30 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 31 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 32 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 33 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 34 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 35 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 36 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 37 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 38 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 39 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 40 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 41 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 42 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 43 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 44 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 45 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 46 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 47 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 48 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 49 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 50 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 51 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 52 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 53 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 54 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 04 0e |.`.\!.;.........| 55 | 000002a0 00 00 00 |...| 56 | >>> Flow 3 (client to server) 57 | 00000000 16 03 03 00 86 10 00 00 82 00 80 a2 43 45 e6 1e |............CE..| 58 | 00000010 08 d3 29 62 0b 40 75 98 a3 f6 68 d7 78 31 b0 c9 |..)b.@u...h.x1..| 59 | 00000020 f4 f8 a6 98 dc d8 72 c1 2a 68 80 26 54 1c 16 af |......r.*h.&T...| 60 | 00000030 9f 67 cf ee 74 de 9e 29 b6 cd 0d eb df aa ea 44 |.g..t..).......D| 61 | 00000040 72 c9 aa fc ff c9 2d 9d bf bc f0 9b c1 7b 0d 5c |r.....-......{.\| 62 | 00000050 69 0c 75 d8 23 09 29 97 f6 38 9c f9 4f 1b 4a d5 |i.u.#.)..8..O.J.| 63 | 00000060 bd 04 d4 15 b3 a6 80 02 a4 11 32 d7 c0 cf 89 1f |..........2.....| 64 | 00000070 93 80 2b 48 49 51 44 b7 77 3c bf b1 a6 87 a3 ff |..+HIQD.w<......| 65 | 00000080 39 37 4a 42 49 92 93 25 0a 51 9a 14 03 03 00 01 |97JBI..%.Q......| 66 | 00000090 01 16 03 03 00 24 b5 c9 d6 9c ec 77 38 d2 30 79 |.....$.....w8.0y| 67 | 000000a0 f1 00 77 31 78 9b e6 ab ed 46 7c c6 e5 26 0b 44 |..w1x....F|..&.D| 68 | 000000b0 fd 30 b0 fe 0c 84 6f 9a cf 57 |.0....o..W| 69 | >>> Flow 4 (server to client) 70 | 00000000 14 03 03 00 01 01 16 03 03 00 24 58 cc 9f 3f ac |..........$X..?.| 71 | 00000010 2e 20 73 c9 5e 13 d3 12 3a 63 1e a9 ee 13 3d 0d |. s.^...:c....=.| 72 | 00000020 51 e9 15 5b 7b 33 92 85 6c fa d6 8a 15 16 dc 17 |Q..[{3..l.......| 73 | 00000030 03 03 00 21 bc af 01 72 48 0c 16 c9 7a c0 3c 27 |...!...rH...z.<'| 74 | 00000040 63 0a f8 34 e4 54 6a 39 39 61 02 bc c2 a0 07 03 |c..4.Tj99a......| 75 | 00000050 fb 2c d0 1b 6a 15 03 03 00 16 98 71 13 a6 5d f5 |.,..j......q..].| 76 | 00000060 7d aa 6d 05 2d a2 dc c0 7b 41 88 36 a2 49 a4 8b |}.m.-...{A.6.I..| 77 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv13-Ed25519: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 ca 01 00 00 c6 03 03 a1 5b 14 56 ac |............[.V.| 3 | 00000010 3f 2b b0 8e e9 0b ae 7e f7 3b 3b 20 90 b6 e4 06 |?+.....~.;; ....| 4 | 00000020 c2 b9 71 88 e4 4c 01 28 41 b3 e8 20 49 01 f7 fc |..q..L.(A.. I...| 5 | 00000030 ce 52 3e f4 58 60 56 7d 36 21 ba 23 87 21 f7 36 |.R>.X`V}6!.#.!.6| 6 | 00000040 48 88 22 78 26 37 27 a4 fc 7a 8b ea 00 04 13 03 |H."x&7'..z......| 7 | 00000050 00 ff 01 00 00 79 00 0b 00 04 03 00 01 02 00 0a |.....y..........| 8 | 00000060 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| 9 | 00000070 00 00 00 17 00 00 00 0d 00 1e 00 1c 04 03 05 03 |................| 10 | 00000080 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| 11 | 00000090 08 06 04 01 05 01 06 01 00 2b 00 03 02 03 04 00 |.........+......| 12 | 000000a0 2d 00 02 01 01 00 33 00 26 00 24 00 1d 00 20 f4 |-.....3.&.$... .| 13 | 000000b0 2c db e8 c0 9e 7d 52 f6 fa 33 fe f7 9a 66 ca 5f |,....}R..3...f._| 14 | 000000c0 a3 28 e9 80 21 28 b8 ef e9 9f 1e 26 9c cf 0f |.(..!(.....&...| 15 | >>> Flow 2 (server to client) 16 | 00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| 17 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 18 | 00000020 00 00 00 00 00 00 00 00 00 00 00 20 49 01 f7 fc |........... I...| 19 | 00000030 ce 52 3e f4 58 60 56 7d 36 21 ba 23 87 21 f7 36 |.R>.X`V}6!.#.!.6| 20 | 00000040 48 88 22 78 26 37 27 a4 fc 7a 8b ea 13 03 00 00 |H."x&7'..z......| 21 | 00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| 22 | 00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| 23 | 00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| 24 | 00000080 03 03 00 01 01 17 03 03 00 17 f9 df 7b 4f f9 a1 |............{O..| 25 | 00000090 f7 78 eb 10 59 5c 4f ed 42 09 08 10 0f c7 a4 81 |.x..Y\O.B.......| 26 | 000000a0 8b 17 03 03 01 50 38 d7 96 35 05 7d 3d 3a 60 02 |.....P8..5.}=:`.| 27 | 000000b0 bf 93 37 f2 60 3e 64 cb 1a 6f 9c 69 af 06 ca 70 |..7.`>d..o.i...p| 28 | 000000c0 94 e2 d1 7f 4a 5d c7 57 0e 11 c7 4e 24 c6 ba 57 |....J].W...N$..W| 29 | 000000d0 9f d7 67 3a 0a 8b 93 08 d4 de c5 be 62 79 61 2a |..g:........bya*| 30 | 000000e0 3d 4e 57 f9 98 e5 4f 5e 5a 74 52 5b a4 d0 07 ae |=NW...O^ZtR[....| 31 | 000000f0 8c 2a cb 50 dd b3 76 ab 3a 61 5b 55 83 8e 37 8d |.*.P..v.:a[U..7.| 32 | 00000100 39 e5 4f 58 7e 7a bc 80 26 f6 0f 47 8f 11 55 77 |9.OX~z..&..G..Uw| 33 | 00000110 24 b1 a7 06 d8 d2 30 82 0d 99 39 04 5f 97 d8 1d |$.....0...9._...| 34 | 00000120 99 67 99 89 f0 ee 4f 18 8b 49 24 d3 6a d0 65 c9 |.g....O..I$.j.e.| 35 | 00000130 01 a2 48 54 8b d2 bb 56 d4 0a 73 62 88 fa 70 4e |..HT...V..sb..pN| 36 | 00000140 7f dd 59 5b 14 7b 28 02 07 75 01 4d 41 ab 1d 7e |..Y[.{(..u.MA..~| 37 | 00000150 ef 24 42 ee 85 7f fa 5f 9e f0 9f f2 7f 92 00 52 |.$B...._.......R| 38 | 00000160 ca 73 8a 73 c6 d7 13 f5 9d 31 6f 76 75 db e7 53 |.s.s.....1ovu..S| 39 | 00000170 4d 44 40 8f 47 be bd 0e 71 13 d0 f7 f2 72 67 3a |MD@.G...q....rg:| 40 | 00000180 de b8 da b0 1d 84 85 d0 c2 c4 8d 16 87 68 c7 98 |.............h..| 41 | 00000190 40 0a 92 c8 fb 8a 3a e4 7b 34 43 47 b7 4f 28 8e |@.....:.{4CG.O(.| 42 | 000001a0 11 01 98 88 b6 cd ca aa d4 dc 52 5d f9 cf 55 bb |..........R]..U.| 43 | 000001b0 f3 13 f2 ce dc 67 74 a7 4d 5e 65 6f 18 cd 82 4e |.....gt.M^eo...N| 44 | 000001c0 fc 80 2c 14 17 99 08 6d 59 b3 3f 38 00 52 a2 a3 |..,....mY.?8.R..| 45 | 000001d0 c1 98 84 15 91 82 3f e9 47 82 12 a0 94 dc 19 9e |......?.G.......| 46 | 000001e0 2e b7 25 79 30 b9 81 d6 9f 33 8e 49 80 7a 4c a2 |..%y0....3.I.zL.| 47 | 000001f0 b7 9a e6 17 2c 06 17 03 03 00 59 97 c7 4b ac c3 |....,.....Y..K..| 48 | 00000200 ed b3 bd 82 7a c2 45 a0 18 70 7b 88 fe 8b fd 6b |....z.E..p{....k| 49 | 00000210 83 f2 dd 77 15 74 9c f0 a6 27 22 bf ee 25 53 07 |...w.t...'"..%S.| 50 | 00000220 81 95 3c 91 b3 89 3c ca f9 5b c7 cf bb 32 55 f8 |..<...<..[...2U.| 51 | 00000230 3c 76 70 f6 11 ca 5d 92 aa 78 9e 8a 2f ab e0 6f |>> Flow 3 (client to server) 68 | 00000000 14 03 03 00 01 01 17 03 03 00 35 19 fa 19 c0 ce |..........5.....| 69 | 00000010 09 87 c2 06 69 56 2a 0a a7 9c 79 76 03 1b 70 5e |....iV*...yv..p^| 70 | 00000020 56 2d d4 a1 09 e3 99 f7 a9 7a e5 ba 3e 17 8b b2 |V-.......z..>...| 71 | 00000030 fe da 70 81 d9 30 83 27 b1 da 2e df da 94 75 72 |..p..0.'......ur| 72 | >>> Flow 4 (server to client) 73 | 00000000 17 03 03 00 1e 83 53 ed 09 07 d3 87 ab 37 a2 08 |......S......7..| 74 | 00000010 a8 50 66 87 97 54 04 38 4b a6 25 f8 ab 75 ac 39 |.Pf..T.8K.%..u.9| 75 | 00000020 52 e2 8d 17 03 03 00 13 86 58 ef 44 c1 59 5e 2e |R........X.D.Y^.| 76 | 00000030 e4 2e df 93 6e 52 76 58 c1 9d 2a |....nRvX..*| 77 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv12-RSA-RSAPKCS1v15: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 59 01 00 00 55 03 03 60 c3 e9 6a 99 |....Y...U..`..j.| 3 | 00000010 72 7a 1c b9 1e 10 4b 9a 82 d5 ea b9 b0 6f 1e 05 |rz....K......o..| 4 | 00000020 74 a4 35 bb 71 c7 d2 56 87 b8 69 00 00 04 cc a8 |t.5.q..V..i.....| 5 | 00000030 00 ff 01 00 00 28 00 0b 00 04 03 00 01 02 00 0a |.....(..........| 6 | 00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| 7 | 00000050 00 00 00 17 00 00 00 0d 00 04 00 02 04 01 |..............| 8 | >>> Flow 2 (server to client) 9 | 00000000 16 03 03 00 37 02 00 00 33 03 03 00 00 00 00 00 |....7...3.......| 10 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 11 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 cc a8 00 00 |...DOWNGRD......| 12 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 03 02 |................| 13 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 14 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 15 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 16 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 17 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 18 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 19 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 20 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 21 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 22 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 23 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 24 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 25 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 26 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 27 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 28 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 29 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 30 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 31 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 32 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 33 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 34 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 35 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 36 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 37 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 38 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 39 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 40 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 41 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 42 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 43 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 44 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 45 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 46 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 47 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 48 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 49 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 50 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 ac 0c |.`.\!.;.........| 51 | 000002a0 00 00 a8 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 |...... /.}.G.bC.| 52 | 000002b0 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed |(.._.).0........| 53 | 000002c0 90 99 5f 58 cb 3b 74 04 01 00 80 4e c9 fd 39 89 |.._X.;t....N..9.| 54 | 000002d0 52 c1 6b ba 3b c9 02 35 89 e8 e3 f8 41 15 ee 6d |R.k.;..5....A..m| 55 | 000002e0 f6 08 6d 1a 47 aa 3b 5c 1d 9b 42 9b 50 85 af 56 |..m.G.;\..B.P..V| 56 | 000002f0 a3 99 78 84 7f 06 91 97 e9 33 0d 1d 9b 17 ce 3b |..x......3.....;| 57 | 00000300 30 f2 d0 10 1c b6 e2 7d fd b3 e1 bc 14 7a 1a 96 |0......}.....z..| 58 | 00000310 be b9 dc 0d 29 33 84 5f d1 77 91 0a a1 f2 2b cc |....)3._.w....+.| 59 | 00000320 dc 5e 9b f9 8b e3 34 d2 bd f3 46 b4 0d 97 de 44 |.^....4...F....D| 60 | 00000330 aa 83 10 82 bd ca 83 27 d0 40 a7 b1 64 15 dd 84 |.......'.@..d...| 61 | 00000340 5f 3c d9 62 42 0d 8f a6 19 0f b1 16 03 03 00 04 |_<.bB...........| 62 | 00000350 0e 00 00 00 |....| 63 | >>> Flow 3 (client to server) 64 | 00000000 16 03 03 00 25 10 00 00 21 20 82 3a 50 41 f7 b1 |....%...! .:PA..| 65 | 00000010 0f 97 ba 38 04 db f3 a6 ec 8b d1 db 06 c1 84 89 |...8............| 66 | 00000020 a0 53 84 92 27 a2 53 e8 5d 21 14 03 03 00 01 01 |.S..'.S.]!......| 67 | 00000030 16 03 03 00 20 7d 80 6d 7f a9 28 d6 0d 50 d6 b4 |.... }.m..(..P..| 68 | 00000040 24 d3 92 f8 0b 8e 6b d8 7c 64 9e 6c 87 a9 8e 37 |$.....k.|d.l...7| 69 | 00000050 9e 1b 0b 2d a5 |...-.| 70 | >>> Flow 4 (server to client) 71 | 00000000 14 03 03 00 01 01 16 03 03 00 20 e4 58 cf fb 81 |.......... .X...| 72 | 00000010 be dd 5b 98 97 bd bd 6a f0 76 92 b6 bb 2c 8f a3 |..[....j.v...,..| 73 | 00000020 e5 52 5b 1d f4 17 7b 2a a8 40 26 17 03 03 00 1d |.R[...{*.@&.....| 74 | 00000030 58 ef 4f 1d 98 0f 3d 59 88 df 6e ac c9 37 43 d5 |X.O...=Y..n..7C.| 75 | 00000040 f5 58 b3 7a 62 a3 7d 26 a2 a2 80 23 ef 15 03 03 |.X.zb.}&...#....| 76 | 00000050 00 12 05 b8 57 6a 80 71 b6 a4 58 94 15 f4 2f 0c |....Wj.q..X.../.| 77 | 00000060 8e 76 b2 aa |.v..| 78 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv12-RSA-RSAPSS: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 5b 01 00 00 57 03 03 e0 83 fd ef f8 |....[...W.......| 3 | 00000010 cb 41 23 14 36 21 07 eb 4e 01 7d 80 63 e4 b9 45 |.A#.6!..N.}.c..E| 4 | 00000020 f0 84 72 71 9b ac 60 49 6c 70 74 00 00 04 cc a8 |..rq..`Ilpt.....| 5 | 00000030 00 ff 01 00 00 2a 00 0b 00 04 03 00 01 02 00 0a |.....*..........| 6 | 00000040 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 00 16 |................| 7 | 00000050 00 00 00 17 00 00 00 0d 00 06 00 04 08 06 08 04 |................| 8 | >>> Flow 2 (server to client) 9 | 00000000 16 03 03 00 37 02 00 00 33 03 03 00 00 00 00 00 |....7...3.......| 10 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 11 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 cc a8 00 00 |...DOWNGRD......| 12 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 03 02 |................| 13 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 14 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 15 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 16 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 17 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 18 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 19 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 20 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 21 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 22 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 23 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 24 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 25 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 26 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 27 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 28 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 29 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 30 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 31 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 32 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 33 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 34 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 35 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 36 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 37 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 38 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 39 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 40 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 41 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 42 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 43 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 44 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 45 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 46 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 47 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 48 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 49 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 50 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 ac 0c |.`.\!.;.........| 51 | 000002a0 00 00 a8 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 |...... /.}.G.bC.| 52 | 000002b0 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed |(.._.).0........| 53 | 000002c0 90 99 5f 58 cb 3b 74 08 04 00 80 58 d3 5f 28 bc |.._X.;t....X._(.| 54 | 000002d0 50 79 b9 3d f1 ac a1 af 52 cd d3 fd e7 75 47 c3 |Py.=....R....uG.| 55 | 000002e0 65 3a 6f 62 22 c2 b5 cc 2b 22 f3 5d 3f b5 b6 9e |e:ob"...+".]?...| 56 | 000002f0 57 bf c7 4e 08 bd fb 5a 17 13 09 1a e9 6c b6 ce |W..N...Z.....l..| 57 | 00000300 b2 0e 88 ae ba a3 a0 b5 2c ff 51 b5 87 95 14 09 |........,.Q.....| 58 | 00000310 6d 9c 73 3f f0 c7 40 6b 4c ca 40 96 d6 44 96 d0 |m.s?..@kL.@..D..| 59 | 00000320 6f b1 a0 1c 4f 66 cc 9b 4f 85 98 3c 03 68 e3 a8 |o...Of..O..<.h..| 60 | 00000330 5b 28 04 fb 1e be 9e 2a 66 c1 6e f1 2e a4 20 08 |[(.....*f.n... .| 61 | 00000340 7e 11 78 7b fc c4 43 af 2a b4 8b 16 03 03 00 04 |~.x{..C.*.......| 62 | 00000350 0e 00 00 00 |....| 63 | >>> Flow 3 (client to server) 64 | 00000000 16 03 03 00 25 10 00 00 21 20 e2 54 7d 82 d2 8d |....%...! .T}...| 65 | 00000010 b8 d6 87 17 ec 2a 64 4e 15 6b b0 b3 01 66 b0 7d |.....*dN.k...f.}| 66 | 00000020 73 20 9f cb 30 9d 3c 27 ac 13 14 03 03 00 01 01 |s ..0.<'........| 67 | 00000030 16 03 03 00 20 fa a0 b7 eb ef 49 97 d5 da f0 9d |.... .....I.....| 68 | 00000040 85 a6 e6 67 f3 30 e8 f0 82 3a 7a c4 3f 76 f6 c5 |...g.0...:z.?v..| 69 | 00000050 8f d3 a5 65 f3 |...e.| 70 | >>> Flow 4 (server to client) 71 | 00000000 14 03 03 00 01 01 16 03 03 00 20 6b cf 58 e1 52 |.......... k.X.R| 72 | 00000010 e3 2c 05 e6 a3 05 c1 36 02 f0 90 63 bb 86 0f 54 |.,.....6...c...T| 73 | 00000020 61 d7 1a 31 7d bd 08 00 22 71 09 17 03 03 00 1d |a..1}..."q......| 74 | 00000030 4a 8e 05 28 e3 77 31 43 be ac 32 c6 af f2 7b 1c |J..(.w1C..2...{.| 75 | 00000040 ab 11 7f 32 5a 6a eb 76 ac c6 eb f1 dc 15 03 03 |...2Zj.v........| 76 | 00000050 00 12 3a f1 ee a3 6f bf 9b 9e 5e b8 20 76 84 bc |..:...o...^. v..| 77 | 00000060 1e 2e a0 87 |....| 78 | -------------------------------------------------------------------------------- /tls/ticket.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package tls 6 | 7 | import ( 8 | "bytes" 9 | "crypto/aes" 10 | "crypto/cipher" 11 | "crypto/hmac" 12 | "crypto/sha256" 13 | "crypto/subtle" 14 | "errors" 15 | "io" 16 | 17 | "golang.org/x/crypto/cryptobyte" 18 | ) 19 | 20 | // sessionState contains the information that is serialized into a session 21 | // ticket in order to later resume a connection. 22 | type sessionState struct { 23 | vers uint16 24 | cipherSuite uint16 25 | createdAt uint64 26 | masterSecret []byte // opaque master_secret<1..2^16-1>; 27 | // struct { opaque certificate<1..2^24-1> } Certificate; 28 | certificates [][]byte // Certificate certificate_list<0..2^24-1>; 29 | 30 | // usedOldKey is true if the ticket from which this session came from 31 | // was encrypted with an older key and thus should be refreshed. 32 | usedOldKey bool 33 | } 34 | 35 | func (m *sessionState) marshal() []byte { 36 | var b cryptobyte.Builder 37 | b.AddUint16(m.vers) 38 | b.AddUint16(m.cipherSuite) 39 | addUint64(&b, m.createdAt) 40 | b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { 41 | b.AddBytes(m.masterSecret) 42 | }) 43 | b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { 44 | for _, cert := range m.certificates { 45 | b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { 46 | b.AddBytes(cert) 47 | }) 48 | } 49 | }) 50 | return b.BytesOrPanic() 51 | } 52 | 53 | func (m *sessionState) unmarshal(data []byte) bool { 54 | *m = sessionState{usedOldKey: m.usedOldKey} 55 | s := cryptobyte.String(data) 56 | if ok := s.ReadUint16(&m.vers) && 57 | s.ReadUint16(&m.cipherSuite) && 58 | readUint64(&s, &m.createdAt) && 59 | readUint16LengthPrefixed(&s, &m.masterSecret) && 60 | len(m.masterSecret) != 0; !ok { 61 | return false 62 | } 63 | var certList cryptobyte.String 64 | if !s.ReadUint24LengthPrefixed(&certList) { 65 | return false 66 | } 67 | for !certList.Empty() { 68 | var cert []byte 69 | if !readUint24LengthPrefixed(&certList, &cert) { 70 | return false 71 | } 72 | m.certificates = append(m.certificates, cert) 73 | } 74 | return s.Empty() 75 | } 76 | 77 | // sessionStateTLS13 is the content of a TLS 1.3 session ticket. Its first 78 | // version (revision = 0) doesn't carry any of the information needed for 0-RTT 79 | // validation and the nonce is always empty. 80 | type sessionStateTLS13 struct { 81 | // uint8 version = 0x0304; 82 | // uint8 revision = 0; 83 | cipherSuite uint16 84 | createdAt uint64 85 | resumptionSecret []byte // opaque resumption_master_secret<1..2^8-1>; 86 | certificate Certificate // CertificateEntry certificate_list<0..2^24-1>; 87 | } 88 | 89 | func (m *sessionStateTLS13) marshal() []byte { 90 | var b cryptobyte.Builder 91 | b.AddUint16(VersionTLS13) 92 | b.AddUint8(0) // revision 93 | b.AddUint16(m.cipherSuite) 94 | addUint64(&b, m.createdAt) 95 | b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { 96 | b.AddBytes(m.resumptionSecret) 97 | }) 98 | marshalCertificate(&b, m.certificate) 99 | return b.BytesOrPanic() 100 | } 101 | 102 | func (m *sessionStateTLS13) unmarshal(data []byte) bool { 103 | *m = sessionStateTLS13{} 104 | s := cryptobyte.String(data) 105 | var version uint16 106 | var revision uint8 107 | return s.ReadUint16(&version) && 108 | version == VersionTLS13 && 109 | s.ReadUint8(&revision) && 110 | revision == 0 && 111 | s.ReadUint16(&m.cipherSuite) && 112 | readUint64(&s, &m.createdAt) && 113 | readUint8LengthPrefixed(&s, &m.resumptionSecret) && 114 | len(m.resumptionSecret) != 0 && 115 | unmarshalCertificate(&s, &m.certificate) && 116 | s.Empty() 117 | } 118 | 119 | func (c *Conn) encryptTicket(state []byte) ([]byte, error) { 120 | if len(c.ticketKeys) == 0 { 121 | return nil, errors.New("tls: internal error: session ticket keys unavailable") 122 | } 123 | 124 | encrypted := make([]byte, ticketKeyNameLen+aes.BlockSize+len(state)+sha256.Size) 125 | keyName := encrypted[:ticketKeyNameLen] 126 | iv := encrypted[ticketKeyNameLen : ticketKeyNameLen+aes.BlockSize] 127 | macBytes := encrypted[len(encrypted)-sha256.Size:] 128 | 129 | if _, err := io.ReadFull(c.config.rand(), iv); err != nil { 130 | return nil, err 131 | } 132 | key := c.ticketKeys[0] 133 | copy(keyName, key.keyName[:]) 134 | block, err := aes.NewCipher(key.aesKey[:]) 135 | if err != nil { 136 | return nil, errors.New("tls: failed to create cipher while encrypting ticket: " + err.Error()) 137 | } 138 | cipher.NewCTR(block, iv).XORKeyStream(encrypted[ticketKeyNameLen+aes.BlockSize:], state) 139 | 140 | mac := hmac.New(sha256.New, key.hmacKey[:]) 141 | mac.Write(encrypted[:len(encrypted)-sha256.Size]) 142 | mac.Sum(macBytes[:0]) 143 | 144 | return encrypted, nil 145 | } 146 | 147 | func (c *Conn) decryptTicket(encrypted []byte) (plaintext []byte, usedOldKey bool) { 148 | if len(encrypted) < ticketKeyNameLen+aes.BlockSize+sha256.Size { 149 | return nil, false 150 | } 151 | 152 | keyName := encrypted[:ticketKeyNameLen] 153 | iv := encrypted[ticketKeyNameLen : ticketKeyNameLen+aes.BlockSize] 154 | macBytes := encrypted[len(encrypted)-sha256.Size:] 155 | ciphertext := encrypted[ticketKeyNameLen+aes.BlockSize : len(encrypted)-sha256.Size] 156 | 157 | keyIndex := -1 158 | for i, candidateKey := range c.ticketKeys { 159 | if bytes.Equal(keyName, candidateKey.keyName[:]) { 160 | keyIndex = i 161 | break 162 | } 163 | } 164 | if keyIndex == -1 { 165 | return nil, false 166 | } 167 | key := &c.ticketKeys[keyIndex] 168 | 169 | mac := hmac.New(sha256.New, key.hmacKey[:]) 170 | mac.Write(encrypted[:len(encrypted)-sha256.Size]) 171 | expected := mac.Sum(nil) 172 | 173 | if subtle.ConstantTimeCompare(macBytes, expected) != 1 { 174 | return nil, false 175 | } 176 | 177 | block, err := aes.NewCipher(key.aesKey[:]) 178 | if err != nil { 179 | return nil, false 180 | } 181 | plaintext = make([]byte, len(ciphertext)) 182 | cipher.NewCTR(block, iv).XORKeyStream(plaintext, ciphertext) 183 | 184 | return plaintext, keyIndex > 0 185 | } 186 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv10-RSA-AES: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 63 01 00 00 5f 03 01 78 91 f6 ad 9e |....c..._..x....| 3 | 00000010 79 23 92 10 d9 c5 43 52 8f f6 f4 3f f4 eb ac 6b |y#....CR...?...k| 4 | 00000020 f3 ce a9 76 a2 bf c3 5b 9d bc 52 00 00 04 00 2f |...v...[..R..../| 5 | 00000030 00 ff 01 00 00 32 00 00 00 0e 00 0c 00 00 09 31 |.....2.........1| 6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| 8 | 00000060 00 16 00 00 00 17 00 00 |........| 9 | >>> Flow 2 (server to client) 10 | 00000000 16 03 01 00 37 02 00 00 33 03 01 00 00 00 00 00 |....7...3.......| 11 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 12 | 00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 2f 00 00 |...DOWNGRD.../..| 13 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 01 02 |................| 14 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 15 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 16 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 17 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 18 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 19 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 20 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 21 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 22 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 23 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 24 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 25 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 26 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 27 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 28 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 29 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 30 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 31 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 32 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 33 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 34 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 35 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 36 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 37 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 38 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 39 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 40 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 41 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 42 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 43 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 44 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 45 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 46 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 47 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 48 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 49 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 50 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 51 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 01 00 04 0e |.`.\!.;.........| 52 | 000002a0 00 00 00 |...| 53 | >>> Flow 3 (client to server) 54 | 00000000 16 03 01 00 86 10 00 00 82 00 80 73 aa be d1 21 |...........s...!| 55 | 00000010 67 e9 9c 20 40 cf 0a 47 31 61 e9 2b ba 06 4f aa |g.. @..G1a.+..O.| 56 | 00000020 ce 15 6a b7 df 0d 0e b0 fe b5 f2 c0 26 81 39 6e |..j.........&.9n| 57 | 00000030 5b 96 3c 2f 42 4f 08 92 48 a3 95 c8 ad 0d 0e 8f |[....2.>....| 62 | 00000080 36 99 9f b7 53 ef 34 e8 d6 13 3b 14 03 01 00 01 |6...S.4...;.....| 63 | 00000090 01 16 03 01 00 30 c6 d2 a6 85 cf 2a e4 9e 9e e1 |.....0.....*....| 64 | 000000a0 d0 82 d0 2a f8 e5 bd f6 9a 67 0b c6 47 07 9c 14 |...*.....g..G...| 65 | 000000b0 7e 73 9e 4c 8b d2 55 4f b2 32 9a 16 16 a5 e8 25 |~s.L..UO.2.....%| 66 | 000000c0 62 e2 e9 88 b6 44 |b....D| 67 | >>> Flow 4 (server to client) 68 | 00000000 14 03 01 00 01 01 16 03 01 00 30 21 7a ee 62 6a |..........0!z.bj| 69 | 00000010 20 39 2a 39 d1 d3 f7 bd 53 05 4f 1a 36 71 3b b6 | 9*9....S.O.6q;.| 70 | 00000020 c5 5a b7 3b c3 0b 3f b9 2f ac 62 1c c2 2f fa 29 |.Z.;..?./.b../.)| 71 | 00000030 dd f3 bc ff 35 28 7f 86 b8 0f 33 17 03 01 00 20 |....5(....3.... | 72 | 00000040 3a 6c 47 23 37 5a 15 bd 03 c6 64 c5 59 2f 91 e8 |:lG#7Z....d.Y/..| 73 | 00000050 a6 1b d5 04 c2 a7 80 0e 94 6c 3c e4 70 2c ea 81 |.........l<.p,..| 74 | 00000060 17 03 01 00 30 60 14 bc 6b 84 16 9f 53 b6 ee c9 |....0`..k...S...| 75 | 00000070 43 cf f3 46 97 45 e1 2f 86 96 26 cc ef ea 09 72 |C..F.E./..&....r| 76 | 00000080 36 92 4e 9e 2a 8e a2 d7 9a cd 5f 38 a8 07 c4 54 |6.N.*....._8...T| 77 | 00000090 a1 4d 6e 7a 36 15 03 01 00 20 1e c2 df a3 3e 8e |.Mnz6.... ....>.| 78 | 000000a0 15 c4 c0 90 8f 7c 5a e0 68 d7 ea 86 76 8d d1 27 |.....|Z.h...v..'| 79 | 000000b0 c1 d9 32 55 f9 ce f5 92 e6 51 |..2U.....Q| 80 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv12-RSA-3DES: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 97 01 00 00 93 03 03 e2 8f 43 82 4c |.............C.L| 3 | 00000010 13 33 88 d2 53 5d b6 02 d2 b6 b2 a1 11 f0 30 14 |.3..S]........0.| 4 | 00000020 41 1e 8c 79 85 38 75 cd e8 a6 a7 00 00 04 00 0a |A..y.8u.........| 5 | 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| 6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| 8 | 00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....| 9 | 00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................| 10 | 00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................| 11 | 00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............| 12 | >>> Flow 2 (server to client) 13 | 00000000 16 03 03 00 37 02 00 00 33 03 03 00 00 00 00 00 |....7...3.......| 14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 0a 00 00 |...DOWNGRD......| 16 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 03 02 |................| 17 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 18 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 19 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 20 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 21 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 22 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 23 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 24 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 25 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 26 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 27 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 28 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 29 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 30 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 31 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 32 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 33 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 34 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 35 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 36 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 37 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 38 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 39 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 40 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 41 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 42 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 43 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 44 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 45 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 46 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 47 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 48 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 49 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 50 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 51 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 52 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 53 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 54 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 04 0e |.`.\!.;.........| 55 | 000002a0 00 00 00 |...| 56 | >>> Flow 3 (client to server) 57 | 00000000 16 03 03 00 86 10 00 00 82 00 80 57 ce 41 c0 4d |...........W.A.M| 58 | 00000010 b1 69 27 6e cb 92 a5 71 52 85 e7 a8 69 b0 31 d1 |.i'n...qR...i.1.| 59 | 00000020 0a b0 3d a6 9d ab 04 e8 a2 4c d8 67 95 97 da 63 |..=......L.g...c| 60 | 00000030 f7 0b 6e 62 29 5b 8b cf 77 f1 80 a5 1f 67 08 71 |..nb)[..w....g.q| 61 | 00000040 50 c3 a9 90 ea b8 11 3d 5d c9 f5 1c 37 fa 67 b1 |P......=]...7.g.| 62 | 00000050 64 b0 04 3e c1 0d db 77 fe b9 a0 ea f2 0f 1d af |d..>...w........| 63 | 00000060 9a 77 b3 96 4f 3f 3c 52 a7 ed c4 3f 48 ef ff f8 |.w..O?>> Flow 4 (server to client) 71 | 00000000 14 03 03 00 01 01 16 03 03 00 30 00 00 00 00 00 |..........0.....| 72 | 00000010 00 00 00 0d 0f 3c 6a 28 f0 97 90 1a c3 7e c8 63 |...........su.| 78 | 00000070 15 03 03 00 20 00 00 00 00 00 00 00 00 5c 30 63 |.... ........\0c| 79 | 00000080 23 55 26 ee 8d 81 9a 2e b4 e7 38 6b 04 e7 42 43 |#U&.......8k..BC| 80 | 00000090 50 de 1e 40 2d |P..@-| 81 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv10-ECDHE-ECDSA-AES: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 63 01 00 00 5f 03 01 38 de f5 d6 ae |....c..._..8....| 3 | 00000010 46 71 e8 02 f2 45 88 b8 64 fb 6e 68 67 d1 7f e8 |Fq...E..d.nhg...| 4 | 00000020 49 71 1e a9 ec 8e 54 06 bb 2b 16 00 00 04 c0 0a |Iq....T..+......| 5 | 00000030 00 ff 01 00 00 32 00 00 00 0e 00 0c 00 00 09 31 |.....2.........1| 6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| 8 | 00000060 00 16 00 00 00 17 00 00 |........| 9 | >>> Flow 2 (server to client) 10 | 00000000 16 03 01 00 37 02 00 00 33 03 01 00 00 00 00 00 |....7...3.......| 11 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 12 | 00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 c0 0a 00 00 |...DOWNGRD......| 13 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 01 02 |................| 14 | 00000040 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 00 30 |...........0...0| 15 | 00000050 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 30 09 |..b.....-G....0.| 16 | 00000060 06 07 2a 86 48 ce 3d 04 01 30 45 31 0b 30 09 06 |..*.H.=..0E1.0..| 17 | 00000070 03 55 04 06 13 02 41 55 31 13 30 11 06 03 55 04 |.U....AU1.0...U.| 18 | 00000080 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 |...Some-State1!0| 19 | 00000090 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 |...U....Internet| 20 | 000000a0 20 57 69 64 67 69 74 73 20 50 74 79 20 4c 74 64 | Widgits Pty Ltd| 21 | 000000b0 30 1e 17 0d 31 32 31 31 32 32 31 35 30 36 33 32 |0...121122150632| 22 | 000000c0 5a 17 0d 32 32 31 31 32 30 31 35 30 36 33 32 5a |Z..221120150632Z| 23 | 000000d0 30 45 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 |0E1.0...U....AU1| 24 | 000000e0 13 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 |.0...U....Some-S| 25 | 000000f0 74 61 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 |tate1!0...U....I| 26 | 00000100 6e 74 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 |nternet Widgits | 27 | 00000110 50 74 79 20 4c 74 64 30 81 9b 30 10 06 07 2a 86 |Pty Ltd0..0...*.| 28 | 00000120 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 86 00 |H.=....+...#....| 29 | 00000130 04 00 c4 a1 ed be 98 f9 0b 48 73 36 7e c3 16 56 |.........Hs6~..V| 30 | 00000140 11 22 f2 3d 53 c3 3b 4d 21 3d cd 6b 75 e6 f6 b0 |.".=S.;M!=.ku...| 31 | 00000150 dc 9a df 26 c1 bc b2 87 f0 72 32 7c b3 64 2f 1c |...&.....r2|.d/.| 32 | 00000160 90 bc ea 68 23 10 7e fe e3 25 c0 48 3a 69 e0 28 |...h#.~..%.H:i.(| 33 | 00000170 6d d3 37 00 ef 04 62 dd 0d a0 9c 70 62 83 d8 81 |m.7...b....pb...| 34 | 00000180 d3 64 31 aa 9e 97 31 bd 96 b0 68 c0 9b 23 de 76 |.d1...1...h..#.v| 35 | 00000190 64 3f 1a 5c 7f e9 12 0e 58 58 b6 5f 70 dd 9b d8 |d?.\....XX._p...| 36 | 000001a0 ea d5 d7 f5 d5 cc b9 b6 9f 30 66 5b 66 9a 20 e2 |.........0f[f. .| 37 | 000001b0 27 e5 bf fe 3b 30 09 06 07 2a 86 48 ce 3d 04 01 |'...;0...*.H.=..| 38 | 000001c0 03 81 8c 00 30 81 88 02 42 01 88 a2 4f eb e2 45 |....0...B...O..E| 39 | 000001d0 c5 48 7d 1b ac f5 ed 98 9d ae 47 70 c0 5e 1b b6 |.H}.......Gp.^..| 40 | 000001e0 2f bd f1 b6 4d b7 61 40 d3 11 a2 ce ee 0b 7e 92 |/...M.a@......~.| 41 | 000001f0 7e ff 76 9d c3 3b 7e a5 3f ce fa 10 e2 59 ec 47 |~.v..;~.?....Y.G| 42 | 00000200 2d 7c ac da 4e 97 0e 15 a0 6f d0 02 42 01 4d fc |-|..N....o..B.M.| 43 | 00000210 be 67 13 9c 2d 05 0e bd 3f a3 8c 25 c1 33 13 83 |.g..-...?..%.3..| 44 | 00000220 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd d7 11 |.....7z..z......| 45 | 00000230 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d ae cb |i..|V..1x+..x...| 46 | 00000240 be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f 2a 16 |..N6$1{j.9....*.| 47 | 00000250 03 01 00 b5 0c 00 00 b1 03 00 1d 20 2f e5 7d a3 |........... /.}.| 48 | 00000260 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| 49 | 00000270 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 00 8b 30 81 |......._X.;t..0.| 50 | 00000280 88 02 42 01 ad 26 fd 16 9a 93 5f 87 ce 29 8c d2 |..B..&...._..)..| 51 | 00000290 56 a7 d2 59 56 bd d3 1f 90 54 bd af 91 81 25 ff |V..YV....T....%.| 52 | 000002a0 66 74 57 16 2f 31 f2 5a 48 97 03 b9 41 4c 8e bb |ftW./1.ZH...AL..| 53 | 000002b0 87 31 ed 71 84 37 63 78 9f 0a c7 9d 5e f3 5a 53 |.1.q.7cx....^.ZS| 54 | 000002c0 88 89 46 ba a7 02 42 00 92 74 15 1c 0e 1f 2f 95 |..F...B..t..../.| 55 | 000002d0 e5 79 d5 e9 90 ce d8 96 0d fd b8 42 55 00 94 08 |.y.........BU...| 56 | 000002e0 4e 47 a9 ea bd 67 0b 02 a6 9e 8b d3 09 e5 53 ea |NG...g........S.| 57 | 000002f0 03 22 2e 2d 78 2c 69 1d 28 ab 13 3d 0a 46 15 09 |.".-x,i.(..=.F..| 58 | 00000300 b6 0b 74 69 2d 5a 96 bf b6 16 03 01 00 04 0e 00 |..ti-Z..........| 59 | 00000310 00 00 |..| 60 | >>> Flow 3 (client to server) 61 | 00000000 16 03 01 00 25 10 00 00 21 20 82 c0 dd 83 c2 45 |....%...! .....E| 62 | 00000010 a2 bc 3a 2a ec ab 60 8e 02 e0 db 7c 59 83 c1 62 |..:*..`....|Y..b| 63 | 00000020 c7 cc 61 1e de dc 40 e4 65 6c 14 03 01 00 01 01 |..a...@.el......| 64 | 00000030 16 03 01 00 30 3e 26 56 0b a2 10 47 00 55 27 21 |....0>&V...G.U'!| 65 | 00000040 63 33 f2 7d 4b ba 77 5f e7 a7 09 7a 1f 51 85 f2 |c3.}K.w_...z.Q..| 66 | 00000050 46 a5 af 80 79 1a c7 72 bb 3d f9 dd 1d 83 05 22 |F...y..r.=....."| 67 | 00000060 c9 6c dd 91 d9 |.l...| 68 | >>> Flow 4 (server to client) 69 | 00000000 14 03 01 00 01 01 16 03 01 00 30 38 fa fd 42 8f |..........08..B.| 70 | 00000010 80 5a 7c 33 d4 6c 72 f7 4e 2f 00 ab c2 86 58 9d |.Z|3.lr.N/....X.| 71 | 00000020 fc a5 43 fa ea 5b a1 ee a9 df df 9d 90 4c c0 e3 |..C..[.......L..| 72 | 00000030 10 09 c4 23 21 f9 e9 69 f5 f8 fa 17 03 01 00 20 |...#!..i....... | 73 | 00000040 1e 57 17 e4 96 06 32 d4 00 a3 98 ed bd 1c 61 78 |.W....2.......ax| 74 | 00000050 e7 0d 89 ec 84 c3 56 fa 75 73 87 6f 47 35 80 3f |......V.us.oG5.?| 75 | 00000060 17 03 01 00 30 4d 51 0a dd 70 6d b0 c2 d1 46 5c |....0MQ..pm...F\| 76 | 00000070 b5 03 87 de e6 65 d3 e2 83 e0 33 f8 a2 0a 29 7f |.....e....3...).| 77 | 00000080 6c 24 2b 1f 7b 2b 53 19 21 e9 62 6c 31 75 9c be |l$+.{+S.!.bl1u..| 78 | 00000090 5b b0 3d 5b 1a 15 03 01 00 20 19 51 64 4b 5a 9b |[.=[..... .QdKZ.| 79 | 000000a0 c8 2a 1c e7 9e 29 d9 df ad 1d 08 09 82 a3 b1 1d |.*...)..........| 80 | 000000b0 60 99 00 25 30 51 a1 72 b6 27 |`..%0Q.r.'| 81 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv12-X25519: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 8f 01 00 00 8b 03 03 5d ff d6 27 db |...........]..'.| 3 | 00000010 3b e5 2b 79 3a a6 cf 75 3d f7 c9 d9 0a d4 8c b2 |;.+y:..u=.......| 4 | 00000020 af 3c 29 84 65 a2 d6 98 52 e2 eb 00 00 04 c0 2f |.<).e...R....../| 5 | 00000030 00 ff 01 00 00 5e 00 00 00 0e 00 0c 00 00 09 31 |.....^.........1| 6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 7 | 00000050 00 0a 00 04 00 02 00 1d 00 16 00 00 00 17 00 00 |................| 8 | 00000060 00 0d 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 |...0............| 9 | 00000070 08 09 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 |................| 10 | 00000080 06 01 03 03 02 03 03 01 02 01 03 02 02 02 04 02 |................| 11 | 00000090 05 02 06 02 |....| 12 | >>> Flow 2 (server to client) 13 | 00000000 16 03 03 00 37 02 00 00 33 03 03 00 00 00 00 00 |....7...3.......| 14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 2f 00 00 |...DOWNGRD.../..| 16 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 03 02 |................| 17 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 18 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 19 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 20 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 21 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 22 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 23 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 24 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 25 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 26 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 27 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 28 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 29 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 30 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 31 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 32 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 33 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 34 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 35 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 36 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 37 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 38 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 39 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 40 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 41 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 42 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 43 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 44 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 45 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 46 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 47 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 48 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 49 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 50 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 51 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 52 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 53 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 54 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 ac 0c |.`.\!.;.........| 55 | 000002a0 00 00 a8 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 |...... /.}.G.bC.| 56 | 000002b0 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed |(.._.).0........| 57 | 000002c0 90 99 5f 58 cb 3b 74 08 04 00 80 73 d6 a4 35 5f |.._X.;t....s..5_| 58 | 000002d0 3f 46 ad de 81 13 a8 d9 21 17 25 37 61 cb 62 0d |?F......!.%7a.b.| 59 | 000002e0 e2 bf 95 51 0e 9e e7 b1 ab bc be f6 ec 80 b1 f4 |...Q............| 60 | 000002f0 3e 9c 69 3f c8 1e a4 02 82 fd 57 01 e7 0c 18 be |>.i?......W.....| 61 | 00000300 c6 1b 01 68 cb ef dc d8 16 92 fb 1b 07 fd 98 f8 |...h............| 62 | 00000310 00 77 a9 8e 71 2a e0 6c 68 d5 83 f9 36 c3 3b 99 |.w..q*.lh...6.;.| 63 | 00000320 44 98 a0 96 00 1a 02 95 c5 7c ea ae 51 81 89 94 |D........|..Q...| 64 | 00000330 57 b6 37 c5 88 56 9f 49 bf 36 26 48 08 36 a1 69 |W.7..V.I.6&H.6.i| 65 | 00000340 48 a2 c4 b2 6f 0f 43 70 91 1e 8a 16 03 03 00 04 |H...o.Cp........| 66 | 00000350 0e 00 00 00 |....| 67 | >>> Flow 3 (client to server) 68 | 00000000 16 03 03 00 25 10 00 00 21 20 0a 1b 78 c4 bb eb |....%...! ..x...| 69 | 00000010 a4 01 33 3b 69 95 c2 06 5d c9 3e b3 13 51 4b 93 |..3;i...].>..QK.| 70 | 00000020 5e 3c 3e a7 42 12 22 e8 7e 49 14 03 03 00 01 01 |^<>.B.".~I......| 71 | 00000030 16 03 03 00 28 fc c7 a1 45 50 e0 fe 27 fd ac a4 |....(...EP..'...| 72 | 00000040 d8 a2 c6 54 df e1 d3 6f e7 d8 45 a6 57 16 2f 1f |...T...o..E.W./.| 73 | 00000050 cf 89 26 c6 0a c3 4f 63 df ac bc c9 79 |..&...Oc....y| 74 | >>> Flow 4 (server to client) 75 | 00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| 76 | 00000010 00 00 00 37 25 28 76 4e 31 dd 5e b0 5b 39 87 fc |...7%(vN1.^.[9..| 77 | 00000020 0f 10 3c bc 6d 12 9a dd 59 89 0b 09 bc f2 2c d8 |..<.m...Y.....,.| 78 | 00000030 05 a7 77 17 03 03 00 25 00 00 00 00 00 00 00 01 |..w....%........| 79 | 00000040 fe 79 9d dd d9 e3 bc 48 47 65 30 64 c7 74 82 0a |.y.....HGe0d.t..| 80 | 00000050 9f b7 45 a2 62 40 b5 dd 79 b9 ce 06 83 15 03 03 |..E.b@..y.......| 81 | 00000060 00 1a 00 00 00 00 00 00 00 02 58 ed 37 40 33 e4 |..........X.7@3.| 82 | 00000070 75 f0 a6 fa 14 f5 6b 93 9e 54 f2 a4 |u.....k..T..| 83 | -------------------------------------------------------------------------------- /tls/prf_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package tls 6 | 7 | import ( 8 | "encoding/hex" 9 | "testing" 10 | ) 11 | 12 | type testSplitPreMasterSecretTest struct { 13 | in, out1, out2 string 14 | } 15 | 16 | var testSplitPreMasterSecretTests = []testSplitPreMasterSecretTest{ 17 | {"", "", ""}, 18 | {"00", "00", "00"}, 19 | {"0011", "00", "11"}, 20 | {"001122", "0011", "1122"}, 21 | {"00112233", "0011", "2233"}, 22 | } 23 | 24 | func TestSplitPreMasterSecret(t *testing.T) { 25 | for i, test := range testSplitPreMasterSecretTests { 26 | in, _ := hex.DecodeString(test.in) 27 | out1, out2 := splitPreMasterSecret(in) 28 | s1 := hex.EncodeToString(out1) 29 | s2 := hex.EncodeToString(out2) 30 | if s1 != test.out1 || s2 != test.out2 { 31 | t.Errorf("#%d: got: (%s, %s) want: (%s, %s)", i, s1, s2, test.out1, test.out2) 32 | } 33 | } 34 | } 35 | 36 | type testKeysFromTest struct { 37 | version uint16 38 | suite *cipherSuite 39 | preMasterSecret string 40 | clientRandom, serverRandom string 41 | masterSecret string 42 | clientMAC, serverMAC string 43 | clientKey, serverKey string 44 | macLen, keyLen int 45 | contextKeyingMaterial, noContextKeyingMaterial string 46 | } 47 | 48 | func TestKeysFromPreMasterSecret(t *testing.T) { 49 | for i, test := range testKeysFromTests { 50 | in, _ := hex.DecodeString(test.preMasterSecret) 51 | clientRandom, _ := hex.DecodeString(test.clientRandom) 52 | serverRandom, _ := hex.DecodeString(test.serverRandom) 53 | 54 | masterSecret := masterFromPreMasterSecret(test.version, test.suite, in, clientRandom, serverRandom) 55 | if s := hex.EncodeToString(masterSecret); s != test.masterSecret { 56 | t.Errorf("#%d: bad master secret %s, want %s", i, s, test.masterSecret) 57 | continue 58 | } 59 | 60 | clientMAC, serverMAC, clientKey, serverKey, _, _ := keysFromMasterSecret(test.version, test.suite, masterSecret, clientRandom, serverRandom, test.macLen, test.keyLen, 0) 61 | clientMACString := hex.EncodeToString(clientMAC) 62 | serverMACString := hex.EncodeToString(serverMAC) 63 | clientKeyString := hex.EncodeToString(clientKey) 64 | serverKeyString := hex.EncodeToString(serverKey) 65 | if clientMACString != test.clientMAC || 66 | serverMACString != test.serverMAC || 67 | clientKeyString != test.clientKey || 68 | serverKeyString != test.serverKey { 69 | t.Errorf("#%d: got: (%s, %s, %s, %s) want: (%s, %s, %s, %s)", i, clientMACString, serverMACString, clientKeyString, serverKeyString, test.clientMAC, test.serverMAC, test.clientKey, test.serverKey) 70 | } 71 | 72 | ekm := ekmFromMasterSecret(test.version, test.suite, masterSecret, clientRandom, serverRandom) 73 | contextKeyingMaterial, err := ekm("label", []byte("context"), 32) 74 | if err != nil { 75 | t.Fatalf("ekmFromMasterSecret failed: %v", err) 76 | } 77 | 78 | noContextKeyingMaterial, err := ekm("label", nil, 32) 79 | if err != nil { 80 | t.Fatalf("ekmFromMasterSecret failed: %v", err) 81 | } 82 | 83 | if hex.EncodeToString(contextKeyingMaterial) != test.contextKeyingMaterial || 84 | hex.EncodeToString(noContextKeyingMaterial) != test.noContextKeyingMaterial { 85 | t.Errorf("#%d: got keying material: (%s, %s) want: (%s, %s)", i, contextKeyingMaterial, noContextKeyingMaterial, test.contextKeyingMaterial, test.noContextKeyingMaterial) 86 | } 87 | } 88 | } 89 | 90 | // These test vectors were generated from GnuTLS using `gnutls-cli --insecure -d 9 ` 91 | var testKeysFromTests = []testKeysFromTest{ 92 | { 93 | VersionTLS10, 94 | cipherSuiteByID(TLS_RSA_WITH_RC4_128_SHA), 95 | "0302cac83ad4b1db3b9ab49ad05957de2a504a634a386fc600889321e1a971f57479466830ac3e6f468e87f5385fa0c5", 96 | "4ae66303755184a3917fcb44880605fcc53baa01912b22ed94473fc69cebd558", 97 | "4ae663020ec16e6bb5130be918cfcafd4d765979a3136a5d50c593446e4e44db", 98 | "3d851bab6e5556e959a16bc36d66cfae32f672bfa9ecdef6096cbb1b23472df1da63dbbd9827606413221d149ed08ceb", 99 | "805aaa19b3d2c0a0759a4b6c9959890e08480119", 100 | "2d22f9fe519c075c16448305ceee209fc24ad109", 101 | "d50b5771244f850cd8117a9ccafe2cf1", 102 | "e076e33206b30507a85c32855acd0919", 103 | 20, 104 | 16, 105 | "4d1bb6fc278c37d27aa6e2a13c2e079095d143272c2aa939da33d88c1c0cec22", 106 | "93fba89599b6321ae538e27c6548ceb8b46821864318f5190d64a375e5d69d41", 107 | }, 108 | { 109 | VersionTLS10, 110 | cipherSuiteByID(TLS_RSA_WITH_RC4_128_SHA), 111 | "03023f7527316bc12cbcd69e4b9e8275d62c028f27e65c745cfcddc7ce01bd3570a111378b63848127f1c36e5f9e4890", 112 | "4ae66364b5ea56b20ce4e25555aed2d7e67f42788dd03f3fee4adae0459ab106", 113 | "4ae66363ab815cbf6a248b87d6b556184e945e9b97fbdf247858b0bdafacfa1c", 114 | "7d64be7c80c59b740200b4b9c26d0baaa1c5ae56705acbcf2307fe62beb4728c19392c83f20483801cce022c77645460", 115 | "97742ed60a0554ca13f04f97ee193177b971e3b0", 116 | "37068751700400e03a8477a5c7eec0813ab9e0dc", 117 | "207cddbc600d2a200abac6502053ee5c", 118 | "df3f94f6e1eacc753b815fe16055cd43", 119 | 20, 120 | 16, 121 | "2c9f8961a72b97cbe76553b5f954caf8294fc6360ef995ac1256fe9516d0ce7f", 122 | "274f19c10291d188857ad8878e2119f5aa437d4da556601cf1337aff23154016", 123 | }, 124 | { 125 | VersionTLS10, 126 | cipherSuiteByID(TLS_RSA_WITH_RC4_128_SHA), 127 | "832d515f1d61eebb2be56ba0ef79879efb9b527504abb386fb4310ed5d0e3b1f220d3bb6b455033a2773e6d8bdf951d278a187482b400d45deb88a5d5a6bb7d6a7a1decc04eb9ef0642876cd4a82d374d3b6ff35f0351dc5d411104de431375355addc39bfb1f6329fb163b0bc298d658338930d07d313cd980a7e3d9196cac1", 128 | "4ae663b2ee389c0de147c509d8f18f5052afc4aaf9699efe8cb05ece883d3a5e", 129 | "4ae664d503fd4cff50cfc1fb8fc606580f87b0fcdac9554ba0e01d785bdf278e", 130 | "1aff2e7a2c4279d0126f57a65a77a8d9d0087cf2733366699bec27eb53d5740705a8574bb1acc2abbe90e44f0dd28d6c", 131 | "3c7647c93c1379a31a609542aa44e7f117a70085", 132 | "0d73102994be74a575a3ead8532590ca32a526d4", 133 | "ac7581b0b6c10d85bbd905ffbf36c65e", 134 | "ff07edde49682b45466bd2e39464b306", 135 | 20, 136 | 16, 137 | "678b0d43f607de35241dc7e9d1a7388a52c35033a1a0336d4d740060a6638fe2", 138 | "f3b4ac743f015ef21d79978297a53da3e579ee047133f38c234d829c0f907dab", 139 | }, 140 | } 141 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv12-RSA-AES-GCM: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 97 01 00 00 93 03 03 8a ca f1 8f ad |................| 3 | 00000010 fe 0b a3 e1 b8 08 10 1a 40 57 b6 f7 f7 e3 72 c4 |........@W....r.| 4 | 00000020 57 4a 71 f8 30 cd 62 62 c7 0f 2d 00 00 04 c0 2f |WJq.0.bb..-..../| 5 | 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| 6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| 8 | 00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....| 9 | 00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................| 10 | 00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................| 11 | 00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............| 12 | >>> Flow 2 (server to client) 13 | 00000000 16 03 03 00 37 02 00 00 33 03 03 00 00 00 00 00 |....7...3.......| 14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 2f 00 00 |...DOWNGRD.../..| 16 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 03 02 |................| 17 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 18 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 19 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 20 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 21 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 22 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 23 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 24 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 25 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 26 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 27 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 28 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 29 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 30 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 31 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 32 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 33 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 34 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 35 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 36 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 37 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 38 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 39 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 40 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 41 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 42 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 43 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 44 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 45 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 46 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 47 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 48 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 49 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 50 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 51 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 52 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 53 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 54 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 ac 0c |.`.\!.;.........| 55 | 000002a0 00 00 a8 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 |...... /.}.G.bC.| 56 | 000002b0 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed |(.._.).0........| 57 | 000002c0 90 99 5f 58 cb 3b 74 08 04 00 80 50 0b d9 1c 03 |.._X.;t....P....| 58 | 000002d0 6f 08 05 a6 39 cc 9f 7e 3d f1 fb af 8e 0b 9a ef |o...9..~=.......| 59 | 000002e0 39 d3 b6 e3 71 9c 5a 37 a1 86 f2 f0 59 01 fc b2 |9...q.Z7....Y...| 60 | 000002f0 51 1c 0e 22 42 24 3e c6 db fb a1 39 9d 75 f4 79 |Q.."B$>....9.u.y| 61 | 00000300 55 dd e5 99 0b 22 5b ed c7 19 ac db ed d3 ee 23 |U...."[........#| 62 | 00000310 b9 37 2b 51 ea 7f 39 4d 8b 0a bc a2 2e f2 ef 9e |.7+Q..9M........| 63 | 00000320 a5 8c 99 77 ff d2 fb 46 e4 10 4e a9 b2 a9 ce b6 |...w...F..N.....| 64 | 00000330 50 d4 0a 28 a5 3f 0e 2c 60 cd 0f 07 9c 7e 60 c3 |P..(.?.,`....~`.| 65 | 00000340 79 a5 cf f3 cd 77 5a 16 8d fc 14 16 03 03 00 04 |y....wZ.........| 66 | 00000350 0e 00 00 00 |....| 67 | >>> Flow 3 (client to server) 68 | 00000000 16 03 03 00 25 10 00 00 21 20 ef 3b b1 d2 a3 f6 |....%...! .;....| 69 | 00000010 be f2 fc 2e b5 ed d3 ec 6a fb 2f 0d 5a 04 98 61 |........j./.Z..a| 70 | 00000020 92 26 59 ba 17 26 1b 60 27 2b 14 03 03 00 01 01 |.&Y..&.`'+......| 71 | 00000030 16 03 03 00 28 e2 94 22 bb 71 70 c8 a6 63 e5 6f |....(..".qp..c.o| 72 | 00000040 2e 00 0f b9 bf 6b 54 34 dc ce b0 12 0b 16 e5 ac |.....kT4........| 73 | 00000050 8f 6b 1e 96 a1 e3 86 b7 6f 8c 76 09 da |.k......o.v..| 74 | >>> Flow 4 (server to client) 75 | 00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| 76 | 00000010 00 00 00 f5 dc 00 28 06 03 50 9b b2 db 4d 89 25 |......(..P...M.%| 77 | 00000020 3a 94 04 85 5b 7a 3f 16 fb 55 8f e0 c3 a3 33 21 |:...[z?..U....3!| 78 | 00000030 65 84 c5 17 03 03 00 25 00 00 00 00 00 00 00 01 |e......%........| 79 | 00000040 a9 35 62 24 4b 63 6e 62 1c 8f 99 e4 e0 3e f0 a2 |.5b$Kcnb.....>..| 80 | 00000050 e3 02 34 6f 10 71 9c 6b b3 4a 2d 7f 71 15 03 03 |..4o.q.k.J-.q...| 81 | 00000060 00 1a 00 00 00 00 00 00 00 02 91 43 07 98 b1 ba |...........C....| 82 | 00000070 06 1b dd 21 46 82 63 67 8b bb 1f b5 |...!F.cg....| 83 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv12-RSA-AES256-GCM-SHA384: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 97 01 00 00 93 03 03 0f 13 d8 49 94 |..............I.| 3 | 00000010 b9 cc 41 1d d4 3d bb d2 c9 a3 2c 74 11 ca 01 e8 |..A..=....,t....| 4 | 00000020 5b b0 2e 57 60 b5 30 37 2d b9 f0 00 00 04 c0 30 |[..W`.07-......0| 5 | 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| 6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| 8 | 00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....| 9 | 00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................| 10 | 00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................| 11 | 00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............| 12 | >>> Flow 2 (server to client) 13 | 00000000 16 03 03 00 37 02 00 00 33 03 03 00 00 00 00 00 |....7...3.......| 14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 30 00 00 |...DOWNGRD...0..| 16 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 03 02 |................| 17 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 18 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 19 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 20 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 21 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 22 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 23 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 24 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 25 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 26 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 27 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 28 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 29 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 30 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 31 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 32 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 33 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 34 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 35 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 36 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 37 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 38 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 39 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 40 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 41 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 42 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 43 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 44 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 45 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 46 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 47 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 48 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 49 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 50 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 51 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 52 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 53 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 54 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 ac 0c |.`.\!.;.........| 55 | 000002a0 00 00 a8 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 |...... /.}.G.bC.| 56 | 000002b0 28 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed |(.._.).0........| 57 | 000002c0 90 99 5f 58 cb 3b 74 08 04 00 80 40 f3 67 86 41 |.._X.;t....@.g.A| 58 | 000002d0 93 17 f7 db b2 80 ca 73 f9 f8 45 24 cc 46 57 47 |.......s..E$.FWG| 59 | 000002e0 28 83 19 df e8 63 e7 19 c4 a2 04 85 25 7d ec 55 |(....c......%}.U| 60 | 000002f0 91 d4 df eb 77 53 c2 3b d5 71 1a f7 39 d2 ee b4 |....wS.;.q..9...| 61 | 00000300 06 4b e4 07 b7 fa 8a 8e fa 64 22 83 dd 22 8b b8 |.K.......d".."..| 62 | 00000310 4d a5 1a f5 e3 81 01 81 6a a1 6e 62 54 3a 3a 09 |M.......j.nbT::.| 63 | 00000320 ed 76 f2 5a d3 4e 4b 74 be 46 50 0d 51 77 34 f6 |.v.Z.NKt.FP.Qw4.| 64 | 00000330 02 ef 57 39 29 bf d9 64 ad 65 06 ae a6 8d 94 86 |..W9)..d.e......| 65 | 00000340 84 76 cf 2c 36 98 04 5b a1 59 6c 16 03 03 00 04 |.v.,6..[.Yl.....| 66 | 00000350 0e 00 00 00 |....| 67 | >>> Flow 3 (client to server) 68 | 00000000 16 03 03 00 25 10 00 00 21 20 d5 2b 0e 3c e9 3e |....%...! .+.<.>| 69 | 00000010 e9 b0 3d 86 a9 85 b5 68 af cf 27 cf 4b d4 49 2e |..=....h..'.K.I.| 70 | 00000020 68 f2 9e 3c 32 7c cb fb dc 57 14 03 03 00 01 01 |h..<2|...W......| 71 | 00000030 16 03 03 00 28 5a cc f4 77 38 94 46 7b 39 5d 81 |....(Z..w8.F{9].| 72 | 00000040 be 77 a5 4a 76 c9 46 62 17 0b 2b ea 89 c2 29 bd |.w.Jv.Fb..+...).| 73 | 00000050 4b b0 dd 51 1e b8 7b a9 55 f5 fb b3 6a |K..Q..{.U...j| 74 | >>> Flow 4 (server to client) 75 | 00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| 76 | 00000010 00 00 00 b9 9b c0 b1 2b 71 af 0b 44 4e 4a cd e8 |.......+q..DNJ..| 77 | 00000020 c6 68 b8 2a d9 67 6f 7f 18 12 22 5c 4b 5c ca 43 |.h.*.go..."\K\.C| 78 | 00000030 ff c1 9d 17 03 03 00 25 00 00 00 00 00 00 00 01 |.......%........| 79 | 00000040 3c ae 33 dd 69 6c 01 a0 d2 a7 91 52 43 f3 78 38 |<.3.il.....RC.x8| 80 | 00000050 94 f4 24 0b 3d c9 bb 5f 02 27 89 bb 9b 15 03 03 |..$.=.._.'......| 81 | 00000060 00 1a 00 00 00 00 00 00 00 02 68 8d d7 d8 2f 95 |..........h.../.| 82 | 00000070 61 09 59 52 0d b8 12 fc 6a 07 28 37 |a.YR....j.(7| 83 | -------------------------------------------------------------------------------- /tls/key_schedule_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package tls 6 | 7 | import ( 8 | "bytes" 9 | "encoding/hex" 10 | "hash" 11 | "strings" 12 | "testing" 13 | "unicode" 14 | ) 15 | 16 | // This file contains tests derived from draft-ietf-tls-tls13-vectors-07. 17 | 18 | func parseVector(v string) []byte { 19 | v = strings.Map(func(c rune) rune { 20 | if unicode.IsSpace(c) { 21 | return -1 22 | } 23 | return c 24 | }, v) 25 | parts := strings.Split(v, ":") 26 | v = parts[len(parts)-1] 27 | res, err := hex.DecodeString(v) 28 | if err != nil { 29 | panic(err) 30 | } 31 | return res 32 | } 33 | 34 | func TestDeriveSecret(t *testing.T) { 35 | chTranscript := cipherSuitesTLS13[0].hash.New() 36 | chTranscript.Write(parseVector(` 37 | payload (512 octets): 01 00 01 fc 03 03 1b c3 ce b6 bb e3 9c ff 38 | 93 83 55 b5 a5 0a db 6d b2 1b 7a 6a f6 49 d7 b4 bc 41 9d 78 76 39 | 48 7d 95 00 00 06 13 01 13 03 13 02 01 00 01 cd 00 00 00 0b 00 40 | 09 00 00 06 73 65 72 76 65 72 ff 01 00 01 00 00 0a 00 14 00 12 41 | 00 1d 00 17 00 18 00 19 01 00 01 01 01 02 01 03 01 04 00 33 00 42 | 26 00 24 00 1d 00 20 e4 ff b6 8a c0 5f 8d 96 c9 9d a2 66 98 34 43 | 6c 6b e1 64 82 ba dd da fe 05 1a 66 b4 f1 8d 66 8f 0b 00 2a 00 44 | 00 00 2b 00 03 02 03 04 00 0d 00 20 00 1e 04 03 05 03 06 03 02 45 | 03 08 04 08 05 08 06 04 01 05 01 06 01 02 01 04 02 05 02 06 02 46 | 02 02 00 2d 00 02 01 01 00 1c 00 02 40 01 00 15 00 57 00 00 00 47 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 50 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 51 | 00 29 00 dd 00 b8 00 b2 2c 03 5d 82 93 59 ee 5f f7 af 4e c9 00 52 | 00 00 00 26 2a 64 94 dc 48 6d 2c 8a 34 cb 33 fa 90 bf 1b 00 70 53 | ad 3c 49 88 83 c9 36 7c 09 a2 be 78 5a bc 55 cd 22 60 97 a3 a9 54 | 82 11 72 83 f8 2a 03 a1 43 ef d3 ff 5d d3 6d 64 e8 61 be 7f d6 55 | 1d 28 27 db 27 9c ce 14 50 77 d4 54 a3 66 4d 4e 6d a4 d2 9e e0 56 | 37 25 a6 a4 da fc d0 fc 67 d2 ae a7 05 29 51 3e 3d a2 67 7f a5 57 | 90 6c 5b 3f 7d 8f 92 f2 28 bd a4 0d da 72 14 70 f9 fb f2 97 b5 58 | ae a6 17 64 6f ac 5c 03 27 2e 97 07 27 c6 21 a7 91 41 ef 5f 7d 59 | e6 50 5e 5b fb c3 88 e9 33 43 69 40 93 93 4a e4 d3 57 fa d6 aa 60 | cb 00 21 20 3a dd 4f b2 d8 fd f8 22 a0 ca 3c f7 67 8e f5 e8 8d 61 | ae 99 01 41 c5 92 4d 57 bb 6f a3 1b 9e 5f 9d`)) 62 | 63 | type args struct { 64 | secret []byte 65 | label string 66 | transcript hash.Hash 67 | } 68 | tests := []struct { 69 | name string 70 | args args 71 | want []byte 72 | }{ 73 | { 74 | `derive secret for handshake "tls13 derived"`, 75 | args{ 76 | parseVector(`PRK (32 octets): 33 ad 0a 1c 60 7e c0 3b 09 e6 cd 98 93 68 0c e2 77 | 10 ad f3 00 aa 1f 26 60 e1 b2 2e 10 f1 70 f9 2a`), 78 | "derived", 79 | nil, 80 | }, 81 | parseVector(`expanded (32 octets): 6f 26 15 a1 08 c7 02 c5 67 8f 54 fc 9d ba 82 | b6 97 16 c0 76 18 9c 48 25 0c eb ea c3 57 6c 36 11 ba`), 83 | }, 84 | { 85 | `derive secret "tls13 c e traffic"`, 86 | args{ 87 | parseVector(`PRK (32 octets): 9b 21 88 e9 b2 fc 6d 64 d7 1d c3 29 90 0e 20 bb 88 | 41 91 50 00 f6 78 aa 83 9c bb 79 7c b7 d8 33 2c`), 89 | "c e traffic", 90 | chTranscript, 91 | }, 92 | parseVector(`expanded (32 octets): 3f bb e6 a6 0d eb 66 c3 0a 32 79 5a ba 0e 93 | ff 7e aa 10 10 55 86 e7 be 5c 09 67 8d 63 b6 ca ab 62`), 94 | }, 95 | } 96 | for _, tt := range tests { 97 | t.Run(tt.name, func(t *testing.T) { 98 | c := cipherSuitesTLS13[0] 99 | if got := c.deriveSecret(tt.args.secret, tt.args.label, tt.args.transcript); !bytes.Equal(got, tt.want) { 100 | t.Errorf("cipherSuiteTLS13.deriveSecret() = % x, want % x", got, tt.want) 101 | } 102 | }) 103 | } 104 | } 105 | 106 | func TestTrafficKey(t *testing.T) { 107 | trafficSecret := parseVector( 108 | `PRK (32 octets): b6 7b 7d 69 0c c1 6c 4e 75 e5 42 13 cb 2d 37 b4 109 | e9 c9 12 bc de d9 10 5d 42 be fd 59 d3 91 ad 38`) 110 | wantKey := parseVector( 111 | `key expanded (16 octets): 3f ce 51 60 09 c2 17 27 d0 f2 e4 e8 6e 112 | e4 03 bc`) 113 | wantIV := parseVector( 114 | `iv expanded (12 octets): 5d 31 3e b2 67 12 76 ee 13 00 0b 30`) 115 | 116 | c := cipherSuitesTLS13[0] 117 | gotKey, gotIV := c.trafficKey(trafficSecret) 118 | if !bytes.Equal(gotKey, wantKey) { 119 | t.Errorf("cipherSuiteTLS13.trafficKey() gotKey = % x, want % x", gotKey, wantKey) 120 | } 121 | if !bytes.Equal(gotIV, wantIV) { 122 | t.Errorf("cipherSuiteTLS13.trafficKey() gotIV = % x, want % x", gotIV, wantIV) 123 | } 124 | } 125 | 126 | func TestExtract(t *testing.T) { 127 | type args struct { 128 | newSecret []byte 129 | currentSecret []byte 130 | } 131 | tests := []struct { 132 | name string 133 | args args 134 | want []byte 135 | }{ 136 | { 137 | `extract secret "early"`, 138 | args{ 139 | nil, 140 | nil, 141 | }, 142 | parseVector(`secret (32 octets): 33 ad 0a 1c 60 7e c0 3b 09 e6 cd 98 93 68 0c 143 | e2 10 ad f3 00 aa 1f 26 60 e1 b2 2e 10 f1 70 f9 2a`), 144 | }, 145 | { 146 | `extract secret "master"`, 147 | args{ 148 | nil, 149 | parseVector(`salt (32 octets): 43 de 77 e0 c7 77 13 85 9a 94 4d b9 db 25 90 b5 150 | 31 90 a6 5b 3e e2 e4 f1 2d d7 a0 bb 7c e2 54 b4`), 151 | }, 152 | parseVector(`secret (32 octets): 18 df 06 84 3d 13 a0 8b f2 a4 49 84 4c 5f 8a 153 | 47 80 01 bc 4d 4c 62 79 84 d5 a4 1d a8 d0 40 29 19`), 154 | }, 155 | { 156 | `extract secret "handshake"`, 157 | args{ 158 | parseVector(`IKM (32 octets): 8b d4 05 4f b5 5b 9d 63 fd fb ac f9 f0 4b 9f 0d 159 | 35 e6 d6 3f 53 75 63 ef d4 62 72 90 0f 89 49 2d`), 160 | parseVector(`salt (32 octets): 6f 26 15 a1 08 c7 02 c5 67 8f 54 fc 9d ba b6 97 161 | 16 c0 76 18 9c 48 25 0c eb ea c3 57 6c 36 11 ba`), 162 | }, 163 | parseVector(`secret (32 octets): 1d c8 26 e9 36 06 aa 6f dc 0a ad c1 2f 74 1b 164 | 01 04 6a a6 b9 9f 69 1e d2 21 a9 f0 ca 04 3f be ac`), 165 | }, 166 | } 167 | for _, tt := range tests { 168 | t.Run(tt.name, func(t *testing.T) { 169 | c := cipherSuitesTLS13[0] 170 | if got := c.extract(tt.args.newSecret, tt.args.currentSecret); !bytes.Equal(got, tt.want) { 171 | t.Errorf("cipherSuiteTLS13.extract() = % x, want % x", got, tt.want) 172 | } 173 | }) 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /tls/testdata/Client-TLSv12-ECDHE-ECDSA-CHACHA20-POLY1305: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 d0 01 00 00 cc 03 03 00 00 00 00 00 |................| 3 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 4 | 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 5 | 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 6 | 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 08 cc a9 |................| 7 | 00000050 13 03 13 01 13 02 01 00 00 7b 00 05 00 05 01 00 |.........{......| 8 | 00000060 00 00 00 00 0a 00 0a 00 08 00 1d 00 17 00 18 00 |................| 9 | 00000070 19 00 0b 00 02 01 00 00 0d 00 1a 00 18 08 04 04 |................| 10 | 00000080 03 08 07 08 05 08 06 04 01 05 01 06 01 05 03 06 |................| 11 | 00000090 03 02 01 02 03 ff 01 00 01 00 00 12 00 00 00 2b |...............+| 12 | 000000a0 00 09 08 03 04 03 03 03 02 03 01 00 33 00 26 00 |............3.&.| 13 | 000000b0 24 00 1d 00 20 2f e5 7d a3 47 cd 62 43 15 28 da |$... /.}.G.bC.(.| 14 | 000000c0 ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 |._.).0..........| 15 | 000000d0 5f 58 cb 3b 74 |_X.;t| 16 | >>> Flow 2 (server to client) 17 | 00000000 16 03 03 00 59 02 00 00 55 03 03 e1 cc 3c 49 04 |....Y...U....>> Flow 3 (client to server) 70 | 00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.| 71 | 00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....| 72 | 00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......| 73 | 00000030 16 03 03 00 20 7f ab 78 f0 a6 b6 57 bd c3 b9 32 |.... ..x...W...2| 74 | 00000040 96 3f 7c 9d a0 4d dc 74 c9 e8 1a 88 c4 b2 10 27 |.?|..M.t.......'| 75 | 00000050 e3 9c 1e 9b e1 |.....| 76 | >>> Flow 4 (server to client) 77 | 00000000 14 03 03 00 01 01 16 03 03 00 20 0c b7 0c 47 8e |.......... ...G.| 78 | 00000010 40 6b 9f 9c d2 cd 24 25 db 12 e8 0c 50 be f3 98 |@k....$%....P...| 79 | 00000020 4a 6f f9 42 58 07 b9 64 d0 00 91 |Jo.BX..d...| 80 | >>> Flow 5 (client to server) 81 | 00000000 17 03 03 00 16 1d 32 1c ef 0b 1f a4 ba 39 a3 63 |......2......9.c| 82 | 00000010 04 29 e5 67 1e bb 5a 6e c7 3c c1 15 03 03 00 12 |.).g..Zn.<......| 83 | 00000020 0e 0b 0f 49 30 fe d4 c3 35 85 e3 db 6e 65 e3 2d |...I0...5...ne.-| 84 | 00000030 d1 1d |..| 85 | -------------------------------------------------------------------------------- /tls/testdata/Client-TLSv10-RSA-RC4: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 3 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 4 | 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 5 | 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 6 | 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| 7 | 00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| 8 | 00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| 9 | 00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| 10 | 00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 11 | 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| 12 | 000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| 13 | 000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| 14 | 000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| 15 | 000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| 16 | 000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| 17 | 000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| 18 | >>> Flow 2 (server to client) 19 | 00000000 16 03 01 00 51 02 00 00 4d 03 01 2a 09 26 d2 61 |....Q...M..*.&.a| 20 | 00000010 ac 38 91 3d 18 3f f7 a9 3c 34 91 b0 b1 e1 29 68 |.8.=.?..<4....)h| 21 | 00000020 dd cb b9 a9 d8 39 0b 64 c6 93 7d 20 ea 51 ff 63 |.....9.d..} .Q.c| 22 | 00000030 97 03 b2 6f a3 d6 55 0d 64 65 2a 5d 3a fe e9 3e |...o..U.de*]:..>| 23 | 00000040 47 c1 7d c5 d8 03 c6 22 19 2f 6c 5a 00 05 00 00 |G.}...."./lZ....| 24 | 00000050 05 ff 01 00 01 00 16 03 01 02 59 0b 00 02 55 00 |..........Y...U.| 25 | 00000060 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| 26 | 00000070 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| 27 | 00000080 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.| 28 | 00000090 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..| 29 | 000000a0 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| 30 | 000000b0 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..| 31 | 000000c0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1| 32 | 000000d0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.| 33 | 000000e0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...| 34 | 000000f0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0| 35 | 00000100 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.| 36 | 00000110 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6| 37 | 00000120 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.| 38 | 00000130 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....| 39 | 00000140 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......| 40 | 00000150 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$| 41 | 00000160 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..| 42 | 00000170 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u| 43 | 00000180 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.| 44 | 00000190 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........| 45 | 000001a0 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.| 46 | 000001b0 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......| 47 | 000001c0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.| 48 | 000001d0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>| 49 | 000001e0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#| 50 | 000001f0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..| 51 | 00000200 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0| 52 | 00000210 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan| 53 | 00000220 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........| 54 | 00000230 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...| 55 | 00000240 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1| 56 | 00000250 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d| 57 | 00000260 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..| 58 | 00000270 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....| 59 | 00000280 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| 60 | 00000290 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| 61 | 000002a0 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| 62 | 000002b0 3b e9 fa e7 16 03 01 00 04 0e 00 00 00 |;............| 63 | >>> Flow 3 (client to server) 64 | 00000000 16 03 01 00 86 10 00 00 82 00 80 b9 65 8d bf a7 |............e...| 65 | 00000010 c8 4b 79 ce 6f cb 8b 13 1c ac b9 7d 66 5e e9 ba |.Ky.o......}f^..| 66 | 00000020 1d 71 4e a9 e9 34 ae f6 64 65 90 3b d8 16 52 a2 |.qN..4..de.;..R.| 67 | 00000030 6f f4 cb 8a 13 74 a2 ee b7 27 69 b4 41 c0 90 68 |o....t...'i.A..h| 68 | 00000040 bc 02 69 e1 c6 48 4f 39 36 30 25 ca 4c 17 ce 83 |..i..HO960%.L...| 69 | 00000050 9e 08 56 e3 05 49 93 9e 2e c4 fb e6 c8 01 f1 0f |..V..I..........| 70 | 00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| 71 | 00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| 72 | 00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 01 00 01 |.Y(.....ia5.....| 73 | 00000090 01 16 03 01 00 24 29 ee 6c 54 d6 21 5e 31 30 9e |.....$).lT.!^10.| 74 | 000000a0 fd 02 69 bb 32 c2 9e ad 28 b1 2d 94 49 0a 12 0c |..i.2...(.-.I...| 75 | 000000b0 a1 12 b0 98 a6 33 eb 63 2b e4 |.....3.c+.| 76 | >>> Flow 4 (server to client) 77 | 00000000 14 03 01 00 01 01 16 03 01 00 24 32 3e 45 f2 3a |..........$2>E.:| 78 | 00000010 01 05 50 db 37 25 f6 b5 67 8e 38 3d f5 ba b7 90 |..P.7%..g.8=....| 79 | 00000020 e0 05 a8 cb e0 33 1a 79 ab 44 86 d5 0c fd 86 |.....3.y.D.....| 80 | >>> Flow 5 (client to server) 81 | 00000000 17 03 01 00 1a ac 0c 1f 12 4e d4 31 10 dd c1 04 |.........N.1....| 82 | 00000010 8b 55 a2 2e a5 f4 e4 80 aa 23 7e bd 79 b0 ee 15 |.U.......#~.y...| 83 | 00000020 03 01 00 16 fa d9 ff 50 7d 41 01 2a d2 13 ee 33 |.......P}A.*...3| 84 | 00000030 52 ab 20 c5 e7 73 81 5d 81 60 |R. ..s.].`| 85 | -------------------------------------------------------------------------------- /tls/testdata/Client-TLSv11-RSA-RC4: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 3 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 4 | 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 5 | 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 6 | 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| 7 | 00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| 8 | 00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| 9 | 00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| 10 | 00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 11 | 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| 12 | 000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| 13 | 000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| 14 | 000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| 15 | 000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| 16 | 000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| 17 | 000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| 18 | >>> Flow 2 (server to client) 19 | 00000000 16 03 02 00 51 02 00 00 4d 03 02 82 5b 12 ac 33 |....Q...M...[..3| 20 | 00000010 08 d4 28 8c 91 6e 52 c4 c6 09 13 24 bf 42 d2 37 |..(..nR....$.B.7| 21 | 00000020 6d 78 60 b0 ea bd 9e b3 08 99 43 20 05 5a 93 f9 |mx`.......C .Z..| 22 | 00000030 a4 39 43 4f c4 e3 27 20 7d 4c fa 7a 28 c1 c7 33 |.9CO..' }L.z(..3| 23 | 00000040 72 fa 14 b8 ba c3 89 b0 a5 54 a3 7c 00 05 00 00 |r........T.|....| 24 | 00000050 05 ff 01 00 01 00 16 03 02 02 59 0b 00 02 55 00 |..........Y...U.| 25 | 00000060 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| 26 | 00000070 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| 27 | 00000080 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.| 28 | 00000090 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..| 29 | 000000a0 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| 30 | 000000b0 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..| 31 | 000000c0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1| 32 | 000000d0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.| 33 | 000000e0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...| 34 | 000000f0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0| 35 | 00000100 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.| 36 | 00000110 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6| 37 | 00000120 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.| 38 | 00000130 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....| 39 | 00000140 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......| 40 | 00000150 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$| 41 | 00000160 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..| 42 | 00000170 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u| 43 | 00000180 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.| 44 | 00000190 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........| 45 | 000001a0 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.| 46 | 000001b0 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......| 47 | 000001c0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.| 48 | 000001d0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>| 49 | 000001e0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#| 50 | 000001f0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..| 51 | 00000200 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0| 52 | 00000210 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan| 53 | 00000220 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........| 54 | 00000230 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...| 55 | 00000240 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1| 56 | 00000250 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d| 57 | 00000260 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..| 58 | 00000270 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....| 59 | 00000280 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| 60 | 00000290 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| 61 | 000002a0 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| 62 | 000002b0 3b e9 fa e7 16 03 02 00 04 0e 00 00 00 |;............| 63 | >>> Flow 3 (client to server) 64 | 00000000 16 03 02 00 86 10 00 00 82 00 80 b9 65 8d bf a7 |............e...| 65 | 00000010 c8 4b 79 ce 6f cb 8b 13 1c ac b9 7d 66 5e e9 ba |.Ky.o......}f^..| 66 | 00000020 1d 71 4e a9 e9 34 ae f6 64 65 90 3b d8 16 52 a2 |.qN..4..de.;..R.| 67 | 00000030 6f f4 cb 8a 13 74 a2 ee b7 27 69 b4 41 c0 90 68 |o....t...'i.A..h| 68 | 00000040 bc 02 69 e1 c6 48 4f 39 36 30 25 ca 4c 17 ce 83 |..i..HO960%.L...| 69 | 00000050 9e 08 56 e3 05 49 93 9e 2e c4 fb e6 c8 01 f1 0f |..V..I..........| 70 | 00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| 71 | 00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| 72 | 00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 02 00 01 |.Y(.....ia5.....| 73 | 00000090 01 16 03 02 00 24 e1 1a bf e9 fd 4c fb 56 41 82 |.....$.....L.VA.| 74 | 000000a0 c2 48 fc ca d9 d5 ec 2a 0a ee 63 25 e0 5f 53 cf |.H.....*..c%._S.| 75 | 000000b0 24 ff fe da 6f f5 8b 61 b7 b9 |$...o..a..| 76 | >>> Flow 4 (server to client) 77 | 00000000 14 03 02 00 01 01 16 03 02 00 24 99 2c e7 fa d0 |..........$.,...| 78 | 00000010 29 d9 92 07 39 56 b0 0c ad 23 30 c8 d7 0b 38 da |)...9V...#0...8.| 79 | 00000020 6f d3 c7 f9 66 d2 ec 8c 52 85 cb db a6 22 50 |o...f...R...."P| 80 | >>> Flow 5 (client to server) 81 | 00000000 17 03 02 00 1a 9f 70 c4 77 f3 0a a8 e0 1a 75 87 |......p.w.....u.| 82 | 00000010 ab 2a f1 23 52 79 9f 5c 8e af 5d ba 27 45 f9 15 |.*.#Ry.\..].'E..| 83 | 00000020 03 02 00 16 f0 28 f3 71 a0 97 6b ba 7e 97 81 85 |.....(.q..k.~...| 84 | 00000030 11 59 1b c9 fa a0 48 32 e9 65 |.Y....H2.e| 85 | -------------------------------------------------------------------------------- /tls/testdata/Client-TLSv12-RSA-RC4: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................| 3 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 4 | 00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| 5 | 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 6 | 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a9 |.............2..| 7 | 00000050 cc a8 c0 2b c0 2f c0 2c c0 30 c0 09 c0 13 c0 0a |...+./.,.0......| 8 | 00000060 c0 14 00 9c 00 9d 00 2f 00 35 c0 12 00 0a c0 23 |......./.5.....#| 9 | 00000070 c0 27 00 3c c0 07 c0 11 00 05 13 03 13 01 13 02 |.'.<............| 10 | 00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............| 11 | 00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| 12 | 000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................| 13 | 000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................| 14 | 000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......| 15 | 000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /| 16 | 000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| 17 | 000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t| 18 | >>> Flow 2 (server to client) 19 | 00000000 16 03 03 00 51 02 00 00 4d 03 03 b0 e7 ee 09 45 |....Q...M......E| 20 | 00000010 36 f1 7a 92 be 9e d8 9d ae cd c1 4e b2 12 94 3e |6.z........N...>| 21 | 00000020 6c 34 71 ed 5f e0 97 7f 25 e4 dd 20 f4 43 01 03 |l4q._...%.. .C..| 22 | 00000030 88 33 26 7f 48 c1 f2 d1 4d d3 f8 1a bd 86 4c 50 |.3&.H...M.....LP| 23 | 00000040 18 89 dc 08 99 f1 51 c5 84 be b9 fd 00 05 00 00 |......Q.........| 24 | 00000050 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| 25 | 00000060 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| 26 | 00000070 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| 27 | 00000080 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.| 28 | 00000090 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..| 29 | 000000a0 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| 30 | 000000b0 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..| 31 | 000000c0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1| 32 | 000000d0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.| 33 | 000000e0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...| 34 | 000000f0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0| 35 | 00000100 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.| 36 | 00000110 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6| 37 | 00000120 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.| 38 | 00000130 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....| 39 | 00000140 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......| 40 | 00000150 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$| 41 | 00000160 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..| 42 | 00000170 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u| 43 | 00000180 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.| 44 | 00000190 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........| 45 | 000001a0 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.| 46 | 000001b0 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......| 47 | 000001c0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.| 48 | 000001d0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>| 49 | 000001e0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#| 50 | 000001f0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..| 51 | 00000200 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0| 52 | 00000210 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan| 53 | 00000220 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........| 54 | 00000230 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...| 55 | 00000240 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1| 56 | 00000250 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d| 57 | 00000260 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..| 58 | 00000270 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....| 59 | 00000280 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| 60 | 00000290 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| 61 | 000002a0 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| 62 | 000002b0 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............| 63 | >>> Flow 3 (client to server) 64 | 00000000 16 03 03 00 86 10 00 00 82 00 80 b9 65 8d bf a7 |............e...| 65 | 00000010 c8 4b 79 ce 6f cb 8b 13 1c ac b9 7d 66 5e e9 ba |.Ky.o......}f^..| 66 | 00000020 1d 71 4e a9 e9 34 ae f6 64 65 90 3b d8 16 52 a2 |.qN..4..de.;..R.| 67 | 00000030 6f f4 cb 8a 13 74 a2 ee b7 27 69 b4 41 c0 90 68 |o....t...'i.A..h| 68 | 00000040 bc 02 69 e1 c6 48 4f 39 36 30 25 ca 4c 17 ce 83 |..i..HO960%.L...| 69 | 00000050 9e 08 56 e3 05 49 93 9e 2e c4 fb e6 c8 01 f1 0f |..V..I..........| 70 | 00000060 c5 70 0f 08 83 48 e9 48 ef 6e 50 8b 05 7e e5 84 |.p...H.H.nP..~..| 71 | 00000070 25 fa 55 c7 ae 31 02 27 00 ef 3f 98 86 20 12 89 |%.U..1.'..?.. ..| 72 | 00000080 91 59 28 b4 f7 d7 af d2 69 61 35 14 03 03 00 01 |.Y(.....ia5.....| 73 | 00000090 01 16 03 03 00 24 08 65 01 80 0d 59 b8 ac 0f 09 |.....$.e...Y....| 74 | 000000a0 bf 61 31 32 e0 74 e9 f4 72 e3 2c 79 11 4d b2 a2 |.a12.t..r.,y.M..| 75 | 000000b0 55 65 94 c8 cd 0a 61 99 07 b8 |Ue....a...| 76 | >>> Flow 4 (server to client) 77 | 00000000 14 03 03 00 01 01 16 03 03 00 24 04 20 46 cd fb |..........$. F..| 78 | 00000010 6c 46 9c 47 21 03 fe 9b a4 c6 da 2c 71 2f db 92 |lF.G!......,q/..| 79 | 00000020 40 da 7d 46 2e e4 9c 81 86 89 7f 53 46 91 28 |@.}F.......SF.(| 80 | >>> Flow 5 (client to server) 81 | 00000000 17 03 03 00 1a 89 2b 2e 49 21 19 b7 d0 df 85 da |......+.I!......| 82 | 00000010 b8 a7 f3 73 5f fe 44 e5 0c a1 af 16 74 93 bc 15 |...s_.D.....t...| 83 | 00000020 03 03 00 16 5f 9e 64 d0 91 50 34 44 cf f6 1f e0 |...._.d..P4D....| 84 | 00000030 e0 13 b9 67 da 5c 99 16 f1 b3 |...g.\....| 85 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv12-RSA-AES: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 97 01 00 00 93 03 03 dd 28 eb 68 4a |............(.hJ| 3 | 00000010 8a 71 d2 98 d0 2d 21 c7 e9 19 19 de c8 13 0b 67 |.q...-!........g| 4 | 00000020 f4 ff 4c d0 37 f5 72 9f 2d fb b3 00 00 04 00 2f |..L.7.r.-....../| 5 | 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| 6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| 7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| 8 | 00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....| 9 | 00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................| 10 | 00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................| 11 | 00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............| 12 | >>> Flow 2 (server to client) 13 | 00000000 16 03 03 00 37 02 00 00 33 03 03 00 00 00 00 00 |....7...3.......| 14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| 16 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 03 02 |................| 17 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 18 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 19 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 20 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 21 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 22 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 23 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 24 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 25 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 26 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 27 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 28 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 29 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 30 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 31 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 32 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 33 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 34 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 35 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 36 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 37 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 38 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 39 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 40 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 41 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 42 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 43 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 44 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 45 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 46 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 47 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 48 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 49 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 50 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 51 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 52 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 53 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 54 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 04 0e |.`.\!.;.........| 55 | 000002a0 00 00 00 |...| 56 | >>> Flow 3 (client to server) 57 | 00000000 16 03 03 00 86 10 00 00 82 00 80 c0 37 ef f3 d9 |............7...| 58 | 00000010 6b 7b 3f c4 9f 46 d2 6b 8f 7f 8d ce 89 cf 8e 2b |k{?..F.k.......+| 59 | 00000020 1f 0d 86 f9 90 5a 23 28 6c d3 14 ce 2a 0b f1 0e |.....Z#(l...*...| 60 | 00000030 96 1c 11 7d c0 b8 fb 4b 2e cb 07 1c fe b9 e1 62 |...}...K.......b| 61 | 00000040 2c 38 1c 46 21 74 23 a9 f2 0b 15 36 ef 88 32 e8 |,8.F!t#....6..2.| 62 | 00000050 28 66 8e ab 14 be e9 02 04 9d 92 99 cc 6e 28 d0 |(f...........n(.| 63 | 00000060 f9 3d dc 61 7f f7 17 59 ab 1c 86 94 9a 28 7b 46 |.=.a...Y.....({F| 64 | 00000070 3c 36 ff d3 26 3c ad 2d 33 ef 99 83 09 a5 a8 2f |<6..&<.-3....../| 65 | 00000080 b3 a3 74 7f 49 a3 f1 47 7d 8c 12 14 03 03 00 01 |..t.I..G}.......| 66 | 00000090 01 16 03 03 00 40 32 68 cb ea 32 cb f2 7a 0e 4b |.....@2h..2..z.K| 67 | 000000a0 63 72 96 93 e8 2d 5b 22 a6 3a 05 9d 60 50 e5 d0 |cr...-[".:..`P..| 68 | 000000b0 f3 f8 14 ed 81 fe 17 a0 ee 3f 7b aa ca dc 06 bc |.........?{.....| 69 | 000000c0 28 90 73 33 84 0c 92 39 b7 cb da 06 08 05 0b 03 |(.s3...9........| 70 | 000000d0 86 be cc 70 0e c2 |...p..| 71 | >>> Flow 4 (server to client) 72 | 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| 73 | 00000010 00 00 00 00 00 00 00 00 00 00 00 10 a0 48 48 86 |.............HH.| 74 | 00000020 ac 1f f4 05 4d 12 9d 90 54 26 ec c8 1f 6d e7 d5 |....M...T&...m..| 75 | 00000030 0c 92 61 88 2f 43 77 75 0c 08 0f 33 ac c3 d3 b0 |..a./Cwu...3....| 76 | 00000040 94 68 e3 3f 9f c9 43 a5 8b ee ed 17 03 03 00 40 |.h.?..C........@| 77 | 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 78 | 00000060 fd 7d d3 d6 3f a5 10 37 a1 93 20 ca c8 8c 9d c3 |.}..?..7.. .....| 79 | 00000070 90 df 2f 40 e6 83 af b6 be e4 3d 07 ff 0d 24 97 |../@......=...$.| 80 | 00000080 c2 ff af 81 eb b5 91 72 6b 6d 70 8c af 3f 9f 76 |.......rkmp..?.v| 81 | 00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| 82 | 000000a0 00 00 00 00 00 6b 80 aa 88 45 8c 39 a8 4c ca 33 |.....k...E.9.L.3| 83 | 000000b0 f2 33 85 a0 74 6a 64 a3 43 17 4c 5c 9b 50 e5 8d |.3..tjd.C.L\.P..| 84 | 000000c0 ff 26 03 e1 07 |.&...| 85 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv12-SNI: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 99 01 00 00 95 03 03 fb d6 71 b2 32 |.............q.2| 3 | 00000010 74 6c e1 56 19 42 e6 46 a2 0e 37 1f ad 96 4b af |tl.V.B.F..7...K.| 4 | 00000020 8b 4c aa 71 2a 53 d8 df 74 7d 39 00 00 04 00 2f |.L.q*S..t}9..../| 5 | 00000030 00 ff 01 00 00 68 00 00 00 10 00 0e 00 00 0b 73 |.....h.........s| 6 | 00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 0b 00 04 03 00 |nitest.com......| 7 | 00000050 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 |................| 8 | 00000060 00 18 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e |.............0..| 9 | 00000070 04 03 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b |................| 10 | 00000080 08 04 08 05 08 06 04 01 05 01 06 01 03 03 02 03 |................| 11 | 00000090 03 01 02 01 03 02 02 02 04 02 05 02 06 02 |..............| 12 | >>> Flow 2 (server to client) 13 | 00000000 16 03 03 00 37 02 00 00 33 03 03 00 00 00 00 00 |....7...3.......| 14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| 16 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 03 02 |................| 17 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 18 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 19 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 20 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 21 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 22 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 23 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 24 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 25 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 26 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 27 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 28 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 29 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 30 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 31 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 32 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 33 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 34 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 35 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 36 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 37 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 38 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 39 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 40 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 41 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 42 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 43 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 44 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 45 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 46 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 47 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 48 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 49 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 50 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 51 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 52 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 53 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 54 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 04 0e |.`.\!.;.........| 55 | 000002a0 00 00 00 |...| 56 | >>> Flow 3 (client to server) 57 | 00000000 16 03 03 00 86 10 00 00 82 00 80 a4 48 88 75 7b |............H.u{| 58 | 00000010 a2 04 19 14 69 30 12 d6 14 00 0c 44 e4 68 06 c6 |....i0.....D.h..| 59 | 00000020 11 56 53 0c e5 52 fb 84 e2 6e b7 c6 eb 0d 79 25 |.VS..R...n....y%| 60 | 00000030 19 f0 bf e4 51 73 85 d5 82 5a 07 53 b2 65 97 6a |....Qs...Z.S.e.j| 61 | 00000040 a1 1b 56 bb 23 35 15 83 0f 60 ee de 16 a2 ea 61 |..V.#5...`.....a| 62 | 00000050 23 10 e1 5e cf 73 fe 5d 5a 53 16 42 0c 29 a5 ff |#..^.s.]ZS.B.)..| 63 | 00000060 06 e5 c4 87 11 d6 24 91 25 e5 58 81 40 80 9e 71 |......$.%.X.@..q| 64 | 00000070 49 40 47 50 37 28 7b ed 76 cc 5a fb 04 ba 9c f8 |I@GP7({.v.Z.....| 65 | 00000080 be ce 87 07 75 d2 30 88 09 cf bc 14 03 03 00 01 |....u.0.........| 66 | 00000090 01 16 03 03 00 40 60 1c 31 95 7d c2 a9 9b 29 c2 |.....@`.1.}...).| 67 | 000000a0 ef 59 58 dd fb 26 34 81 60 dc 17 19 c1 23 8d 8f |.YX..&4.`....#..| 68 | 000000b0 a8 d2 62 31 96 3d d2 61 b9 c8 7e bf 47 4c 04 fd |..b1.=.a..~.GL..| 69 | 000000c0 7c 30 05 37 8e 03 df 13 a1 4d f1 81 05 d7 4c 49 ||0.7.....M....LI| 70 | 000000d0 88 d6 c0 21 52 e3 |...!R.| 71 | >>> Flow 4 (server to client) 72 | 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| 73 | 00000010 00 00 00 00 00 00 00 00 00 00 00 73 15 54 76 ad |...........s.Tv.| 74 | 00000020 c4 38 b0 40 45 32 a8 ca 05 19 bd ce 6e 39 77 6b |.8.@E2......n9wk| 75 | 00000030 46 a7 f8 45 a8 cd cd 98 8c aa cf 46 83 f0 20 93 |F..E.......F.. .| 76 | 00000040 0d 18 99 d4 2a f9 15 4a 2b f6 bf 17 03 03 00 40 |....*..J+......@| 77 | 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 78 | 00000060 79 8d 24 ef 72 b3 2c e2 10 a5 6d 3d 61 6c df c1 |y.$.r.,...m=al..| 79 | 00000070 26 bf 7e b5 cd b2 8e 87 b9 54 bf ee 35 07 bc 55 |&.~......T..5..U| 80 | 00000080 6c cd a2 d3 b4 bb 8c 63 fd ef b1 f0 2f 6d aa d9 |l......c..../m..| 81 | 00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| 82 | 000000a0 00 00 00 00 00 7b f7 81 e6 5c f2 5c 9d 45 ec 1f |.....{...\.\.E..| 83 | 000000b0 7b 0d f8 62 19 d4 83 a8 e5 90 71 03 6e 6a 72 4b |{..b......q.njrK| 84 | 000000c0 7e 64 c4 c4 1a |~d...| 85 | -------------------------------------------------------------------------------- /tls/testdata/Server-TLSv12-SNI-GetCertificate: -------------------------------------------------------------------------------- 1 | >>> Flow 1 (client to server) 2 | 00000000 16 03 01 00 99 01 00 00 95 03 03 cf 09 e7 0d ce |................| 3 | 00000010 ce d4 72 66 9d 30 e8 ee 39 b3 95 4c 3b 59 25 66 |..rf.0..9..L;Y%f| 4 | 00000020 d2 f5 d3 82 68 7d e7 26 2e 38 97 00 00 04 00 2f |....h}.&.8...../| 5 | 00000030 00 ff 01 00 00 68 00 00 00 10 00 0e 00 00 0b 73 |.....h.........s| 6 | 00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 0b 00 04 03 00 |nitest.com......| 7 | 00000050 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 |................| 8 | 00000060 00 18 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e |.............0..| 9 | 00000070 04 03 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b |................| 10 | 00000080 08 04 08 05 08 06 04 01 05 01 06 01 03 03 02 03 |................| 11 | 00000090 03 01 02 01 03 02 02 02 04 02 05 02 06 02 |..............| 12 | >>> Flow 2 (server to client) 13 | 00000000 16 03 03 00 37 02 00 00 33 03 03 00 00 00 00 00 |....7...3.......| 14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| 16 | 00000030 0b ff 01 00 01 00 00 0b 00 02 01 00 16 03 03 02 |................| 17 | 00000040 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 4b 30 |Y...U..R..O0..K0| 18 | 00000050 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d 3f e2 |..............?.| 19 | 00000060 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b |[..0...*.H......| 20 | 00000070 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 02 47 |..0.1.0...U....G| 21 | 00000080 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f 20 52 |o1.0...U....Go R| 22 | 00000090 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 30 30 |oot0...160101000| 23 | 000000a0 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 30 30 |000Z..2501010000| 24 | 000000b0 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a 13 02 |00Z0.1.0...U....| 25 | 000000c0 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 6f 30 |Go1.0...U....Go0| 26 | 000000d0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| 27 | 000000e0 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 7d 93 |.....0.......F}.| 28 | 000000f0 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 5d fe |..'.H..(!.~...].| 29 | 00000100 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 81 c0 |.RE.z6G....B[...| 30 | 00000110 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e |..y.@.Om..+.....| 31 | 00000120 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b c2 34 |g....."8.J.ts+.4| 32 | 00000130 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c c0 b0 |......t{.X.la<..| 33 | 00000140 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d ce 20 |A..++$#w[.;.u]. | 34 | 00000150 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 |T..c...$....P...| 35 | 00000160 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 01 00 |.C...ub...R.....| 36 | 00000170 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f 01 01 |....0..0...U....| 37 | 00000180 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 |.......0...U.%..| 38 | 00000190 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 |0...+.........+.| 39 | 000001a0 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 01 ff |......0...U.....| 40 | 000001b0 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 10 9f |..0.0...U.......| 41 | 000001c0 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f 60 30 |...CC>I..m....`0| 42 | 000001d0 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 49 4d |...U.#..0...H.IM| 43 | 000001e0 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 06 03 |.~.1......n{0...| 44 | 000001f0 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 6c 65 |U....0...example| 45 | 00000200 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 86 f7 |.golang0...*.H..| 46 | 00000210 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 2b 5b |...........0.@+[| 47 | 00000220 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 1a a9 |P.a...SX...(.X..| 48 | 00000230 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d d9 0b |8....1Z..f=C.-..| 49 | 00000240 f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c 7d b7 |.... d8.$:....}.| 50 | 00000250 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 cc e1 |@ ._...a..v.....| 51 | 00000260 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 77 8d |.\.....l..s..Cw.| 52 | 00000270 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d ae db |......@.a.Lr+...| 53 | 00000280 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db fe 3d |F..M...>...B...=| 54 | 00000290 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 04 0e |.`.\!.;.........| 55 | 000002a0 00 00 00 |...| 56 | >>> Flow 3 (client to server) 57 | 00000000 16 03 03 00 86 10 00 00 82 00 80 04 57 b2 56 f0 |............W.V.| 58 | 00000010 a5 fb c3 4d 4e 7d ba 29 18 04 ea 6e 66 d3 97 68 |...MN}.)...nf..h| 59 | 00000020 58 4e c1 47 fe 30 42 4d bf 5b 10 38 6a 01 83 98 |XN.G.0BM.[.8j...| 60 | 00000030 2b e3 3a ac c8 67 e5 41 0c 5c 3f 88 d5 15 a2 ab |+.:..g.A.\?.....| 61 | 00000040 6a 2b 70 24 d8 40 78 c1 d9 58 78 04 4d 90 03 eb |j+p$.@x..Xx.M...| 62 | 00000050 3c b1 61 da 26 62 db b3 41 ab dc 94 22 44 66 b8 |<.a.&b..A..."Df.| 63 | 00000060 49 2c fa 59 de c0 69 3c 20 f8 2f a5 e0 47 1d ec |I,.Y..i< ./..G..| 64 | 00000070 3c 49 2d 39 f6 41 09 06 79 5f 26 c4 12 3d 9c 8d |>> Flow 4 (server to client) 72 | 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| 73 | 00000010 00 00 00 00 00 00 00 00 00 00 00 5e ea d1 03 d7 |...........^....| 74 | 00000020 de 82 9a b4 07 52 46 16 fd 28 86 fe 17 2e 77 52 |.....RF..(....wR| 75 | 00000030 67 8f ec 64 93 1e 8e c9 fc fb 69 61 47 78 1a 1b |g..d......iaGx..| 76 | 00000040 97 8d fc 56 76 f6 53 8b 62 53 4f 17 03 03 00 40 |...Vv.S.bSO....@| 77 | 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 78 | 00000060 f8 17 e8 ba c4 fb 0b 76 f5 a8 2d 3c 48 44 73 da |.......v..-