Improved keystore exceptions handling