@@ -58,100 +58,116 @@ pub static SUPPORTED_SIG_ALGS: WebPkiSupportedAlgorithms = WebPkiSupportedAlgori
58
58
59
59
/// RSA PKCS#1 1.5 signatures using SHA-256.
60
60
pub ( crate ) static RSA_PKCS1_SHA256 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
61
+ display_name : "RSA_PKCS1_SHA256" ,
61
62
public_key_alg_id : alg_id:: RSA_ENCRYPTION ,
62
63
signature_alg_id : alg_id:: RSA_PKCS1_SHA256 ,
63
64
} ;
64
65
65
66
/// RSA PKCS#1 1.5 signatures using SHA-384.
66
67
pub ( crate ) static RSA_PKCS1_SHA384 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
68
+ display_name : "RSA_PKCS1_SHA384" ,
67
69
public_key_alg_id : alg_id:: RSA_ENCRYPTION ,
68
70
signature_alg_id : alg_id:: RSA_PKCS1_SHA384 ,
69
71
} ;
70
72
71
73
/// RSA PKCS#1 1.5 signatures using SHA-512.
72
74
pub ( crate ) static RSA_PKCS1_SHA512 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
75
+ display_name : "RSA_PKCS1_SHA512" ,
73
76
public_key_alg_id : alg_id:: RSA_ENCRYPTION ,
74
77
signature_alg_id : alg_id:: RSA_PKCS1_SHA512 ,
75
78
} ;
76
79
77
80
/// RSA PSS signatures using SHA-256.
78
81
pub ( crate ) static RSA_PSS_SHA256 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
82
+ display_name : "RSA_PSS_SHA256" ,
79
83
public_key_alg_id : alg_id:: RSA_ENCRYPTION ,
80
84
signature_alg_id : alg_id:: RSA_PSS_SHA256 ,
81
85
} ;
82
86
83
87
/// RSA PSS signatures using SHA-384.
84
88
pub ( crate ) static RSA_PSS_SHA384 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
89
+ display_name : "RSA_PSS_SHA384" ,
85
90
public_key_alg_id : alg_id:: RSA_ENCRYPTION ,
86
91
signature_alg_id : alg_id:: RSA_PSS_SHA384 ,
87
92
} ;
88
93
89
94
/// RSA PSS signatures using SHA-512.
90
95
pub ( crate ) static RSA_PSS_SHA512 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
96
+ display_name : "RSA_PSS_SHA512" ,
91
97
public_key_alg_id : alg_id:: RSA_ENCRYPTION ,
92
98
signature_alg_id : alg_id:: RSA_PSS_SHA512 ,
93
99
} ;
94
100
95
101
#[ cfg( not( feature = "fips" ) ) ]
96
102
/// ED25519 signatures according to RFC 8410
97
103
pub ( crate ) static ED25519 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
104
+ display_name : "ED25519" ,
98
105
public_key_alg_id : alg_id:: ED25519 ,
99
106
signature_alg_id : alg_id:: ED25519 ,
100
107
} ;
101
108
102
109
/// ECDSA signatures using the P-256 curve and SHA-256.
103
110
pub ( crate ) static ECDSA_P256_SHA256 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
111
+ display_name : "ECDSA_P256_SHA256" ,
104
112
public_key_alg_id : alg_id:: ECDSA_P256 ,
105
113
signature_alg_id : alg_id:: ECDSA_SHA256 ,
106
114
} ;
107
115
108
116
/// ECDSA signatures using the P-256 curve and SHA-384. Deprecated.
109
117
pub ( crate ) static ECDSA_P256_SHA384 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
118
+ display_name : "ECDSA_P256_SHA384" ,
110
119
public_key_alg_id : alg_id:: ECDSA_P256 ,
111
120
signature_alg_id : alg_id:: ECDSA_SHA384 ,
112
121
} ;
113
122
114
123
/// ECDSA signatures using the P-384 curve and SHA-256. Deprecated.
115
124
pub ( crate ) static ECDSA_P384_SHA256 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
125
+ display_name : "ECDSA_P384_SHA256" ,
116
126
public_key_alg_id : alg_id:: ECDSA_P384 ,
117
127
signature_alg_id : alg_id:: ECDSA_SHA256 ,
118
128
} ;
119
129
120
130
/// ECDSA signatures using the P-384 curve and SHA-384.
121
131
pub ( crate ) static ECDSA_P384_SHA384 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
132
+ display_name : "ECDSA_P384_SHA384" ,
122
133
public_key_alg_id : alg_id:: ECDSA_P384 ,
123
134
signature_alg_id : alg_id:: ECDSA_SHA384 ,
124
135
} ;
125
136
126
137
/// ECDSA signatures using the P-521 curve and SHA-256.
127
138
pub ( crate ) static ECDSA_P521_SHA256 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
139
+ display_name : "ECDSA_P521_SHA256" ,
128
140
public_key_alg_id : alg_id:: ECDSA_P521 ,
129
141
signature_alg_id : alg_id:: ECDSA_SHA256 ,
130
142
} ;
131
143
132
144
/// ECDSA signatures using the P-521 curve and SHA-384.
133
145
pub ( crate ) static ECDSA_P521_SHA384 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
146
+ display_name : "ECDSA_P521_SHA384" ,
134
147
public_key_alg_id : alg_id:: ECDSA_P521 ,
135
148
signature_alg_id : alg_id:: ECDSA_SHA384 ,
136
149
} ;
137
150
138
151
/// ECDSA signatures using the P-521 curve and SHA-512.
139
152
pub ( crate ) static ECDSA_P521_SHA512 : & dyn SignatureVerificationAlgorithm = & OpenSslAlgorithm {
153
+ display_name : "ECDSA_P521_SHA512" ,
140
154
public_key_alg_id : alg_id:: ECDSA_P521 ,
141
155
signature_alg_id : alg_id:: ECDSA_SHA512 ,
142
156
} ;
143
157
144
158
struct OpenSslAlgorithm {
159
+ display_name : & ' static str ,
145
160
public_key_alg_id : AlgorithmIdentifier ,
146
161
signature_alg_id : AlgorithmIdentifier ,
147
162
}
148
163
149
164
impl fmt:: Debug for OpenSslAlgorithm {
150
165
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
151
- f. debug_struct ( "OpenSSLAlgorithm" )
152
- . field ( "public_key_alg_id" , & self . public_key_alg_id )
153
- . field ( "signature_alg_id" , & self . signature_alg_id )
154
- . finish ( )
166
+ write ! (
167
+ f,
168
+ "rustls_openssl Signature Verification Algorithm: {}" ,
169
+ self . display_name
170
+ )
155
171
}
156
172
}
157
173
@@ -293,3 +309,20 @@ impl SignatureVerificationAlgorithm for OpenSslAlgorithm {
293
309
crate :: fips ( )
294
310
}
295
311
}
312
+
313
+ #[ cfg( test) ]
314
+ mod tests {
315
+ use super :: * ;
316
+
317
+ #[ test]
318
+ fn test_open_ssl_algorithm_debug ( ) {
319
+ assert_eq ! (
320
+ format!( "{:?}" , ECDSA_P256_SHA256 ) ,
321
+ "rustls_openssl Signature Verification Algorithm: ECDSA_P256_SHA256"
322
+ ) ;
323
+ assert_eq ! (
324
+ format!( "{:?}" , RSA_PSS_SHA256 ) ,
325
+ "rustls_openssl Signature Verification Algorithm: RSA_PSS_SHA256"
326
+ ) ;
327
+ }
328
+ }
0 commit comments