Fixing authorized_keys module to make the key part detection better

Fixes #4677
Fixes #4657
Fixes #4599