github.com/zmap/zcrypto@v0.0.0-20240512203510-0fef58d9a9db/ct/asn1/asn1_test.go (about)

     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 asn1
     6  
     7  import (
     8  	"bytes"
     9  	"math/big"
    10  	"reflect"
    11  	"testing"
    12  	"time"
    13  )
    14  
    15  type boolTest struct {
    16  	in  []byte
    17  	ok  bool
    18  	out bool
    19  }
    20  
    21  var boolTestData = []boolTest{
    22  	{[]byte{0x00}, true, false},
    23  	{[]byte{0xff}, true, true},
    24  	{[]byte{0x00, 0x00}, false, false},
    25  	{[]byte{0xff, 0xff}, false, false},
    26  	{[]byte{0x01}, false, false},
    27  }
    28  
    29  func TestParseBool(t *testing.T) {
    30  	for i, test := range boolTestData {
    31  		ret, err := parseBool(test.in)
    32  		if (err == nil) != test.ok {
    33  			t.Errorf("#%d: Incorrect error result (did fail? %v, expected: %v)", i, err == nil, test.ok)
    34  		}
    35  		if test.ok && ret != test.out {
    36  			t.Errorf("#%d: Bad result: %v (expected %v)", i, ret, test.out)
    37  		}
    38  	}
    39  }
    40  
    41  type int64Test struct {
    42  	in  []byte
    43  	ok  bool
    44  	out int64
    45  }
    46  
    47  var int64TestData = []int64Test{
    48  	{[]byte{0x00}, true, 0},
    49  	{[]byte{0x7f}, true, 127},
    50  	{[]byte{0x00, 0x80}, true, 128},
    51  	{[]byte{0x01, 0x00}, true, 256},
    52  	{[]byte{0x80}, true, -128},
    53  	{[]byte{0xff, 0x7f}, true, -129},
    54  	{[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, true, -1},
    55  	{[]byte{0xff}, true, -1},
    56  	{[]byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, true, -9223372036854775808},
    57  	{[]byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, false, 0},
    58  }
    59  
    60  func TestParseInt64(t *testing.T) {
    61  	for i, test := range int64TestData {
    62  		ret, err := parseInt64(test.in)
    63  		if (err == nil) != test.ok {
    64  			t.Errorf("#%d: Incorrect error result (did fail? %v, expected: %v)", i, err == nil, test.ok)
    65  		}
    66  		if test.ok && ret != test.out {
    67  			t.Errorf("#%d: Bad result: %v (expected %v)", i, ret, test.out)
    68  		}
    69  	}
    70  }
    71  
    72  type int32Test struct {
    73  	in  []byte
    74  	ok  bool
    75  	out int32
    76  }
    77  
    78  var int32TestData = []int32Test{
    79  	{[]byte{0x00}, true, 0},
    80  	{[]byte{0x7f}, true, 127},
    81  	{[]byte{0x00, 0x80}, true, 128},
    82  	{[]byte{0x01, 0x00}, true, 256},
    83  	{[]byte{0x80}, true, -128},
    84  	{[]byte{0xff, 0x7f}, true, -129},
    85  	{[]byte{0xff, 0xff, 0xff, 0xff}, true, -1},
    86  	{[]byte{0xff}, true, -1},
    87  	{[]byte{0x80, 0x00, 0x00, 0x00}, true, -2147483648},
    88  	{[]byte{0x80, 0x00, 0x00, 0x00, 0x00}, false, 0},
    89  }
    90  
    91  func TestParseInt32(t *testing.T) {
    92  	for i, test := range int32TestData {
    93  		ret, err := parseInt32(test.in)
    94  		if (err == nil) != test.ok {
    95  			t.Errorf("#%d: Incorrect error result (did fail? %v, expected: %v)", i, err == nil, test.ok)
    96  		}
    97  		if test.ok && int32(ret) != test.out {
    98  			t.Errorf("#%d: Bad result: %v (expected %v)", i, ret, test.out)
    99  		}
   100  	}
   101  }
   102  
   103  var bigIntTests = []struct {
   104  	in     []byte
   105  	base10 string
   106  }{
   107  	{[]byte{0xff}, "-1"},
   108  	{[]byte{0x00}, "0"},
   109  	{[]byte{0x01}, "1"},
   110  	{[]byte{0x00, 0xff}, "255"},
   111  	{[]byte{0xff, 0x00}, "-256"},
   112  	{[]byte{0x01, 0x00}, "256"},
   113  }
   114  
   115  func TestParseBigInt(t *testing.T) {
   116  	for i, test := range bigIntTests {
   117  		ret := parseBigInt(test.in)
   118  		if ret.String() != test.base10 {
   119  			t.Errorf("#%d: bad result from %x, got %s want %s", i, test.in, ret.String(), test.base10)
   120  		}
   121  		fw := newForkableWriter()
   122  		marshalBigInt(fw, ret)
   123  		result := fw.Bytes()
   124  		if !bytes.Equal(result, test.in) {
   125  			t.Errorf("#%d: got %x from marshaling %s, want %x", i, result, ret, test.in)
   126  		}
   127  	}
   128  }
   129  
   130  type bitStringTest struct {
   131  	in        []byte
   132  	ok        bool
   133  	out       []byte
   134  	bitLength int
   135  }
   136  
   137  var bitStringTestData = []bitStringTest{
   138  	{[]byte{}, false, []byte{}, 0},
   139  	{[]byte{0x00}, true, []byte{}, 0},
   140  	{[]byte{0x07, 0x00}, true, []byte{0x00}, 1},
   141  	{[]byte{0x07, 0x01}, false, []byte{}, 0},
   142  	{[]byte{0x07, 0x40}, false, []byte{}, 0},
   143  	{[]byte{0x08, 0x00}, false, []byte{}, 0},
   144  }
   145  
   146  func TestBitString(t *testing.T) {
   147  	for i, test := range bitStringTestData {
   148  		ret, err := parseBitString(test.in)
   149  		if (err == nil) != test.ok {
   150  			t.Errorf("#%d: Incorrect error result (did fail? %v, expected: %v)", i, err == nil, test.ok)
   151  		}
   152  		if err == nil {
   153  			if test.bitLength != ret.BitLength || !bytes.Equal(ret.Bytes, test.out) {
   154  				t.Errorf("#%d: Bad result: %v (expected %v %v)", i, ret, test.out, test.bitLength)
   155  			}
   156  		}
   157  	}
   158  }
   159  
   160  func TestBitStringAt(t *testing.T) {
   161  	bs := BitString{[]byte{0x82, 0x40}, 16}
   162  	if bs.At(0) != 1 {
   163  		t.Error("#1: Failed")
   164  	}
   165  	if bs.At(1) != 0 {
   166  		t.Error("#2: Failed")
   167  	}
   168  	if bs.At(6) != 1 {
   169  		t.Error("#3: Failed")
   170  	}
   171  	if bs.At(9) != 1 {
   172  		t.Error("#4: Failed")
   173  	}
   174  }
   175  
   176  type bitStringRightAlignTest struct {
   177  	in    []byte
   178  	inlen int
   179  	out   []byte
   180  }
   181  
   182  var bitStringRightAlignTests = []bitStringRightAlignTest{
   183  	{[]byte{0x80}, 1, []byte{0x01}},
   184  	{[]byte{0x80, 0x80}, 9, []byte{0x01, 0x01}},
   185  	{[]byte{}, 0, []byte{}},
   186  	{[]byte{0xce}, 8, []byte{0xce}},
   187  	{[]byte{0xce, 0x47}, 16, []byte{0xce, 0x47}},
   188  	{[]byte{0x34, 0x50}, 12, []byte{0x03, 0x45}},
   189  }
   190  
   191  func TestBitStringRightAlign(t *testing.T) {
   192  	for i, test := range bitStringRightAlignTests {
   193  		bs := BitString{test.in, test.inlen}
   194  		out := bs.RightAlign()
   195  		if !bytes.Equal(out, test.out) {
   196  			t.Errorf("#%d got: %x want: %x", i, out, test.out)
   197  		}
   198  	}
   199  }
   200  
   201  type objectIdentifierTest struct {
   202  	in  []byte
   203  	ok  bool
   204  	out []int
   205  }
   206  
   207  var objectIdentifierTestData = []objectIdentifierTest{
   208  	{[]byte{}, false, []int{}},
   209  	{[]byte{85}, true, []int{2, 5}},
   210  	{[]byte{85, 0x02}, true, []int{2, 5, 2}},
   211  	{[]byte{85, 0x02, 0xc0, 0x00}, true, []int{2, 5, 2, 0x2000}},
   212  	{[]byte{0x81, 0x34, 0x03}, true, []int{2, 100, 3}},
   213  	{[]byte{85, 0x02, 0xc0, 0x80, 0x80, 0x80, 0x80}, false, []int{}},
   214  }
   215  
   216  func TestObjectIdentifier(t *testing.T) {
   217  	for i, test := range objectIdentifierTestData {
   218  		ret, err := parseObjectIdentifier(test.in)
   219  		if (err == nil) != test.ok {
   220  			t.Errorf("#%d: Incorrect error result (did fail? %v, expected: %v)", i, err == nil, test.ok)
   221  		}
   222  		if err == nil {
   223  			if !reflect.DeepEqual(test.out, ret) {
   224  				t.Errorf("#%d: Bad result: %v (expected %v)", i, ret, test.out)
   225  			}
   226  		}
   227  	}
   228  }
   229  
   230  type timeTest struct {
   231  	in  string
   232  	ok  bool
   233  	out time.Time
   234  }
   235  
   236  var utcTestData = []timeTest{
   237  	{"910506164540-0700", true, time.Date(1991, 05, 06, 16, 45, 40, 0, time.FixedZone("", -7*60*60))},
   238  	{"910506164540+0730", true, time.Date(1991, 05, 06, 16, 45, 40, 0, time.FixedZone("", 7*60*60+30*60))},
   239  	{"910506234540Z", true, time.Date(1991, 05, 06, 23, 45, 40, 0, time.UTC)},
   240  	{"9105062345Z", true, time.Date(1991, 05, 06, 23, 45, 0, 0, time.UTC)},
   241  	{"a10506234540Z", false, time.Time{}},
   242  	{"91a506234540Z", false, time.Time{}},
   243  	{"9105a6234540Z", false, time.Time{}},
   244  	{"910506a34540Z", false, time.Time{}},
   245  	{"910506334a40Z", false, time.Time{}},
   246  	{"91050633444aZ", false, time.Time{}},
   247  	{"910506334461Z", false, time.Time{}},
   248  	{"910506334400Za", false, time.Time{}},
   249  }
   250  
   251  func TestUTCTime(t *testing.T) {
   252  	for i, test := range utcTestData {
   253  		ret, err := parseUTCTime([]byte(test.in))
   254  		if err != nil {
   255  			if test.ok {
   256  				t.Errorf("#%d: parseUTCTime(%q) = error %v", i, test.in, err)
   257  			}
   258  			continue
   259  		}
   260  		if !test.ok {
   261  			t.Errorf("#%d: parseUTCTime(%q) succeeded, should have failed", i, test.in)
   262  			continue
   263  		}
   264  		const format = "Jan _2 15:04:05 -0700 2006" // ignore zone name, just offset
   265  		have := ret.Format(format)
   266  		want := test.out.Format(format)
   267  		if have != want {
   268  			t.Errorf("#%d: parseUTCTime(%q) = %s, want %s", i, test.in, have, want)
   269  		}
   270  	}
   271  }
   272  
   273  var generalizedTimeTestData = []timeTest{
   274  	{"20100102030405Z", true, time.Date(2010, 01, 02, 03, 04, 05, 0, time.UTC)},
   275  	{"20100102030405", false, time.Time{}},
   276  	{"20100102030405+0607", true, time.Date(2010, 01, 02, 03, 04, 05, 0, time.FixedZone("", 6*60*60+7*60))},
   277  	{"20100102030405-0607", true, time.Date(2010, 01, 02, 03, 04, 05, 0, time.FixedZone("", -6*60*60-7*60))},
   278  }
   279  
   280  func TestGeneralizedTime(t *testing.T) {
   281  	for i, test := range generalizedTimeTestData {
   282  		ret, err := parseGeneralizedTime([]byte(test.in))
   283  		if (err == nil) != test.ok {
   284  			t.Errorf("#%d: Incorrect error result (did fail? %v, expected: %v)", i, err == nil, test.ok)
   285  		}
   286  		if err == nil {
   287  			if !reflect.DeepEqual(test.out, ret) {
   288  				t.Errorf("#%d: Bad result: %v (expected %v)", i, ret, test.out)
   289  			}
   290  		}
   291  	}
   292  }
   293  
   294  type tagAndLengthTest struct {
   295  	in  []byte
   296  	ok  bool
   297  	out tagAndLength
   298  }
   299  
   300  var tagAndLengthData = []tagAndLengthTest{
   301  	{[]byte{0x80, 0x01}, true, tagAndLength{2, 0, 1, false}},
   302  	{[]byte{0xa0, 0x01}, true, tagAndLength{2, 0, 1, true}},
   303  	{[]byte{0x02, 0x00}, true, tagAndLength{0, 2, 0, false}},
   304  	{[]byte{0xfe, 0x00}, true, tagAndLength{3, 30, 0, true}},
   305  	{[]byte{0x1f, 0x01, 0x00}, true, tagAndLength{0, 1, 0, false}},
   306  	{[]byte{0x1f, 0x81, 0x00, 0x00}, true, tagAndLength{0, 128, 0, false}},
   307  	{[]byte{0x1f, 0x81, 0x80, 0x01, 0x00}, true, tagAndLength{0, 0x4001, 0, false}},
   308  	{[]byte{0x00, 0x81, 0x01}, true, tagAndLength{0, 0, 1, false}},
   309  	{[]byte{0x00, 0x82, 0x01, 0x00}, true, tagAndLength{0, 0, 256, false}},
   310  	{[]byte{0x00, 0x83, 0x01, 0x00}, false, tagAndLength{}},
   311  	{[]byte{0x1f, 0x85}, false, tagAndLength{}},
   312  	{[]byte{0x30, 0x80}, false, tagAndLength{}},
   313  	// Superfluous zeros in the length should be an error.
   314  	{[]byte{0xa0, 0x82, 0x00, 0x01}, false, tagAndLength{}},
   315  	// Lengths up to the maximum size of an int should work.
   316  	{[]byte{0xa0, 0x84, 0x7f, 0xff, 0xff, 0xff}, true, tagAndLength{2, 0, 0x7fffffff, true}},
   317  	// Lengths that would overflow an int should be rejected.
   318  	{[]byte{0xa0, 0x84, 0x80, 0x00, 0x00, 0x00}, false, tagAndLength{}},
   319  }
   320  
   321  func TestParseTagAndLength(t *testing.T) {
   322  	for i, test := range tagAndLengthData {
   323  		tagAndLength, _, err := parseTagAndLength(test.in, 0)
   324  		if (err == nil) != test.ok {
   325  			t.Errorf("#%d: Incorrect error result (did pass? %v, expected: %v)", i, err == nil, test.ok)
   326  		}
   327  		if err == nil && !reflect.DeepEqual(test.out, tagAndLength) {
   328  			t.Errorf("#%d: Bad result: %v (expected %v)", i, tagAndLength, test.out)
   329  		}
   330  	}
   331  }
   332  
   333  type parseFieldParametersTest struct {
   334  	in  string
   335  	out fieldParameters
   336  }
   337  
   338  func newInt(n int) *int { return &n }
   339  
   340  func newInt64(n int64) *int64 { return &n }
   341  
   342  func newString(s string) *string { return &s }
   343  
   344  func newBool(b bool) *bool { return &b }
   345  
   346  var parseFieldParametersTestData []parseFieldParametersTest = []parseFieldParametersTest{
   347  	{"", fieldParameters{}},
   348  	{"ia5", fieldParameters{stringType: tagIA5String}},
   349  	{"printable", fieldParameters{stringType: tagPrintableString}},
   350  	{"optional", fieldParameters{optional: true}},
   351  	{"explicit", fieldParameters{explicit: true, tag: new(int)}},
   352  	{"application", fieldParameters{application: true, tag: new(int)}},
   353  	{"optional,explicit", fieldParameters{optional: true, explicit: true, tag: new(int)}},
   354  	{"default:42", fieldParameters{defaultValue: newInt64(42)}},
   355  	{"tag:17", fieldParameters{tag: newInt(17)}},
   356  	{"optional,explicit,default:42,tag:17", fieldParameters{optional: true, explicit: true, defaultValue: newInt64(42), tag: newInt(17)}},
   357  	{"optional,explicit,default:42,tag:17,rubbish1", fieldParameters{true, true, false, newInt64(42), newInt(17), 0, false, false}},
   358  	{"set", fieldParameters{set: true}},
   359  }
   360  
   361  func TestParseFieldParameters(t *testing.T) {
   362  	for i, test := range parseFieldParametersTestData {
   363  		f := parseFieldParameters(test.in)
   364  		if !reflect.DeepEqual(f, test.out) {
   365  			t.Errorf("#%d: Bad result: %v (expected %v)", i, f, test.out)
   366  		}
   367  	}
   368  }
   369  
   370  type TestObjectIdentifierStruct struct {
   371  	OID ObjectIdentifier
   372  }
   373  
   374  type TestContextSpecificTags struct {
   375  	A int `asn1:"tag:1"`
   376  }
   377  
   378  type TestContextSpecificTags2 struct {
   379  	A int `asn1:"explicit,tag:1"`
   380  	B int
   381  }
   382  
   383  type TestElementsAfterString struct {
   384  	S    string
   385  	A, B int
   386  }
   387  
   388  type TestBigInt struct {
   389  	X *big.Int
   390  }
   391  
   392  var unmarshalTestData = []struct {
   393  	in  []byte
   394  	out interface{}
   395  }{
   396  	{[]byte{0x02, 0x01, 0x42}, newInt(0x42)},
   397  	{[]byte{0x30, 0x08, 0x06, 0x06, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d}, &TestObjectIdentifierStruct{[]int{1, 2, 840, 113549}}},
   398  	{[]byte{0x03, 0x04, 0x06, 0x6e, 0x5d, 0xc0}, &BitString{[]byte{110, 93, 192}, 18}},
   399  	{[]byte{0x30, 0x09, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x01, 0x03}, &[]int{1, 2, 3}},
   400  	{[]byte{0x02, 0x01, 0x10}, newInt(16)},
   401  	{[]byte{0x13, 0x04, 't', 'e', 's', 't'}, newString("test")},
   402  	{[]byte{0x16, 0x04, 't', 'e', 's', 't'}, newString("test")},
   403  	{[]byte{0x16, 0x04, 't', 'e', 's', 't'}, &RawValue{0, 22, false, []byte("test"), []byte("\x16\x04test")}},
   404  	{[]byte{0x04, 0x04, 1, 2, 3, 4}, &RawValue{0, 4, false, []byte{1, 2, 3, 4}, []byte{4, 4, 1, 2, 3, 4}}},
   405  	{[]byte{0x30, 0x03, 0x81, 0x01, 0x01}, &TestContextSpecificTags{1}},
   406  	{[]byte{0x30, 0x08, 0xa1, 0x03, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02}, &TestContextSpecificTags2{1, 2}},
   407  	{[]byte{0x01, 0x01, 0x00}, newBool(false)},
   408  	{[]byte{0x01, 0x01, 0xff}, newBool(true)},
   409  	{[]byte{0x30, 0x0b, 0x13, 0x03, 0x66, 0x6f, 0x6f, 0x02, 0x01, 0x22, 0x02, 0x01, 0x33}, &TestElementsAfterString{"foo", 0x22, 0x33}},
   410  	{[]byte{0x30, 0x05, 0x02, 0x03, 0x12, 0x34, 0x56}, &TestBigInt{big.NewInt(0x123456)}},
   411  }
   412  
   413  func TestUnmarshal(t *testing.T) {
   414  	for i, test := range unmarshalTestData {
   415  		pv := reflect.New(reflect.TypeOf(test.out).Elem())
   416  		val := pv.Interface()
   417  		_, err := Unmarshal(test.in, val)
   418  		if err != nil {
   419  			t.Errorf("Unmarshal failed at index %d %v", i, err)
   420  		}
   421  		if !reflect.DeepEqual(val, test.out) {
   422  			t.Errorf("#%d:\nhave %#v\nwant %#v", i, val, test.out)
   423  		}
   424  	}
   425  }
   426  
   427  type Certificate struct {
   428  	TBSCertificate     TBSCertificate
   429  	SignatureAlgorithm AlgorithmIdentifier
   430  	SignatureValue     BitString
   431  }
   432  
   433  type TBSCertificate struct {
   434  	Version            int `asn1:"optional,explicit,default:0,tag:0"`
   435  	SerialNumber       RawValue
   436  	SignatureAlgorithm AlgorithmIdentifier
   437  	Issuer             RDNSequence
   438  	Validity           Validity
   439  	Subject            RDNSequence
   440  	PublicKey          PublicKeyInfo
   441  }
   442  
   443  type AlgorithmIdentifier struct {
   444  	Algorithm ObjectIdentifier
   445  }
   446  
   447  type RDNSequence []RelativeDistinguishedNameSET
   448  
   449  type RelativeDistinguishedNameSET []AttributeTypeAndValue
   450  
   451  type AttributeTypeAndValue struct {
   452  	Type  ObjectIdentifier
   453  	Value interface{}
   454  }
   455  
   456  type Validity struct {
   457  	NotBefore, NotAfter time.Time
   458  }
   459  
   460  type PublicKeyInfo struct {
   461  	Algorithm AlgorithmIdentifier
   462  	PublicKey BitString
   463  }
   464  
   465  func TestCertificate(t *testing.T) {
   466  	// This is a minimal, self-signed certificate that should parse correctly.
   467  	var cert Certificate
   468  	if _, err := Unmarshal(derEncodedSelfSignedCertBytes, &cert); err != nil {
   469  		t.Errorf("Unmarshal failed: %v", err)
   470  	}
   471  	if !reflect.DeepEqual(cert, derEncodedSelfSignedCert) {
   472  		t.Errorf("Bad result:\ngot: %+v\nwant: %+v", cert, derEncodedSelfSignedCert)
   473  	}
   474  }
   475  
   476  func TestCertificateWithNUL(t *testing.T) {
   477  	// This is the paypal NUL-hack certificate. It should fail to parse because
   478  	// NUL isn't a permitted character in a PrintableString.
   479  
   480  	var cert Certificate
   481  	if _, err := Unmarshal(derEncodedPaypalNULCertBytes, &cert); err == nil {
   482  		t.Error("Unmarshal succeeded, should not have")
   483  	}
   484  }
   485  
   486  type rawStructTest struct {
   487  	Raw RawContent
   488  	A   int
   489  }
   490  
   491  func TestRawStructs(t *testing.T) {
   492  	var s rawStructTest
   493  	input := []byte{0x30, 0x03, 0x02, 0x01, 0x50}
   494  
   495  	rest, err := Unmarshal(input, &s)
   496  	if len(rest) != 0 {
   497  		t.Errorf("incomplete parse: %x", rest)
   498  		return
   499  	}
   500  	if err != nil {
   501  		t.Error(err)
   502  		return
   503  	}
   504  	if s.A != 0x50 {
   505  		t.Errorf("bad value for A: got %d want %d", s.A, 0x50)
   506  	}
   507  	if !bytes.Equal([]byte(s.Raw), input) {
   508  		t.Errorf("bad value for Raw: got %x want %x", s.Raw, input)
   509  	}
   510  }
   511  
   512  func TestCouleBeISO8859_1(t *testing.T) {
   513  	for i := 0; i < 0xff; i++ {
   514  		b := []byte("StringWithA")
   515  		b = append(b, byte(i))
   516  		switch {
   517  		// These values are disallowed:
   518  		case i < 0x20, i >= 0x7f && i < 0xa0:
   519  			if couldBeISO8859_1(b) {
   520  				t.Fatalf("Allowed invalid value %d", i)
   521  			}
   522  
   523  		// These values are allowed:
   524  		case i >= 0x20 && i < 0x7f, i >= 0xa0 && i <= 0xff:
   525  			if !couldBeISO8859_1(b) {
   526  				t.Fatalf("Disallowed valid value %d", i)
   527  			}
   528  
   529  		default:
   530  			t.Fatalf("Test logic error - value %d not covered above", i)
   531  		}
   532  	}
   533  }
   534  
   535  func TestCouleBeT61(t *testing.T) {
   536  	for i := 0; i < 255; i++ {
   537  		b := []byte("StringWithA")
   538  		b = append(b, byte(i))
   539  
   540  		if couldBeT61(b) {
   541  			switch i {
   542  			case 0x00:
   543  				fallthrough
   544  			case 0x23, 0x24, 0x5C, 0x5E, 0x60, 0x7B, 0x7D, 0x7E, 0xA5, 0xA6, 0xAC, 0xAD, 0xAE, 0xAF,
   545  				0xB9, 0xBA, 0xC0, 0xC9, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9,
   546  				0xDA, 0xDB, 0xDC, 0xDE, 0xDF, 0xE5, 0xFF:
   547  				t.Fatalf("Allowed string with byte %d", i)
   548  			}
   549  		}
   550  	}
   551  }
   552  
   553  func TestISO8859_1ToUTF8(t *testing.T) {
   554  	b := []byte{'c', 'a', 'f', 0xE9} // 0xE9 == é in ISO8859-1, but is invalid in UTF8
   555  	if string(b) == "café" {
   556  		t.Fatal("Sanity failure: that shouldn't have matched")
   557  	}
   558  	if iso8859_1ToUTF8(b) != "café" {
   559  		t.Fatalf("Failed to convert properly, got %v", iso8859_1ToUTF8(b))
   560  	}
   561  }
   562  
   563  var derEncodedSelfSignedCert = Certificate{
   564  	TBSCertificate: TBSCertificate{
   565  		Version:            0,
   566  		SerialNumber:       RawValue{Class: 0, Tag: 2, IsCompound: false, Bytes: []uint8{0x0, 0x8c, 0xc3, 0x37, 0x92, 0x10, 0xec, 0x2c, 0x98}, FullBytes: []byte{2, 9, 0x0, 0x8c, 0xc3, 0x37, 0x92, 0x10, 0xec, 0x2c, 0x98}},
   567  		SignatureAlgorithm: AlgorithmIdentifier{Algorithm: ObjectIdentifier{1, 2, 840, 113549, 1, 1, 5}},
   568  		Issuer: RDNSequence{
   569  			RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 6}, Value: "XX"}},
   570  			RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 8}, Value: "Some-State"}},
   571  			RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 7}, Value: "City"}},
   572  			RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 10}, Value: "Internet Widgits Pty Ltd"}},
   573  			RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 3}, Value: "false.example.com"}},
   574  			RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{1, 2, 840, 113549, 1, 9, 1}, Value: "false@example.com"}},
   575  		},
   576  		Validity: Validity{
   577  			NotBefore: time.Date(2009, 10, 8, 00, 25, 53, 0, time.UTC),
   578  			NotAfter:  time.Date(2010, 10, 8, 00, 25, 53, 0, time.UTC),
   579  		},
   580  		Subject: RDNSequence{
   581  			RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 6}, Value: "XX"}},
   582  			RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 8}, Value: "Some-State"}},
   583  			RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 7}, Value: "City"}},
   584  			RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 10}, Value: "Internet Widgits Pty Ltd"}},
   585  			RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 3}, Value: "false.example.com"}},
   586  			RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{1, 2, 840, 113549, 1, 9, 1}, Value: "false@example.com"}},
   587  		},
   588  		PublicKey: PublicKeyInfo{
   589  			Algorithm: AlgorithmIdentifier{Algorithm: ObjectIdentifier{1, 2, 840, 113549, 1, 1, 1}},
   590  			PublicKey: BitString{
   591  				Bytes: []uint8{
   592  					0x30, 0x48, 0x2, 0x41, 0x0, 0xcd, 0xb7,
   593  					0x63, 0x9c, 0x32, 0x78, 0xf0, 0x6, 0xaa, 0x27, 0x7f, 0x6e, 0xaf, 0x42,
   594  					0x90, 0x2b, 0x59, 0x2d, 0x8c, 0xbc, 0xbe, 0x38, 0xa1, 0xc9, 0x2b, 0xa4,
   595  					0x69, 0x5a, 0x33, 0x1b, 0x1d, 0xea, 0xde, 0xad, 0xd8, 0xe9, 0xa5, 0xc2,
   596  					0x7e, 0x8c, 0x4c, 0x2f, 0xd0, 0xa8, 0x88, 0x96, 0x57, 0x72, 0x2a, 0x4f,
   597  					0x2a, 0xf7, 0x58, 0x9c, 0xf2, 0xc7, 0x70, 0x45, 0xdc, 0x8f, 0xde, 0xec,
   598  					0x35, 0x7d, 0x2, 0x3, 0x1, 0x0, 0x1,
   599  				},
   600  				BitLength: 592,
   601  			},
   602  		},
   603  	},
   604  	SignatureAlgorithm: AlgorithmIdentifier{Algorithm: ObjectIdentifier{1, 2, 840, 113549, 1, 1, 5}},
   605  	SignatureValue: BitString{
   606  		Bytes: []uint8{
   607  			0xa6, 0x7b, 0x6, 0xec, 0x5e, 0xce,
   608  			0x92, 0x77, 0x2c, 0xa4, 0x13, 0xcb, 0xa3, 0xca, 0x12, 0x56, 0x8f, 0xdc, 0x6c,
   609  			0x7b, 0x45, 0x11, 0xcd, 0x40, 0xa7, 0xf6, 0x59, 0x98, 0x4, 0x2, 0xdf, 0x2b,
   610  			0x99, 0x8b, 0xb9, 0xa4, 0xa8, 0xcb, 0xeb, 0x34, 0xc0, 0xf0, 0xa7, 0x8c, 0xf8,
   611  			0xd9, 0x1e, 0xde, 0x14, 0xa5, 0xed, 0x76, 0xbf, 0x11, 0x6f, 0xe3, 0x60, 0xaa,
   612  			0xfa, 0x88, 0x21, 0x49, 0x4, 0x35,
   613  		},
   614  		BitLength: 512,
   615  	},
   616  }
   617  
   618  var derEncodedSelfSignedCertBytes = []byte{
   619  	0x30, 0x82, 0x02, 0x18, 0x30,
   620  	0x82, 0x01, 0xc2, 0x02, 0x09, 0x00, 0x8c, 0xc3, 0x37, 0x92, 0x10, 0xec, 0x2c,
   621  	0x98, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
   622  	0x05, 0x05, 0x00, 0x30, 0x81, 0x92, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
   623  	0x04, 0x06, 0x13, 0x02, 0x58, 0x58, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55,
   624  	0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74,
   625  	0x65, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x04, 0x43,
   626  	0x69, 0x74, 0x79, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13,
   627  	0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64,
   628  	0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, 0x31,
   629  	0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x11, 0x66, 0x61, 0x6c,
   630  	0x73, 0x65, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
   631  	0x6d, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
   632  	0x01, 0x09, 0x01, 0x16, 0x11, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x40, 0x65, 0x78,
   633  	0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d,
   634  	0x30, 0x39, 0x31, 0x30, 0x30, 0x38, 0x30, 0x30, 0x32, 0x35, 0x35, 0x33, 0x5a,
   635  	0x17, 0x0d, 0x31, 0x30, 0x31, 0x30, 0x30, 0x38, 0x30, 0x30, 0x32, 0x35, 0x35,
   636  	0x33, 0x5a, 0x30, 0x81, 0x92, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
   637  	0x06, 0x13, 0x02, 0x58, 0x58, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04,
   638  	0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65,
   639  	0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x04, 0x43, 0x69,
   640  	0x74, 0x79, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x18,
   641  	0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67,
   642  	0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, 0x31, 0x1a,
   643  	0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x11, 0x66, 0x61, 0x6c, 0x73,
   644  	0x65, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
   645  	0x31, 0x20, 0x30, 0x1e, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
   646  	0x09, 0x01, 0x16, 0x11, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x40, 0x65, 0x78, 0x61,
   647  	0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x5c, 0x30, 0x0d, 0x06,
   648  	0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03,
   649  	0x4b, 0x00, 0x30, 0x48, 0x02, 0x41, 0x00, 0xcd, 0xb7, 0x63, 0x9c, 0x32, 0x78,
   650  	0xf0, 0x06, 0xaa, 0x27, 0x7f, 0x6e, 0xaf, 0x42, 0x90, 0x2b, 0x59, 0x2d, 0x8c,
   651  	0xbc, 0xbe, 0x38, 0xa1, 0xc9, 0x2b, 0xa4, 0x69, 0x5a, 0x33, 0x1b, 0x1d, 0xea,
   652  	0xde, 0xad, 0xd8, 0xe9, 0xa5, 0xc2, 0x7e, 0x8c, 0x4c, 0x2f, 0xd0, 0xa8, 0x88,
   653  	0x96, 0x57, 0x72, 0x2a, 0x4f, 0x2a, 0xf7, 0x58, 0x9c, 0xf2, 0xc7, 0x70, 0x45,
   654  	0xdc, 0x8f, 0xde, 0xec, 0x35, 0x7d, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x0d,
   655  	0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00,
   656  	0x03, 0x41, 0x00, 0xa6, 0x7b, 0x06, 0xec, 0x5e, 0xce, 0x92, 0x77, 0x2c, 0xa4,
   657  	0x13, 0xcb, 0xa3, 0xca, 0x12, 0x56, 0x8f, 0xdc, 0x6c, 0x7b, 0x45, 0x11, 0xcd,
   658  	0x40, 0xa7, 0xf6, 0x59, 0x98, 0x04, 0x02, 0xdf, 0x2b, 0x99, 0x8b, 0xb9, 0xa4,
   659  	0xa8, 0xcb, 0xeb, 0x34, 0xc0, 0xf0, 0xa7, 0x8c, 0xf8, 0xd9, 0x1e, 0xde, 0x14,
   660  	0xa5, 0xed, 0x76, 0xbf, 0x11, 0x6f, 0xe3, 0x60, 0xaa, 0xfa, 0x88, 0x21, 0x49,
   661  	0x04, 0x35,
   662  }
   663  
   664  var derEncodedPaypalNULCertBytes = []byte{
   665  	0x30, 0x82, 0x06, 0x44, 0x30,
   666  	0x82, 0x05, 0xad, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x03, 0x00, 0xf0, 0x9b,
   667  	0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,
   668  	0x05, 0x00, 0x30, 0x82, 0x01, 0x12, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
   669  	0x04, 0x06, 0x13, 0x02, 0x45, 0x53, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55,
   670  	0x04, 0x08, 0x13, 0x09, 0x42, 0x61, 0x72, 0x63, 0x65, 0x6c, 0x6f, 0x6e, 0x61,
   671  	0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x09, 0x42, 0x61,
   672  	0x72, 0x63, 0x65, 0x6c, 0x6f, 0x6e, 0x61, 0x31, 0x29, 0x30, 0x27, 0x06, 0x03,
   673  	0x55, 0x04, 0x0a, 0x13, 0x20, 0x49, 0x50, 0x53, 0x20, 0x43, 0x65, 0x72, 0x74,
   674  	0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41, 0x75, 0x74,
   675  	0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x20, 0x73, 0x2e, 0x6c, 0x2e, 0x31, 0x2e,
   676  	0x30, 0x2c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x14, 0x25, 0x67, 0x65, 0x6e, 0x65,
   677  	0x72, 0x61, 0x6c, 0x40, 0x69, 0x70, 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d,
   678  	0x20, 0x43, 0x2e, 0x49, 0x2e, 0x46, 0x2e, 0x20, 0x20, 0x42, 0x2d, 0x42, 0x36,
   679  	0x32, 0x32, 0x31, 0x30, 0x36, 0x39, 0x35, 0x31, 0x2e, 0x30, 0x2c, 0x06, 0x03,
   680  	0x55, 0x04, 0x0b, 0x13, 0x25, 0x69, 0x70, 0x73, 0x43, 0x41, 0x20, 0x43, 0x4c,
   681  	0x41, 0x53, 0x45, 0x41, 0x31, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69,
   682  	0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72,
   683  	0x69, 0x74, 0x79, 0x31, 0x2e, 0x30, 0x2c, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
   684  	0x25, 0x69, 0x70, 0x73, 0x43, 0x41, 0x20, 0x43, 0x4c, 0x41, 0x53, 0x45, 0x41,
   685  	0x31, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
   686  	0x6f, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31,
   687  	0x20, 0x30, 0x1e, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09,
   688  	0x01, 0x16, 0x11, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x40, 0x69, 0x70,
   689  	0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x30, 0x39,
   690  	0x30, 0x32, 0x32, 0x34, 0x32, 0x33, 0x30, 0x34, 0x31, 0x37, 0x5a, 0x17, 0x0d,
   691  	0x31, 0x31, 0x30, 0x32, 0x32, 0x34, 0x32, 0x33, 0x30, 0x34, 0x31, 0x37, 0x5a,
   692  	0x30, 0x81, 0x94, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
   693  	0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13,
   694  	0x0a, 0x43, 0x61, 0x6c, 0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, 0x61, 0x31, 0x16,
   695  	0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x0d, 0x53, 0x61, 0x6e, 0x20,
   696  	0x46, 0x72, 0x61, 0x6e, 0x63, 0x69, 0x73, 0x63, 0x6f, 0x31, 0x11, 0x30, 0x0f,
   697  	0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69,
   698  	0x74, 0x79, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x0b,
   699  	0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x55, 0x6e, 0x69, 0x74, 0x31, 0x2f,
   700  	0x30, 0x2d, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x26, 0x77, 0x77, 0x77, 0x2e,
   701  	0x70, 0x61, 0x79, 0x70, 0x61, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x73, 0x73,
   702  	0x6c, 0x2e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65,
   703  	0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x63, 0x63, 0x30, 0x81, 0x9f, 0x30, 0x0d,
   704  	0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00,
   705  	0x03, 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xd2, 0x69,
   706  	0xfa, 0x6f, 0x3a, 0x00, 0xb4, 0x21, 0x1b, 0xc8, 0xb1, 0x02, 0xd7, 0x3f, 0x19,
   707  	0xb2, 0xc4, 0x6d, 0xb4, 0x54, 0xf8, 0x8b, 0x8a, 0xcc, 0xdb, 0x72, 0xc2, 0x9e,
   708  	0x3c, 0x60, 0xb9, 0xc6, 0x91, 0x3d, 0x82, 0xb7, 0x7d, 0x99, 0xff, 0xd1, 0x29,
   709  	0x84, 0xc1, 0x73, 0x53, 0x9c, 0x82, 0xdd, 0xfc, 0x24, 0x8c, 0x77, 0xd5, 0x41,
   710  	0xf3, 0xe8, 0x1e, 0x42, 0xa1, 0xad, 0x2d, 0x9e, 0xff, 0x5b, 0x10, 0x26, 0xce,
   711  	0x9d, 0x57, 0x17, 0x73, 0x16, 0x23, 0x38, 0xc8, 0xd6, 0xf1, 0xba, 0xa3, 0x96,
   712  	0x5b, 0x16, 0x67, 0x4a, 0x4f, 0x73, 0x97, 0x3a, 0x4d, 0x14, 0xa4, 0xf4, 0xe2,
   713  	0x3f, 0x8b, 0x05, 0x83, 0x42, 0xd1, 0xd0, 0xdc, 0x2f, 0x7a, 0xe5, 0xb6, 0x10,
   714  	0xb2, 0x11, 0xc0, 0xdc, 0x21, 0x2a, 0x90, 0xff, 0xae, 0x97, 0x71, 0x5a, 0x49,
   715  	0x81, 0xac, 0x40, 0xf3, 0x3b, 0xb8, 0x59, 0xb2, 0x4f, 0x02, 0x03, 0x01, 0x00,
   716  	0x01, 0xa3, 0x82, 0x03, 0x21, 0x30, 0x82, 0x03, 0x1d, 0x30, 0x09, 0x06, 0x03,
   717  	0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x11, 0x06, 0x09, 0x60, 0x86,
   718  	0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x01, 0x04, 0x04, 0x03, 0x02, 0x06, 0x40,
   719  	0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x03, 0xf8,
   720  	0x30, 0x13, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x04, 0x0c, 0x30, 0x0a, 0x06, 0x08,
   721  	0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x30, 0x1d, 0x06, 0x03, 0x55,
   722  	0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x61, 0x8f, 0x61, 0x34, 0x43, 0x55, 0x14,
   723  	0x7f, 0x27, 0x09, 0xce, 0x4c, 0x8b, 0xea, 0x9b, 0x7b, 0x19, 0x25, 0xbc, 0x6e,
   724  	0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14,
   725  	0x0e, 0x07, 0x60, 0xd4, 0x39, 0xc9, 0x1b, 0x5b, 0x5d, 0x90, 0x7b, 0x23, 0xc8,
   726  	0xd2, 0x34, 0x9d, 0x4a, 0x9a, 0x46, 0x39, 0x30, 0x09, 0x06, 0x03, 0x55, 0x1d,
   727  	0x11, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x1d, 0x12, 0x04,
   728  	0x15, 0x30, 0x13, 0x81, 0x11, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x40,
   729  	0x69, 0x70, 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x72, 0x06, 0x09,
   730  	0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x0d, 0x04, 0x65, 0x16, 0x63,
   731  	0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20,
   732  	0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x4e,
   733  	0x4f, 0x54, 0x20, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x45, 0x44, 0x2e,
   734  	0x20, 0x43, 0x4c, 0x41, 0x53, 0x45, 0x41, 0x31, 0x20, 0x53, 0x65, 0x72, 0x76,
   735  	0x65, 0x72, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
   736  	0x65, 0x20, 0x69, 0x73, 0x73, 0x75, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x68,
   737  	0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x70,
   738  	0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x30, 0x2f, 0x06, 0x09, 0x60,
   739  	0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x02, 0x04, 0x22, 0x16, 0x20, 0x68,
   740  	0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x70,
   741  	0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61,
   742  	0x32, 0x30, 0x30, 0x32, 0x2f, 0x30, 0x43, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,
   743  	0x86, 0xf8, 0x42, 0x01, 0x04, 0x04, 0x36, 0x16, 0x34, 0x68, 0x74, 0x74, 0x70,
   744  	0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x70, 0x73, 0x63, 0x61,
   745  	0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61, 0x32, 0x30, 0x30,
   746  	0x32, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61, 0x32, 0x30, 0x30, 0x32, 0x43, 0x4c,
   747  	0x41, 0x53, 0x45, 0x41, 0x31, 0x2e, 0x63, 0x72, 0x6c, 0x30, 0x46, 0x06, 0x09,
   748  	0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x03, 0x04, 0x39, 0x16, 0x37,
   749  	0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69,
   750  	0x70, 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x73, 0x63,
   751  	0x61, 0x32, 0x30, 0x30, 0x32, 0x2f, 0x72, 0x65, 0x76, 0x6f, 0x63, 0x61, 0x74,
   752  	0x69, 0x6f, 0x6e, 0x43, 0x4c, 0x41, 0x53, 0x45, 0x41, 0x31, 0x2e, 0x68, 0x74,
   753  	0x6d, 0x6c, 0x3f, 0x30, 0x43, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8,
   754  	0x42, 0x01, 0x07, 0x04, 0x36, 0x16, 0x34, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a,
   755  	0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x70, 0x73, 0x63, 0x61, 0x2e, 0x63,
   756  	0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61, 0x32, 0x30, 0x30, 0x32, 0x2f,
   757  	0x72, 0x65, 0x6e, 0x65, 0x77, 0x61, 0x6c, 0x43, 0x4c, 0x41, 0x53, 0x45, 0x41,
   758  	0x31, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x3f, 0x30, 0x41, 0x06, 0x09, 0x60, 0x86,
   759  	0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x08, 0x04, 0x34, 0x16, 0x32, 0x68, 0x74,
   760  	0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x70, 0x73,
   761  	0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61, 0x32,
   762  	0x30, 0x30, 0x32, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x43, 0x4c, 0x41,
   763  	0x53, 0x45, 0x41, 0x31, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x30, 0x81, 0x83, 0x06,
   764  	0x03, 0x55, 0x1d, 0x1f, 0x04, 0x7c, 0x30, 0x7a, 0x30, 0x39, 0xa0, 0x37, 0xa0,
   765  	0x35, 0x86, 0x33, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77,
   766  	0x2e, 0x69, 0x70, 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70,
   767  	0x73, 0x63, 0x61, 0x32, 0x30, 0x30, 0x32, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61,
   768  	0x32, 0x30, 0x30, 0x32, 0x43, 0x4c, 0x41, 0x53, 0x45, 0x41, 0x31, 0x2e, 0x63,
   769  	0x72, 0x6c, 0x30, 0x3d, 0xa0, 0x3b, 0xa0, 0x39, 0x86, 0x37, 0x68, 0x74, 0x74,
   770  	0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x62, 0x61, 0x63, 0x6b, 0x2e, 0x69,
   771  	0x70, 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x73, 0x63,
   772  	0x61, 0x32, 0x30, 0x30, 0x32, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61, 0x32, 0x30,
   773  	0x30, 0x32, 0x43, 0x4c, 0x41, 0x53, 0x45, 0x41, 0x31, 0x2e, 0x63, 0x72, 0x6c,
   774  	0x30, 0x32, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04,
   775  	0x26, 0x30, 0x24, 0x30, 0x22, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
   776  	0x30, 0x01, 0x86, 0x16, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6f, 0x63,
   777  	0x73, 0x70, 0x2e, 0x69, 0x70, 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
   778  	0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,
   779  	0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x68, 0xee, 0x79, 0x97, 0x97, 0xdd, 0x3b,
   780  	0xef, 0x16, 0x6a, 0x06, 0xf2, 0x14, 0x9a, 0x6e, 0xcd, 0x9e, 0x12, 0xf7, 0xaa,
   781  	0x83, 0x10, 0xbd, 0xd1, 0x7c, 0x98, 0xfa, 0xc7, 0xae, 0xd4, 0x0e, 0x2c, 0x9e,
   782  	0x38, 0x05, 0x9d, 0x52, 0x60, 0xa9, 0x99, 0x0a, 0x81, 0xb4, 0x98, 0x90, 0x1d,
   783  	0xae, 0xbb, 0x4a, 0xd7, 0xb9, 0xdc, 0x88, 0x9e, 0x37, 0x78, 0x41, 0x5b, 0xf7,
   784  	0x82, 0xa5, 0xf2, 0xba, 0x41, 0x25, 0x5a, 0x90, 0x1a, 0x1e, 0x45, 0x38, 0xa1,
   785  	0x52, 0x58, 0x75, 0x94, 0x26, 0x44, 0xfb, 0x20, 0x07, 0xba, 0x44, 0xcc, 0xe5,
   786  	0x4a, 0x2d, 0x72, 0x3f, 0x98, 0x47, 0xf6, 0x26, 0xdc, 0x05, 0x46, 0x05, 0x07,
   787  	0x63, 0x21, 0xab, 0x46, 0x9b, 0x9c, 0x78, 0xd5, 0x54, 0x5b, 0x3d, 0x0c, 0x1e,
   788  	0xc8, 0x64, 0x8c, 0xb5, 0x50, 0x23, 0x82, 0x6f, 0xdb, 0xb8, 0x22, 0x1c, 0x43,
   789  	0x96, 0x07, 0xa8, 0xbb,
   790  }