It's my turn. Before my attack phase my opponent casts shock on a 1/1 creature I have, dealing 2 damage to it. I want to cast an enchantment aura that gives 1/1 creature +1/+3 in response to the 2 damage. Can you put the enchantment aura on the stack like that?
Also, in the opposite scenario, if an opponent uses shock in response to the enchantment aura, would the damage resolve before the enchantment stuck... killing the creature before the enchantment resolved on the stack?
It's my turn. Before my attack phase my opponent casts shock on a 1/1 creature I have, dealing 2 damage to it. I want to cast an enchantment aura that gives 1/1 creature +1/+3 in response to the 2 damage. Can you put the enchantment aura on the stack like that?
You can't, unless that Aura has Flash.
The only spells you can cast in response to another spell are Instants and those with the Flash keyword. The other types of spells need the stack to be empty (and it be currently your main phase).
Also, in the opposite scenario, if an opponent uses shock in response to the enchantment aura, would the damage resolve before the enchantment stuck... killing the creature before the enchantment resolved on the stack?
Yes. A spell cast in response to another resolves first.
In general, you can cast an Aura spell (a noninstant spell) during your main phase while you have priority and the stack is empty (C.R. 117.1a), but the rules have no window to cast such a spell at other moments except as an incidental part of another action or event (under C.R. 608.2f, for example) and except when an effect allows it (for example, if the Aura spell has flash [C.R. 702.8a]).
On the other hand, if the target of the Aura spell is illegal when it would resolve (for example, a creature that's the target of an Aura spell with "enchant creature" has left the battlefield), the spell fails to resolve (C.R. 608.2b).
As with any other spell, you announce what an Aura spell targets as you cast it (C.R. 601.2c), and any spell cast in response to the Aura spell will get to resolve before the Aura spell does (C.R. 117.7).
EDIT (Apr. 7, 2020): Edited, including because some rules were renumbered with Core Set 2020.
Ok well in this case I was at a prerelease event. I was playing that white enchantment aura that you can pay 1 white mana to return it to your hand. During my main phase I returned it to my hand from one creature and was going to place it on another creature. After I had paid the cost to apply it to my new creature my opponent interrupted me and said "before you attach that to the other creature I cast shock". Is this also acceptable?
Yes. You simply casted the spell, and your opponent responded to that, meaning his spell resolves first. Your creature dies, and your Conviction is countered when it tries to resolve.
Also, in the opposite scenario, if an opponent uses shock in response to the enchantment aura, would the damage resolve before the enchantment stuck... killing the creature before the enchantment resolved on the stack?
You can't, unless that Aura has Flash.
The only spells you can cast in response to another spell are Instants and those with the Flash keyword. The other types of spells need the stack to be empty (and it be currently your main phase).
Yes. A spell cast in response to another resolves first.
On the other hand, if the target of the Aura spell is illegal when it would resolve (for example, a creature that's the target of an Aura spell with "enchant creature" has left the battlefield), the spell fails to resolve (C.R. 608.2b).
As with any other spell, you announce what an Aura spell targets as you cast it (C.R. 601.2c), and any spell cast in response to the Aura spell will get to resolve before the Aura spell does (C.R. 117.7).
EDIT (Apr. 7, 2020): Edited, including because some rules were renumbered with Core Set 2020.
Former Rules Advisor
"Everything's better with pirates." - Lodge
(The Gamers: Dorkness Rising)
"Any sufficiently analyzed magic is indistinguishable from science."
(Girl Genius - Fairy Tale Theater Break - Cinderella, end of volume 8)