@@ -44,81 +44,56 @@ func TestCustomHeaders(t *testing.T) {
44
44
c .Close ()
45
45
}
46
46
47
- // with the update Go to 1.20, these Unit Tests start failing,
48
- // since this test is related to client side, and the "fingerprint" flag is not available in cloud-connector
49
- // we can remove/comment these 3 Unit Tests, until fixed in upstream
50
-
51
- // func TestFallbackLegacyFingerprint(t *testing.T) {
52
- // config := Config{
53
- // Fingerprint: "a5:32:92:c6:56:7a:9e:61:26:74:1b:81:a6:f5:1b:44",
54
- // }
55
- // c, err := NewClient(&config)
56
- // if err != nil {
57
- // t.Fatal(err)
58
- // }
59
- // r := ccrypto.NewDetermRand([]byte("test123"))
60
- // priv, err := ecdsa.GenerateKey(elliptic.P256(), r)
61
- // if err != nil {
62
- // t.Fatal(err)
63
- // }
64
- // pub, err := ssh.NewPublicKey(&priv.PublicKey)
65
- // if err != nil {
66
- // t.Fatal(err)
67
- // }
68
- // err = c.verifyServer("", nil, pub)
69
- // if err != nil {
70
- // t.Fatal(err)
71
- // }
72
- // }
73
-
74
- // func TestVerifyLegacyFingerprint(t *testing.T) {
75
- // config := Config{
76
- // Fingerprint: "a5:32:92:c6:56:7a:9e:61:26:74:1b:81:a6:f5:1b:44",
77
- // }
78
- // c, err := NewClient(&config)
79
- // if err != nil {
80
- // t.Fatal(err)
81
- // }
82
- // r := ccrypto.NewDetermRand([]byte("test123"))
83
- // priv, err := ecdsa.GenerateKey(elliptic.P256(), r)
84
- // if err != nil {
85
- // t.Fatal(err)
86
- // }
87
- // pub, err := ssh.NewPublicKey(&priv.PublicKey)
88
- // if err != nil {
89
- // t.Fatal(err)
90
- // }
91
- // err = c.verifyLegacyFingerprint(pub)
92
- // if err != nil {
93
- // t.Fatal(err)
94
- // }
95
- // }
47
+ func TestFallbackLegacyFingerprint (t * testing.T ) {
48
+ config := Config {
49
+ Fingerprint : "a5:32:92:c6:56:7a:9e:61:26:74:1b:81:a6:f5:1b:44" ,
50
+ }
51
+ c , err := NewClient (& config )
52
+ if err != nil {
53
+ t .Fatal (err )
54
+ }
55
+ r := ccrypto .NewDetermRand ([]byte ("test123" ))
56
+ priv , err := ccrypto .GenerateKeyGo119 (elliptic .P256 (), r )
57
+ if err != nil {
58
+ t .Fatal (err )
59
+ }
60
+ pub , err := ssh .NewPublicKey (& priv .PublicKey )
61
+ if err != nil {
62
+ t .Fatal (err )
63
+ }
64
+ err = c .verifyServer ("" , nil , pub )
65
+ if err != nil {
66
+ t .Fatal (err )
67
+ }
68
+ }
96
69
97
- // func TestVerifyFingerprint (t *testing.T) {
98
- // config := Config{
99
- // Fingerprint: "qmrRoo8MIqePv3jC8+wv49gU6uaFgD3FASQx9V8KdmY= ",
100
- // }
101
- // c, err := NewClient(&config)
102
- // if err != nil {
103
- // t.Fatal(err)
104
- // }
105
- // r := ccrypto.NewDetermRand([]byte("test123"))
106
- // priv, err := ecdsa.GenerateKey (elliptic.P256(), r)
107
- // if err != nil {
108
- // t.Fatal(err)
109
- // }
110
- // pub, err := ssh.NewPublicKey(&priv.PublicKey)
111
- // if err != nil {
112
- // t.Fatal(err)
113
- // }
114
- // err = c.verifyServer("", nil, pub)
115
- // if err != nil {
116
- // t.Fatal(err)
117
- // }
118
- // }
70
+ func TestVerifyLegacyFingerprint (t * testing.T ) {
71
+ config := Config {
72
+ Fingerprint : "a5:32:92:c6:56:7a:9e:61:26:74:1b:81:a6:f5:1b:44 " ,
73
+ }
74
+ c , err := NewClient (& config )
75
+ if err != nil {
76
+ t .Fatal (err )
77
+ }
78
+ r := ccrypto .NewDetermRand ([]byte ("test123" ))
79
+ priv , err := ccrypto . GenerateKeyGo119 (elliptic .P256 (), r )
80
+ if err != nil {
81
+ t .Fatal (err )
82
+ }
83
+ pub , err := ssh .NewPublicKey (& priv .PublicKey )
84
+ if err != nil {
85
+ t .Fatal (err )
86
+ }
87
+ err = c .verifyLegacyFingerprint ( pub )
88
+ if err != nil {
89
+ t .Fatal (err )
90
+ }
91
+ }
119
92
120
- func TestVerifyEmptyFingerprint (t * testing.T ) {
121
- config := Config {}
93
+ func TestVerifyFingerprint (t * testing.T ) {
94
+ config := Config {
95
+ Fingerprint : "qmrRoo8MIqePv3jC8+wv49gU6uaFgD3FASQx9V8KdmY=" ,
96
+ }
122
97
c , err := NewClient (& config )
123
98
if err != nil {
124
99
t .Fatal (err )
0 commit comments