1
1
// Copyright 2024 Contributors to the Parsec project.
2
2
// SPDX-License-Identifier: Apache-2.0
3
3
use e2e_tests:: * ;
4
+ const RSA : & [ u8 ; 8 ] = b"RSA-PSS\0 " ;
5
+ const ECDSA : & [ u8 ; 3 ] = b"EC\0 " ;
6
+ const NONE : & [ u8 ; 5 ] = b"None\0 " ;
4
7
5
8
#[ test]
6
9
fn test_handshake_no_authentication ( ) {
@@ -16,7 +19,7 @@ fn test_handshake_no_authentication() {
16
19
server. accept ( listener) ;
17
20
18
21
let client = Client :: new ( None , None , None , SslVerifyMode :: NONE ) ;
19
- client. connect ( addr) ;
22
+ client. connect ( addr, NONE ) ;
20
23
}
21
24
22
25
#[ should_panic]
@@ -34,7 +37,7 @@ fn test_handshake_server_authentication_no_client_ca() {
34
37
server. accept ( listener) ;
35
38
36
39
let client = Client :: new ( None , None , None , SslVerifyMode :: PEER ) ;
37
- client. connect ( addr) ;
40
+ client. connect ( addr, NONE ) ;
38
41
}
39
42
40
43
#[ test]
@@ -56,7 +59,7 @@ fn test_handshake_server_authentication_with_client_ca() {
56
59
Some ( String :: from ( "../../tests/tls/ca/ca_cert.pem" ) ) ,
57
60
SslVerifyMode :: PEER ,
58
61
) ;
59
- client. connect ( addr) ;
62
+ client. connect ( addr, NONE ) ;
60
63
}
61
64
62
65
#[ should_panic]
@@ -79,7 +82,7 @@ fn test_handshake_client_authentication_with_no_client_settings() {
79
82
Some ( String :: from ( "../../tests/tls/ca/ca_cert.pem" ) ) ,
80
83
SslVerifyMode :: PEER ,
81
84
) ;
82
- client. connect ( addr) ;
85
+ client. connect ( addr, NONE ) ;
83
86
}
84
87
85
88
#[ should_panic]
@@ -102,7 +105,7 @@ fn test_handshake_client_authentication_with_no_rsa_client_key() {
102
105
Some ( String :: from ( "../../tests/tls/ca/ca_cert.pem" ) ) ,
103
106
SslVerifyMode :: PEER ,
104
107
) ;
105
- client. connect ( addr) ;
108
+ client. connect ( addr, RSA ) ;
106
109
}
107
110
108
111
#[ should_panic]
@@ -125,7 +128,7 @@ fn test_handshake_client_authentication_with_no_ecdsa_client_key() {
125
128
Some ( String :: from ( "../../tests/tls/ca/ca_cert.pem" ) ) ,
126
129
SslVerifyMode :: PEER ,
127
130
) ;
128
- client. connect ( addr) ;
131
+ client. connect ( addr, ECDSA ) ;
129
132
}
130
133
131
134
#[ test]
@@ -147,7 +150,7 @@ fn test_handshake_client_authentication_rsa() {
147
150
Some ( String :: from ( "../../tests/tls/ca/ca_cert.pem" ) ) ,
148
151
SslVerifyMode :: PEER ,
149
152
) ;
150
- client. connect ( addr) ;
153
+ client. connect ( addr, RSA ) ;
151
154
}
152
155
153
156
#[ test]
@@ -169,7 +172,7 @@ fn test_handshake_client_authentication_ecdsa() {
169
172
Some ( String :: from ( "../../tests/tls/ca/ca_cert.pem" ) ) ,
170
173
SslVerifyMode :: PEER ,
171
174
) ;
172
- client. connect ( addr) ;
175
+ client. connect ( addr, ECDSA ) ;
173
176
}
174
177
175
178
#[ should_panic]
@@ -192,7 +195,7 @@ fn test_handshake_client_authentication_with_fake_ca() {
192
195
Some ( String :: from ( "../../tests/tls/fake_ca/ca_cert.pem" ) ) ,
193
196
SslVerifyMode :: PEER ,
194
197
) ;
195
- client. connect ( addr) ;
198
+ client. connect ( addr, RSA ) ;
196
199
}
197
200
198
201
// This is a negative test case. When a client is configured with a wrong certificate for a private
@@ -203,6 +206,7 @@ fn test_client_with_mismatched_rsa_key_and_certificate() {
203
206
check_mismatched_key_certificate (
204
207
String :: from ( "PARSEC_TEST_RSA_KEY" ) ,
205
208
String :: from ( "../../tests/tls/fake_client/parsec_rsa.pem" ) ,
209
+ RSA ,
206
210
) ;
207
211
}
208
212
@@ -214,5 +218,6 @@ fn test_client_with_mismatched_ecdsa_key_and_certificate() {
214
218
check_mismatched_key_certificate (
215
219
String :: from ( "PARSEC_TEST_ECDSA_KEY" ) ,
216
220
String :: from ( "../../tests/tls/fake_client/parsec_ecdsa.pem" ) ,
221
+ ECDSA ,
217
222
) ;
218
223
}
0 commit comments