|
8 | 8 | %% test cases |
9 | 9 | -export([ |
10 | 10 | regular_scram_authentication_example_from_the_rfc/1, |
11 | | - regular_scram_authentication/1, |
| 11 | + regular_scram_authentication_sha1/1, |
| 12 | + regular_scram_authentication_sha2/1, |
| 13 | + regular_scram_authentication_sha3/1, |
12 | 14 | wrong_configuration_key/1, |
13 | 15 | configuration_client_sends_wrong_username/1, |
14 | 16 | configuration_cached_keys_works_easily/0, |
@@ -73,7 +75,9 @@ groups() -> |
73 | 75 | [ |
74 | 76 | {verifications, [parallel], [ |
75 | 77 | regular_scram_authentication_example_from_the_rfc, |
76 | | - regular_scram_authentication, |
| 78 | + regular_scram_authentication_sha1, |
| 79 | + regular_scram_authentication_sha2, |
| 80 | + regular_scram_authentication_sha3, |
77 | 81 | wrong_configuration_key, |
78 | 82 | verification_name_escapes_values_correctly, |
79 | 83 | verification_name_does_not_escape_values_correctly, |
@@ -152,18 +156,33 @@ regular_scram_authentication_example_from_the_rfc(_Config) -> |
152 | 156 | %% Client successfully accepts the server's verifier |
153 | 157 | {ok, _Final, _ClientState7} = fast_scram:mech_step(ClientState5, ServerFinal). |
154 | 158 |
|
155 | | -regular_scram_authentication(_Config) -> |
| 159 | +regular_scram_authentication_sha1(_Config) -> |
| 160 | + regular_scram_authentication(_Config, sha). |
| 161 | + |
| 162 | +regular_scram_authentication_sha2(_Config) -> |
| 163 | + regular_scram_authentication(_Config, sha224), |
| 164 | + regular_scram_authentication(_Config, sha256), |
| 165 | + regular_scram_authentication(_Config, sha384), |
| 166 | + regular_scram_authentication(_Config, sha512). |
| 167 | + |
| 168 | +regular_scram_authentication_sha3(_Config) -> |
| 169 | + regular_scram_authentication(_Config, sha3_224), |
| 170 | + regular_scram_authentication(_Config, sha3_256), |
| 171 | + regular_scram_authentication(_Config, sha3_384), |
| 172 | + regular_scram_authentication(_Config, sha3_512). |
| 173 | + |
| 174 | +regular_scram_authentication(_Config, Hash) -> |
156 | 175 | Password = base64:encode(crypto:strong_rand_bytes(8 + rand:uniform(8))), |
157 | 176 | {ok, ClientState1} = fast_scram:mech_new(#{ |
158 | 177 | entity => client, |
159 | | - hash_method => sha256, |
| 178 | + hash_method => Hash, |
160 | 179 | username => <<"user">>, |
161 | 180 | auth_data => #{password => Password} |
162 | 181 | }), |
163 | 182 | {ok, ServerState2} = fast_scram:mech_new( |
164 | 183 | #{ |
165 | 184 | entity => server, |
166 | | - hash_method => sha256, |
| 185 | + hash_method => Hash, |
167 | 186 | username => <<"user">>, |
168 | 187 | retrieve_mechanism => |
169 | 188 | fun(U, S) -> retrieve_mechanism(U, #{password => Password}, S) end |
|
0 commit comments