I wrote the code in C# using SCardTransmit and the commands you mentioned, first loading the key and then authenticating for the block I wanted to read or write.
I am attaching some screenshots of my code in case they help you form the commands.
To load Key:
To Authentication: