Calvin on believers appealing to their own righteousness

What are we to make of it when we’re singing a psalm about believers appealing to their own righteousness? Do we just apply it to Christ? After listing such references in Psalms 7, 17, 18 & 26, Calvin gives a few pointers:

“…Yet the saints, while they appeal to God’s judgment to approve their innocence, do not present themselves as free from all guilt and faultless in every respect; but while they have fixed their assurance of salvation in his goodness alone, they still, trusting in him as avenger of the poor afflicted beyond right and equity, assuredly commend to him the cause in which the innocent are oppressed.

“On the other hand, when they hale their opponents with them before God’s judgment seat, they do not boast of an innocence that under strict test would correspond to God’s own purity; but because, in comparison with their adversaries’ malice, dishonesty, craft, and wickedness, they know that their sincerity, righteousness, simplicity, and purity are known and pleasing to God, they are not afraid to call upon him to act as judge between themselves and their adversaries. ”

Institutes, III, xvii, 14.

A little later, on Psalm 82.6 (‘Preserve my life for I am godly’) he writes:

“By such expressions they mean nothing else but that by their regeneration itself they are attested as servants and children of God to whom he promises that he will be gracious.”

Similarly, when we’re told that God hears the prayer of the ‘righteous’ (Ps 34.15):

“In these statements he does not set the value of prayer according to the merits of works, but he is pleased to establish the assurance of those who are duly aware of guileless uprightness and innocence, as all believers ought to be. Indeed, what the blind man whose sight was restored says in John’s gospel—that God does not listen to sinners [John 9:31]—has been drawn from the very truth of God, provided we understand “sinners” in the customary usage of Scripture, as all persons who slumber and repose in their own sins without any desire for righteousness. For no heart can ever break into sincere calling upon God that does not at the same time aspire to godliness.”

Institutes, III, xx, 10.