Alternative TLS implementation in Go
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

handshake_server_test.go 21 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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. package tls
  5. import (
  6. "big"
  7. "bytes"
  8. "crypto/rsa"
  9. "encoding/hex"
  10. "flag"
  11. "io"
  12. "net"
  13. "os"
  14. "testing"
  15. )
  16. type zeroSource struct{}
  17. func (zeroSource) Read(b []byte) (n int, err os.Error) {
  18. for i := range b {
  19. b[i] = 0
  20. }
  21. return len(b), nil
  22. }
  23. var testConfig *Config
  24. func init() {
  25. testConfig = new(Config)
  26. testConfig.Time = func() int64 { return 0 }
  27. testConfig.Rand = zeroSource{}
  28. testConfig.Certificates = make([]Certificate, 1)
  29. testConfig.Certificates[0].Certificate = [][]byte{testCertificate}
  30. testConfig.Certificates[0].PrivateKey = testPrivateKey
  31. testConfig.CipherSuites = []uint16{TLS_RSA_WITH_RC4_128_SHA}
  32. }
  33. func testClientHelloFailure(t *testing.T, m handshakeMessage, expected os.Error) {
  34. // Create in-memory network connection,
  35. // send message to server. Should return
  36. // expected error.
  37. c, s := net.Pipe()
  38. go func() {
  39. cli := Client(c, testConfig)
  40. if ch, ok := m.(*clientHelloMsg); ok {
  41. cli.vers = ch.vers
  42. }
  43. cli.writeRecord(recordTypeHandshake, m.marshal())
  44. c.Close()
  45. }()
  46. err := Server(s, testConfig).Handshake()
  47. s.Close()
  48. if e, ok := err.(*net.OpError); !ok || e.Error != expected {
  49. t.Errorf("Got error: %s; expected: %s", err, expected)
  50. }
  51. }
  52. func TestSimpleError(t *testing.T) {
  53. testClientHelloFailure(t, &serverHelloDoneMsg{}, alertUnexpectedMessage)
  54. }
  55. var badProtocolVersions = []uint16{0x0000, 0x0005, 0x0100, 0x0105, 0x0200, 0x0205, 0x0300}
  56. func TestRejectBadProtocolVersion(t *testing.T) {
  57. for _, v := range badProtocolVersions {
  58. testClientHelloFailure(t, &clientHelloMsg{vers: v}, alertProtocolVersion)
  59. }
  60. }
  61. func TestNoSuiteOverlap(t *testing.T) {
  62. clientHello := &clientHelloMsg{nil, 0x0301, nil, nil, []uint16{0xff00}, []uint8{0}, false, "", false}
  63. testClientHelloFailure(t, clientHello, alertHandshakeFailure)
  64. }
  65. func TestNoCompressionOverlap(t *testing.T) {
  66. clientHello := &clientHelloMsg{nil, 0x0301, nil, nil, []uint16{TLS_RSA_WITH_RC4_128_SHA}, []uint8{0xff}, false, "", false}
  67. testClientHelloFailure(t, clientHello, alertHandshakeFailure)
  68. }
  69. func TestAlertForwarding(t *testing.T) {
  70. c, s := net.Pipe()
  71. go func() {
  72. Client(c, testConfig).sendAlert(alertUnknownCA)
  73. c.Close()
  74. }()
  75. err := Server(s, testConfig).Handshake()
  76. s.Close()
  77. if e, ok := err.(*net.OpError); !ok || e.Error != os.Error(alertUnknownCA) {
  78. t.Errorf("Got error: %s; expected: %s", err, alertUnknownCA)
  79. }
  80. }
  81. func TestClose(t *testing.T) {
  82. c, s := net.Pipe()
  83. go c.Close()
  84. err := Server(s, testConfig).Handshake()
  85. s.Close()
  86. if err != os.EOF {
  87. t.Errorf("Got error: %s; expected: %s", err, os.EOF)
  88. }
  89. }
  90. func testServerScript(t *testing.T, name string, serverScript [][]byte, config *Config) {
  91. c, s := net.Pipe()
  92. srv := Server(s, config)
  93. go func() {
  94. srv.Write([]byte("hello, world\n"))
  95. srv.Close()
  96. }()
  97. defer c.Close()
  98. for i, b := range serverScript {
  99. if i%2 == 0 {
  100. c.Write(b)
  101. continue
  102. }
  103. bb := make([]byte, len(b))
  104. _, err := io.ReadFull(c, bb)
  105. if err != nil {
  106. t.Fatalf("%s #%d: %s", name, i, err)
  107. }
  108. if !bytes.Equal(b, bb) {
  109. t.Fatalf("%s #%d: mismatch on read: got:%x want:%x", name, i, bb, b)
  110. }
  111. }
  112. }
  113. func TestHandshakeServerRC4(t *testing.T) {
  114. testServerScript(t, "RC4", rc4ServerScript, testConfig)
  115. }
  116. func TestHandshakeServerAES(t *testing.T) {
  117. aesConfig := new(Config)
  118. *aesConfig = *testConfig
  119. aesConfig.CipherSuites = []uint16{TLS_RSA_WITH_AES_128_CBC_SHA}
  120. testServerScript(t, "AES", aesServerScript, aesConfig)
  121. }
  122. var serve = flag.Bool("serve", false, "run a TLS server on :10443")
  123. func TestRunServer(t *testing.T) {
  124. if !*serve {
  125. return
  126. }
  127. l, err := Listen("tcp", ":10443", testConfig)
  128. if err != nil {
  129. t.Fatal(err)
  130. }
  131. for {
  132. c, err := l.Accept()
  133. if err != nil {
  134. break
  135. }
  136. c.Write([]byte("hello, world\n"))
  137. c.Close()
  138. }
  139. }
  140. func bigFromString(s string) *big.Int {
  141. ret := new(big.Int)
  142. ret.SetString(s, 10)
  143. return ret
  144. }
  145. func fromHex(s string) []byte {
  146. b, _ := hex.DecodeString(s)
  147. return b
  148. }
  149. var testCertificate = fromHex("308202b030820219a00302010202090085b0bba48a7fb8ca300d06092a864886f70d01010505003045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c7464301e170d3130303432343039303933385a170d3131303432343039303933385a3045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c746430819f300d06092a864886f70d010101050003818d0030818902818100bb79d6f517b5e5bf4610d0dc69bee62b07435ad0032d8a7a4385b71452e7a5654c2c78b8238cb5b482e5de1f953b7e62a52ca533d6fe125c7a56fcf506bffa587b263fb5cd04d3d0c921964ac7f4549f5abfef427100fe1899077f7e887d7df10439c4a22edb51c97ce3c04c3b326601cfafb11db8719a1ddbdb896baeda2d790203010001a381a73081a4301d0603551d0e04160414b1ade2855acfcb28db69ce2369ded3268e18883930750603551d23046e306c8014b1ade2855acfcb28db69ce2369ded3268e188839a149a4473045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c746482090085b0bba48a7fb8ca300c0603551d13040530030101ff300d06092a864886f70d010105050003818100086c4524c76bb159ab0c52ccf2b014d7879d7a6475b55a9566e4c52b8eae12661feb4f38b36e60d392fdf74108b52513b1187a24fb301dbaed98b917ece7d73159db95d31d78ea50565cd5825a2d5a5f33c4b6d8c97590968c0f5298b5cd981f89205ff2a01ca31b9694dda9fd57e970e8266d71999b266e3850296c90a7bdd9")
  150. var testPrivateKey = &rsa.PrivateKey{
  151. PublicKey: rsa.PublicKey{
  152. N: bigFromString("131650079503776001033793877885499001334664249354723305978524647182322416328664556247316495448366990052837680518067798333412266673813370895702118944398081598789828837447552603077848001020611640547221687072142537202428102790818451901395596882588063427854225330436740647715202971973145151161964464812406232198521"),
  153. E: 65537,
  154. },
  155. D: bigFromString("29354450337804273969007277378287027274721892607543397931919078829901848876371746653677097639302788129485893852488285045793268732234230875671682624082413996177431586734171663258657462237320300610850244186316880055243099640544518318093544057213190320837094958164973959123058337475052510833916491060913053867729"),
  156. P: bigFromString("11969277782311800166562047708379380720136961987713178380670422671426759650127150688426177829077494755200794297055316163155755835813760102405344560929062149"),
  157. Q: bigFromString("10998999429884441391899182616418192492905073053684657075974935218461686523870125521822756579792315215543092255516093840728890783887287417039645833477273829"),
  158. }
  159. // Script of interaction with gnutls implementation.
  160. // The values for this test are obtained by building a test binary (gotest)
  161. // and then running 6.out -serve to start a server and then
  162. // gnutls-cli --insecure --debug 100 -p 10443 localhost
  163. // to dump a session.
  164. var rc4ServerScript = [][]byte{
  165. {
  166. 0x16, 0x03, 0x02, 0x00, 0x7f, 0x01, 0x00, 0x00,
  167. 0x7b, 0x03, 0x02, 0x4d, 0x08, 0x1f, 0x5a, 0x7a,
  168. 0x0a, 0x92, 0x2f, 0xf0, 0x73, 0x16, 0x3a, 0x88,
  169. 0x14, 0x85, 0x4c, 0x98, 0x15, 0x7b, 0x65, 0xe0,
  170. 0x78, 0xd0, 0xed, 0xd0, 0xf3, 0x65, 0x20, 0xeb,
  171. 0x80, 0xd1, 0x0b, 0x00, 0x00, 0x34, 0x00, 0x33,
  172. 0x00, 0x45, 0x00, 0x39, 0x00, 0x88, 0x00, 0x16,
  173. 0x00, 0x32, 0x00, 0x44, 0x00, 0x38, 0x00, 0x87,
  174. 0x00, 0x13, 0x00, 0x66, 0x00, 0x90, 0x00, 0x91,
  175. 0x00, 0x8f, 0x00, 0x8e, 0x00, 0x2f, 0x00, 0x41,
  176. 0x00, 0x35, 0x00, 0x84, 0x00, 0x0a, 0x00, 0x05,
  177. 0x00, 0x04, 0x00, 0x8c, 0x00, 0x8d, 0x00, 0x8b,
  178. 0x00, 0x8a, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x09,
  179. 0x00, 0x03, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00,
  180. 0x0e, 0x00, 0x0c, 0x00, 0x00, 0x09, 0x6c, 0x6f,
  181. 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0xff,
  182. 0x01, 0x00, 0x01, 0x00,
  183. },
  184. {
  185. 0x16, 0x03, 0x01, 0x00, 0x2a, 0x02, 0x00, 0x00,
  186. 0x26, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
  187. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  188. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  189. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  190. 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x16,
  191. 0x03, 0x01, 0x02, 0xbe, 0x0b, 0x00, 0x02, 0xba,
  192. 0x00, 0x02, 0xb7, 0x00, 0x02, 0xb4, 0x30, 0x82,
  193. 0x02, 0xb0, 0x30, 0x82, 0x02, 0x19, 0xa0, 0x03,
  194. 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0x85, 0xb0,
  195. 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, 0xca, 0x30, 0x0d,
  196. 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
  197. 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x45, 0x31,
  198. 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
  199. 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11,
  200. 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53,
  201. 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74,
  202. 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55,
  203. 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65,
  204. 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64,
  205. 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79,
  206. 0x20, 0x4c, 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d,
  207. 0x31, 0x30, 0x30, 0x34, 0x32, 0x34, 0x30, 0x39,
  208. 0x30, 0x39, 0x33, 0x38, 0x5a, 0x17, 0x0d, 0x31,
  209. 0x31, 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, 0x30,
  210. 0x39, 0x33, 0x38, 0x5a, 0x30, 0x45, 0x31, 0x0b,
  211. 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
  212. 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06,
  213. 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f,
  214. 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65,
  215. 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04,
  216. 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72,
  217. 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67,
  218. 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20,
  219. 0x4c, 0x74, 0x64, 0x30, 0x81, 0x9f, 0x30, 0x0d,
  220. 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
  221. 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d,
  222. 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00,
  223. 0xbb, 0x79, 0xd6, 0xf5, 0x17, 0xb5, 0xe5, 0xbf,
  224. 0x46, 0x10, 0xd0, 0xdc, 0x69, 0xbe, 0xe6, 0x2b,
  225. 0x07, 0x43, 0x5a, 0xd0, 0x03, 0x2d, 0x8a, 0x7a,
  226. 0x43, 0x85, 0xb7, 0x14, 0x52, 0xe7, 0xa5, 0x65,
  227. 0x4c, 0x2c, 0x78, 0xb8, 0x23, 0x8c, 0xb5, 0xb4,
  228. 0x82, 0xe5, 0xde, 0x1f, 0x95, 0x3b, 0x7e, 0x62,
  229. 0xa5, 0x2c, 0xa5, 0x33, 0xd6, 0xfe, 0x12, 0x5c,
  230. 0x7a, 0x56, 0xfc, 0xf5, 0x06, 0xbf, 0xfa, 0x58,
  231. 0x7b, 0x26, 0x3f, 0xb5, 0xcd, 0x04, 0xd3, 0xd0,
  232. 0xc9, 0x21, 0x96, 0x4a, 0xc7, 0xf4, 0x54, 0x9f,
  233. 0x5a, 0xbf, 0xef, 0x42, 0x71, 0x00, 0xfe, 0x18,
  234. 0x99, 0x07, 0x7f, 0x7e, 0x88, 0x7d, 0x7d, 0xf1,
  235. 0x04, 0x39, 0xc4, 0xa2, 0x2e, 0xdb, 0x51, 0xc9,
  236. 0x7c, 0xe3, 0xc0, 0x4c, 0x3b, 0x32, 0x66, 0x01,
  237. 0xcf, 0xaf, 0xb1, 0x1d, 0xb8, 0x71, 0x9a, 0x1d,
  238. 0xdb, 0xdb, 0x89, 0x6b, 0xae, 0xda, 0x2d, 0x79,
  239. 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7,
  240. 0x30, 0x81, 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55,
  241. 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xb1, 0xad,
  242. 0xe2, 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69,
  243. 0xce, 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18,
  244. 0x88, 0x39, 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d,
  245. 0x23, 0x04, 0x6e, 0x30, 0x6c, 0x80, 0x14, 0xb1,
  246. 0xad, 0xe2, 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb,
  247. 0x69, 0xce, 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e,
  248. 0x18, 0x88, 0x39, 0xa1, 0x49, 0xa4, 0x47, 0x30,
  249. 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
  250. 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13,
  251. 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13,
  252. 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74,
  253. 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06,
  254. 0x03, 0x55, 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e,
  255. 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57,
  256. 0x69, 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50,
  257. 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09,
  258. 0x00, 0x85, 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, 0xb8,
  259. 0xca, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13,
  260. 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30,
  261. 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
  262. 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x81,
  263. 0x81, 0x00, 0x08, 0x6c, 0x45, 0x24, 0xc7, 0x6b,
  264. 0xb1, 0x59, 0xab, 0x0c, 0x52, 0xcc, 0xf2, 0xb0,
  265. 0x14, 0xd7, 0x87, 0x9d, 0x7a, 0x64, 0x75, 0xb5,
  266. 0x5a, 0x95, 0x66, 0xe4, 0xc5, 0x2b, 0x8e, 0xae,
  267. 0x12, 0x66, 0x1f, 0xeb, 0x4f, 0x38, 0xb3, 0x6e,
  268. 0x60, 0xd3, 0x92, 0xfd, 0xf7, 0x41, 0x08, 0xb5,
  269. 0x25, 0x13, 0xb1, 0x18, 0x7a, 0x24, 0xfb, 0x30,
  270. 0x1d, 0xba, 0xed, 0x98, 0xb9, 0x17, 0xec, 0xe7,
  271. 0xd7, 0x31, 0x59, 0xdb, 0x95, 0xd3, 0x1d, 0x78,
  272. 0xea, 0x50, 0x56, 0x5c, 0xd5, 0x82, 0x5a, 0x2d,
  273. 0x5a, 0x5f, 0x33, 0xc4, 0xb6, 0xd8, 0xc9, 0x75,
  274. 0x90, 0x96, 0x8c, 0x0f, 0x52, 0x98, 0xb5, 0xcd,
  275. 0x98, 0x1f, 0x89, 0x20, 0x5f, 0xf2, 0xa0, 0x1c,
  276. 0xa3, 0x1b, 0x96, 0x94, 0xdd, 0xa9, 0xfd, 0x57,
  277. 0xe9, 0x70, 0xe8, 0x26, 0x6d, 0x71, 0x99, 0x9b,
  278. 0x26, 0x6e, 0x38, 0x50, 0x29, 0x6c, 0x90, 0xa7,
  279. 0xbd, 0xd9, 0x16, 0x03, 0x01, 0x00, 0x04, 0x0e,
  280. 0x00, 0x00, 0x00,
  281. },
  282. {
  283. 0x16, 0x03, 0x01, 0x00, 0x86, 0x10, 0x00, 0x00,
  284. 0x82, 0x00, 0x80, 0x3c, 0x13, 0xd7, 0x12, 0xc1,
  285. 0x6a, 0xf0, 0x3f, 0x8c, 0xa1, 0x35, 0x5d, 0xc5,
  286. 0x89, 0x1e, 0x9e, 0xcd, 0x32, 0xc7, 0x9e, 0xe6,
  287. 0xae, 0xd5, 0xf1, 0xbf, 0x70, 0xd7, 0xa9, 0xef,
  288. 0x2c, 0x4c, 0xf4, 0x22, 0xbc, 0x17, 0x17, 0xaa,
  289. 0x05, 0xf3, 0x9f, 0x80, 0xf2, 0xe9, 0x82, 0x2f,
  290. 0x2a, 0x15, 0x54, 0x0d, 0x16, 0x0e, 0x77, 0x4c,
  291. 0x28, 0x3c, 0x03, 0x2d, 0x2d, 0xd7, 0xc8, 0x64,
  292. 0xd9, 0x59, 0x4b, 0x1c, 0xf4, 0xde, 0xff, 0x2f,
  293. 0xbc, 0x94, 0xaf, 0x18, 0x26, 0x37, 0xce, 0x4f,
  294. 0x84, 0x74, 0x2e, 0x45, 0x66, 0x7c, 0x0c, 0x54,
  295. 0x46, 0x36, 0x5f, 0x65, 0x21, 0x7b, 0x83, 0x8c,
  296. 0x6d, 0x76, 0xcd, 0x0d, 0x9f, 0xda, 0x1c, 0xa4,
  297. 0x6e, 0xfe, 0xb1, 0xf7, 0x09, 0x0d, 0xfb, 0x74,
  298. 0x66, 0x34, 0x99, 0x89, 0x7f, 0x5f, 0x77, 0x87,
  299. 0x4a, 0x66, 0x4b, 0xa9, 0x59, 0x57, 0xe3, 0x56,
  300. 0x0d, 0xdd, 0xd8, 0x14, 0x03, 0x01, 0x00, 0x01,
  301. 0x01, 0x16, 0x03, 0x01, 0x00, 0x24, 0xc0, 0x4e,
  302. 0xd3, 0x0f, 0xb5, 0xc0, 0x57, 0xa6, 0x18, 0x80,
  303. 0x80, 0x6b, 0x49, 0xfe, 0xbd, 0x3a, 0x7a, 0x2c,
  304. 0xef, 0x70, 0xb5, 0x1c, 0xd2, 0xdf, 0x5f, 0x78,
  305. 0x5a, 0xd8, 0x4f, 0xa0, 0x95, 0xb4, 0xb3, 0xb5,
  306. 0xaa, 0x3b,
  307. },
  308. {
  309. 0x14, 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03,
  310. 0x01, 0x00, 0x24, 0x9d, 0xc9, 0xda, 0xdf, 0xeb,
  311. 0xc8, 0xdb, 0xf8, 0x94, 0xa5, 0xef, 0xd5, 0xfc,
  312. 0x89, 0x01, 0x64, 0x30, 0x77, 0x5a, 0x18, 0x4b,
  313. 0x16, 0x79, 0x9c, 0xf6, 0xf5, 0x09, 0x22, 0x12,
  314. 0x4c, 0x3e, 0xa8, 0x8e, 0x91, 0xa5, 0x24,
  315. },
  316. }
  317. var aesServerScript = [][]byte{
  318. {
  319. 0x16, 0x03, 0x02, 0x00, 0x7f, 0x01, 0x00, 0x00,
  320. 0x7b, 0x03, 0x02, 0x4d, 0x08, 0x2d, 0x0b, 0xb3,
  321. 0x57, 0x85, 0x71, 0x4b, 0xfb, 0x34, 0xab, 0x16,
  322. 0xd4, 0x92, 0x50, 0x81, 0x16, 0x95, 0x11, 0x28,
  323. 0x1a, 0xcb, 0xff, 0x09, 0x4d, 0x23, 0xa6, 0xfe,
  324. 0x2e, 0xbb, 0x78, 0x00, 0x00, 0x34, 0x00, 0x33,
  325. 0x00, 0x45, 0x00, 0x39, 0x00, 0x88, 0x00, 0x16,
  326. 0x00, 0x32, 0x00, 0x44, 0x00, 0x38, 0x00, 0x87,
  327. 0x00, 0x13, 0x00, 0x66, 0x00, 0x90, 0x00, 0x91,
  328. 0x00, 0x8f, 0x00, 0x8e, 0x00, 0x2f, 0x00, 0x41,
  329. 0x00, 0x35, 0x00, 0x84, 0x00, 0x0a, 0x00, 0x05,
  330. 0x00, 0x04, 0x00, 0x8c, 0x00, 0x8d, 0x00, 0x8b,
  331. 0x00, 0x8a, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x09,
  332. 0x00, 0x03, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00,
  333. 0x0e, 0x00, 0x0c, 0x00, 0x00, 0x09, 0x6c, 0x6f,
  334. 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0xff,
  335. 0x01, 0x00, 0x01, 0x00,
  336. },
  337. {
  338. 0x16, 0x03, 0x01, 0x00, 0x2a, 0x02, 0x00, 0x00,
  339. 0x26, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
  340. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  341. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  342. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  343. 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x16,
  344. 0x03, 0x01, 0x02, 0xbe, 0x0b, 0x00, 0x02, 0xba,
  345. 0x00, 0x02, 0xb7, 0x00, 0x02, 0xb4, 0x30, 0x82,
  346. 0x02, 0xb0, 0x30, 0x82, 0x02, 0x19, 0xa0, 0x03,
  347. 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0x85, 0xb0,
  348. 0xbb, 0xa4, 0x8a, 0x7f, 0xb8, 0xca, 0x30, 0x0d,
  349. 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
  350. 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x45, 0x31,
  351. 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
  352. 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11,
  353. 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53,
  354. 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74,
  355. 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55,
  356. 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65,
  357. 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64,
  358. 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79,
  359. 0x20, 0x4c, 0x74, 0x64, 0x30, 0x1e, 0x17, 0x0d,
  360. 0x31, 0x30, 0x30, 0x34, 0x32, 0x34, 0x30, 0x39,
  361. 0x30, 0x39, 0x33, 0x38, 0x5a, 0x17, 0x0d, 0x31,
  362. 0x31, 0x30, 0x34, 0x32, 0x34, 0x30, 0x39, 0x30,
  363. 0x39, 0x33, 0x38, 0x5a, 0x30, 0x45, 0x31, 0x0b,
  364. 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
  365. 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06,
  366. 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f,
  367. 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65,
  368. 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04,
  369. 0x0a, 0x13, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72,
  370. 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67,
  371. 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20,
  372. 0x4c, 0x74, 0x64, 0x30, 0x81, 0x9f, 0x30, 0x0d,
  373. 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
  374. 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d,
  375. 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00,
  376. 0xbb, 0x79, 0xd6, 0xf5, 0x17, 0xb5, 0xe5, 0xbf,
  377. 0x46, 0x10, 0xd0, 0xdc, 0x69, 0xbe, 0xe6, 0x2b,
  378. 0x07, 0x43, 0x5a, 0xd0, 0x03, 0x2d, 0x8a, 0x7a,
  379. 0x43, 0x85, 0xb7, 0x14, 0x52, 0xe7, 0xa5, 0x65,
  380. 0x4c, 0x2c, 0x78, 0xb8, 0x23, 0x8c, 0xb5, 0xb4,
  381. 0x82, 0xe5, 0xde, 0x1f, 0x95, 0x3b, 0x7e, 0x62,
  382. 0xa5, 0x2c, 0xa5, 0x33, 0xd6, 0xfe, 0x12, 0x5c,
  383. 0x7a, 0x56, 0xfc, 0xf5, 0x06, 0xbf, 0xfa, 0x58,
  384. 0x7b, 0x26, 0x3f, 0xb5, 0xcd, 0x04, 0xd3, 0xd0,
  385. 0xc9, 0x21, 0x96, 0x4a, 0xc7, 0xf4, 0x54, 0x9f,
  386. 0x5a, 0xbf, 0xef, 0x42, 0x71, 0x00, 0xfe, 0x18,
  387. 0x99, 0x07, 0x7f, 0x7e, 0x88, 0x7d, 0x7d, 0xf1,
  388. 0x04, 0x39, 0xc4, 0xa2, 0x2e, 0xdb, 0x51, 0xc9,
  389. 0x7c, 0xe3, 0xc0, 0x4c, 0x3b, 0x32, 0x66, 0x01,
  390. 0xcf, 0xaf, 0xb1, 0x1d, 0xb8, 0x71, 0x9a, 0x1d,
  391. 0xdb, 0xdb, 0x89, 0x6b, 0xae, 0xda, 0x2d, 0x79,
  392. 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81, 0xa7,
  393. 0x30, 0x81, 0xa4, 0x30, 0x1d, 0x06, 0x03, 0x55,
  394. 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xb1, 0xad,
  395. 0xe2, 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb, 0x69,
  396. 0xce, 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e, 0x18,
  397. 0x88, 0x39, 0x30, 0x75, 0x06, 0x03, 0x55, 0x1d,
  398. 0x23, 0x04, 0x6e, 0x30, 0x6c, 0x80, 0x14, 0xb1,
  399. 0xad, 0xe2, 0x85, 0x5a, 0xcf, 0xcb, 0x28, 0xdb,
  400. 0x69, 0xce, 0x23, 0x69, 0xde, 0xd3, 0x26, 0x8e,
  401. 0x18, 0x88, 0x39, 0xa1, 0x49, 0xa4, 0x47, 0x30,
  402. 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
  403. 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13,
  404. 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13,
  405. 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74,
  406. 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06,
  407. 0x03, 0x55, 0x04, 0x0a, 0x13, 0x18, 0x49, 0x6e,
  408. 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57,
  409. 0x69, 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50,
  410. 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, 0x82, 0x09,
  411. 0x00, 0x85, 0xb0, 0xbb, 0xa4, 0x8a, 0x7f, 0xb8,
  412. 0xca, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13,
  413. 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30,
  414. 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
  415. 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x81,
  416. 0x81, 0x00, 0x08, 0x6c, 0x45, 0x24, 0xc7, 0x6b,
  417. 0xb1, 0x59, 0xab, 0x0c, 0x52, 0xcc, 0xf2, 0xb0,
  418. 0x14, 0xd7, 0x87, 0x9d, 0x7a, 0x64, 0x75, 0xb5,
  419. 0x5a, 0x95, 0x66, 0xe4, 0xc5, 0x2b, 0x8e, 0xae,
  420. 0x12, 0x66, 0x1f, 0xeb, 0x4f, 0x38, 0xb3, 0x6e,
  421. 0x60, 0xd3, 0x92, 0xfd, 0xf7, 0x41, 0x08, 0xb5,
  422. 0x25, 0x13, 0xb1, 0x18, 0x7a, 0x24, 0xfb, 0x30,
  423. 0x1d, 0xba, 0xed, 0x98, 0xb9, 0x17, 0xec, 0xe7,
  424. 0xd7, 0x31, 0x59, 0xdb, 0x95, 0xd3, 0x1d, 0x78,
  425. 0xea, 0x50, 0x56, 0x5c, 0xd5, 0x82, 0x5a, 0x2d,
  426. 0x5a, 0x5f, 0x33, 0xc4, 0xb6, 0xd8, 0xc9, 0x75,
  427. 0x90, 0x96, 0x8c, 0x0f, 0x52, 0x98, 0xb5, 0xcd,
  428. 0x98, 0x1f, 0x89, 0x20, 0x5f, 0xf2, 0xa0, 0x1c,
  429. 0xa3, 0x1b, 0x96, 0x94, 0xdd, 0xa9, 0xfd, 0x57,
  430. 0xe9, 0x70, 0xe8, 0x26, 0x6d, 0x71, 0x99, 0x9b,
  431. 0x26, 0x6e, 0x38, 0x50, 0x29, 0x6c, 0x90, 0xa7,
  432. 0xbd, 0xd9, 0x16, 0x03, 0x01, 0x00, 0x04, 0x0e,
  433. 0x00, 0x00, 0x00,
  434. },
  435. {
  436. 0x16, 0x03, 0x01, 0x00, 0x86, 0x10, 0x00, 0x00,
  437. 0x82, 0x00, 0x80, 0x71, 0x9c, 0xe7, 0x23, 0xfc,
  438. 0xb9, 0x19, 0x29, 0x82, 0xbf, 0xef, 0x08, 0xf7,
  439. 0x99, 0x36, 0xc3, 0x4c, 0x6f, 0x05, 0xd2, 0x8b,
  440. 0x62, 0x2b, 0x19, 0x9b, 0x7f, 0xc0, 0xcc, 0x48,
  441. 0x30, 0x5f, 0xcd, 0xc3, 0x70, 0x55, 0x53, 0x73,
  442. 0xfa, 0x79, 0x74, 0xf3, 0xa3, 0x76, 0x9f, 0xa1,
  443. 0x7f, 0x98, 0xc2, 0xc0, 0xe3, 0xc5, 0xa0, 0x31,
  444. 0x2f, 0xa6, 0xe8, 0x1e, 0x61, 0x46, 0xb3, 0x9b,
  445. 0x4b, 0x16, 0xf1, 0x2d, 0xc7, 0x63, 0x7f, 0x79,
  446. 0x22, 0x30, 0xd1, 0xf2, 0xfc, 0x77, 0x98, 0x0a,
  447. 0x16, 0x11, 0x63, 0x71, 0x7f, 0x70, 0xef, 0x16,
  448. 0xbb, 0x39, 0x87, 0x34, 0xac, 0x49, 0xbd, 0x07,
  449. 0x67, 0xcb, 0x9c, 0xcc, 0xde, 0xef, 0xb1, 0xe0,
  450. 0xdb, 0x01, 0xb5, 0x35, 0xa9, 0xb3, 0x10, 0x0c,
  451. 0x4b, 0xee, 0xb3, 0x4e, 0xfd, 0xbe, 0x15, 0x27,
  452. 0xf0, 0x46, 0xb2, 0x38, 0xba, 0x5f, 0xcc, 0x89,
  453. 0xec, 0x29, 0x82, 0x14, 0x03, 0x01, 0x00, 0x01,
  454. 0x01, 0x16, 0x03, 0x01, 0x00, 0x30, 0x3c, 0xfb,
  455. 0xa4, 0x12, 0xcb, 0x00, 0xf9, 0x57, 0x7e, 0x9b,
  456. 0xc9, 0xdc, 0x0c, 0xba, 0x9a, 0x81, 0x62, 0xfb,
  457. 0x26, 0x13, 0x53, 0xfe, 0xaa, 0xcc, 0x82, 0xbb,
  458. 0xb6, 0x67, 0x7f, 0x39, 0xbe, 0x4d, 0xbb, 0xc0,
  459. 0x6c, 0x24, 0x31, 0x83, 0xa5, 0x50, 0x3a, 0x75,
  460. 0x32, 0x64, 0xb5, 0xdb, 0xbe, 0x0a,
  461. },
  462. {
  463. 0x14, 0x03, 0x01, 0x00, 0x01, 0x01, 0x16, 0x03,
  464. 0x01, 0x00, 0x30, 0x43, 0x24, 0x42, 0x55, 0x08,
  465. 0xe4, 0xc2, 0x15, 0xc9, 0xdb, 0x71, 0x69, 0xee,
  466. 0x09, 0xc5, 0x1c, 0xfd, 0x46, 0x10, 0xa0, 0x68,
  467. 0x21, 0xf2, 0x48, 0xac, 0x6c, 0xc0, 0x2b, 0x62,
  468. 0x07, 0x8f, 0x48, 0x33, 0x0a, 0x6b, 0x62, 0x28,
  469. 0x2e, 0x2c, 0xad, 0xcb, 0x34, 0x85, 0xca, 0x2e,
  470. 0xcd, 0x84, 0xf0,
  471. },
  472. }