[Briefly, double imputation is excellently summed up by B.B. Warfield, who writes:
…the sins of [God’s] people were so set to the account of our Lord that He bore them in His own body on the tree, and His merits are so set to their account that by His stripes they are healed, the entirety of historical orthodox Christianity unites in affirming.
There are many who would like to make Martin Luther and John Calvin the authors of this blessed doctrine which is at the very core of the Gospel, seeking to derive their righteousness from their own deeds. However, Psalms 31 & 32 shows us that their attempts at denying the work of Christ on Calvary are useless, since God has revealed this truth throughout His Word.]
Blessed Be the Lord/Blessed is the Man
[Read: Psalms 31 & 32]
When our Lord Jesus was on the cross, His final words were directly taken from Psalm 31:5. These words reflect the absolute trust of Christ in His Father’s well-keeping of His Beloved Son. Christ does not waver, but commits His entire being – both His broken body and His sorrowful spirit – to His Father who can deliver Him from death. As we read in Hebrews 5:7: “In the days of His flesh, Jesus offered up prayers and supplications, with loud cries and tears, to Him who was able to save Him from death, and He was heard because of His reverence.” Christ suffered as our sin bearer, being damned by God in our place so that we might be forgiven, granted His own righteousness, and given adoption as heirs and children of God. Paul speaks of this in 2 Corinthians 5:21, where he speaks of the imputation of our sins to Christ, and the imputation of Christ’s righteousness to us.
There are some who would like to deny that Paul taught this, but looking at Psalms 31 and 32, we see that Paul’s teaching was simply following what we find in the Old Testament. For Psalm 31, which is a Messianic psalm presents our Lord Jesus to us as suffering for us. Commenting on the Psalms and confession of sin as they relate to Christ’s work as our Substitute, Horatius Bonar writes:
The confessions of our sins which we find in the Psalms (where, as “in a bottle,” God has deposited the tears of the Son of man, Psalm 56:8) are the distinctest proofs of His work as the Substitute. Let one example suffice: “O LORD, rebuke me not in Thy wrath, neither chasten me in Thy hot displeasure; for Thine arrows stick fast in me, and Thy hand presseth me sore. There is no soundness in my flesh because of Thine anger, neither is there any rest in my bones because of my sin. For mine iniquities are gone over mine head; as an heavy burden, they are too heavy for me” (Psalm 38:1-4).
These confessions must be either those of the sinner or the sinbearer. They suit the former; and they show what views of sin we should entertain, and what our confessions should be. But they suit the latter no less; and as they occur in those Psalms which are quoted in the New Testament as specially referring to Christ, we must take them as the confessions of the sin-bearer, and meant to tell us what He thought of sin when it was laid upon Him simply as a substitute for others. The view thus given us of the completeness of the substitution is as striking as it is satisfying.
Christ is presented to us in Psalm 31 as our sin-bearer, punished for our iniquities, which were laid upon Him as if they were His own. Our sins, in other words, were imputed to Christ, and He who knew no sin became sin for us.
But why? So that we might be made the righteousness of God in Christ. And this is what we encounter in Psalm 32, where the psalm opens by saying: “Blessed is the one whose transgression is forgiven, whose sin is covered. Blessed is the man against whom the Lord counts no iniquity, and in whose spirit is no deceit.” Whereas Psalm 31 is shown to be the cry of the Messiah, Jesus, as He bore our sins in His own body on the tree of Calvary, Psalm 32 is about the one whose sins have been forgiven, who have been justified by faith alone. Therefore, Paul says: “Now to the one who works, his wages are not counted as a gift but as his due. And to the one who does not work but believes in Him who justifies the ungodly, his faith is counted as righteousness, just as David also speaks of the blessing of the one to whom God counts righteousness apart from works [in Psalm 31:1-2, as quoted above].”
Were the charge of “reading into the text” were to come up, one would only have to point to Luke 23:46 to show that the words of David in Psalm 31 are, really, the words of our Lord as He suffered for our sins as though they were His own. Likewise, one would only have to point to Romans 4:4-6 to show that Psalm 32 is about men who have had the righteousness of Christ imputed to them by faith, for that is exactly how Paul exegetes that Passage. So we see that Paul’s theology was not spun out of thin air, but came to him from God, and, therefore, contained nothing contrary to the teachings of the Old Testament. For in Psalm 31, our sins are imputed to Christ who was “spent with sorrows;” and in Psalm 32, His righteousness is imputed to us who do not work but believe on the Lord Jesus Christ as our Substitute.
 Ro 4:4-6
 Cf. Ps 31:10 & Isa 53:3