Getting certificate from store and also doing error check