How can I gain the trust of a dog?
Sure, to establish trust with an unfamiliar dog, first:

1. Make sure the owner is OK with you approaching their dog. Some dogs are just not sociable, and you should respect the owner's wishes as well as the dog's space, otherwise you will be in potential danger. 
2. Approach the dog calmly and at an angle. Do not make direct eye contact as it could be seen as a sign of aggression.
3. Hold out your hand to where the dog can see it and let the dog smell it first, so that it knows that you mean no harm.
4. If the dog does not display any signs of aggression, you can then try to pet it as it has established a basic level of trust with you.