enhanced cert generation script