Added certificate download logic