[MDEV-25343] Error log message not helpful when encryption key is too long Created: 2021-04-06 Updated: 2022-10-21 Resolved: 2022-10-21 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Encryption |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.3.37, 10.4.27, 10.5.18, 10.6.11, 10.7.7, 10.8.6, 10.9.4, 10.10.2, 10.11.1 |
| Type: | Bug | Priority: | Minor |
| Reporter: | thenatsky | Assignee: | Daniel Black |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | beginner-friendly, configuration, encryption, errorlog | ||
| Attachments: |
|
| Description |
|
Relevant Configuration in mariadb.cnf:
Error log:
After hours of trying different things, it turned out that the key was too long (I'd inadvertently used 512 characters). Recreated the file_key_management_filename and file_key_management_filekey using a 256 character key and it all worked fine. I suggest checking the length (if not already happening) and then issuing a more helpful error like "Cannot decrypt <file_key_management_filename>. <file_key_management_filekey> has incorrect length" This would have helped me realise where the error was (ie between chair and keyboard) and would have taken less than a minute to address. |
| Comments |
| Comment by kurt.ding [ 2022-09-16 ] |
|
I add a note to notify user like the picture below . Is it ok? |
| Comment by kurt.ding [ 2022-09-16 ] |
| Comment by Daniel Black [ 2022-10-19 ] |
|
Sorry I needed to revert this. The reasons are per https://github.com/MariaDB/server/pull/2291. The default file is 257 bytes. Can you use a slightly bigger buffer and do the error after the loop at https://github.com/MariaDB/server/pull/2269/files#diff-ce8ad7f3ded93731629fb46916155d0516b54be01df6f3398f0cc1fafb884b28R196 when len is reduced. |
| Comment by kurt.ding [ 2022-10-19 ] |
|
I got your message , the reason is that 128 bit key but has 257 bytes. |
| Comment by Daniel Black [ 2022-10-21 ] |
|
Thanks Kurt Ding for the rework to make these additional test cases. |