I'm interested in bitcoin protocol and checking validation of a transaction.

in a TX message, we can see one or more than one input transaction and every input transaction has a previous transaction and a script. As you know probably, the script contains two components, a signature and a public key. The public key must match the hash given in the script of the redeemed output. The public key is used to verify the redeemers signature, which is the second component. I want to parse signature and public key at first step, and in the following I want to check the validation if transaction from public key. anyone can help me?