I do love my dogs. Fortunately, neither is aggressive (although barks very loud: ear asssault...), but some choose their dogs for exatly that trait: aggression.
I cannot comment on the legality of your situation, I'm afraid, but if your safety, indeed life, or those of another person (assuming that other person were definitely not an aggressor) are in danger, I'd have to say, yes, use your gun if that seems the best course of action.
Unfortunately for dogs, even if they were defending their owner, if they have attacked a human, I think most would be put down.
Sorry that this is not a legally specific answer.
You cannot wake someone who is pretending to sleep. Stop pretending. Wake up.
Freedom: Please enjoy responsibly.
Any idea that relies on murder for its survival in intrinsically weak.