keystore: Fix build with gcc 4.7+ -Werror

Fix code fragments that are errors in ISO C++11 mode, and cause warnings in gcc 4.7+ -Werror (narrowing conversions inside {})