In pinentry-gtk2, the "ESC" key is not handled correctly (it's currently
completely ignored).
ESC should dismiss the dialog and/or be equivalent to cancel (when handling
CONFIRM).
The attached patch fixes this behavior, making pinentry-gtk2 functionally
equivalent to pinentry-gtk (where this behavior was correctly handled).
See:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=516489
for an external report.