The gpg-agent somehow prevent the use of the SHA2 digest family when using
openpgp smartcards version 2.
If you try to create a >=sha256 signature gnupg refuses to sign the message:
gpg: checking created signature failed: Bad signature gpg: signing failed: Bad signature
If you bypass the agent with gnupg v1 signing works without problem:
$ gpg --disable-ccid --no-use-agent -vas --digest-algo sha256
If gpg-agent tries to connect to the pcsc daemon signing will not work. If gnupg
conntects via pcsc it works.