Psalm 71 deals with King David’s faith in God as his rock (foretelling of Jesus) and fortress, his very habitation, then to the coming son of perdition, the remnant escaping to Petra, through completing his tasks before aging overtakes him to judgment on his enemies.
Psalm 71:3, “Be thou my strong habitation, whereunto I may continually resort: thou hast given commandment to save me; for thou art my rock and my fortress.”
Habitation, H4583, an abode, of God (the Tabernacle or the Temple), men (their home) or animals (their lair); hence a retreat (asylum): dwelling place.
Psalm 71:4, “Deliver me, O my God, out of the hand of the wicked, out of the hand of the unrighteous and cruel man.”
Perhaps a bit of a stretch, the Antichrist? If so, could the rock and fortress from verse 3 be Petra in addition to Jesus being our rock.
Psalm 71:24, “My tongue also shall talk (H1897) of thy righteousness all the day long: for they are confounded (H954), for they are brought unto shame (H2659), that seek my hurt.”
Talk, H1897, to murmur (in pleasure or anger); by implication to ponder: - imagine, meditate, mourn, mutter, roar, sore, speak, study, talk, utter.
Confounded, H954, properly to pale, that is, by implication to be ashamed; to be disappointed, or delayed: cause to be confounded.
Shame, H2659, to blush; figuratively to be ashamed, disappointed; causatively to shame, reproach: - be ashamed, be confounded, be brought to confusion (unto shame), come (be put to) shame, bring reproach.
Although Psalm 71 is not listed as an Imprecatory Psalms, those that invoke judgment, calamity, or curses, upon one's enemies or those perceived as the enemies of God, to me verse 24 speaks to it. The Imprecatory Psalms include Psalms 6, 12, 35, 37, 58,59, 69, 79, 83, 109, 139, and 140. Note Psalm 35:4.
Psalm 35:4, “Let them be confounded and put to shame that seek after my soul: let them be turned back and brought to confusion that devise my hurt.”
An interesting commentary concerning Psalms 71:24 somewhat follows my inclusion of Psalm 71 as imprecatory:
“Talk of thy righteousness - The righteousness of God is frequently used in this Psalm, and in other places, to signify his justice, judgments, faithfulness, truth, mercy, etc. There are few words of more general import in the Bible.
They are confounded - The counsel of Ahithophel is confounded, and turned to foolishness, and he was so ashamed that he went and hanged himself. As to the vain and wicked Absalom, he met with the fate that he had meditated against his father. Though not yet done, David sees all these things as actually accomplished; for he had got a Divine assurance that God would bring them to pass.”
[Adam Clarke’s Commentary on the Bible]
In my opinion, Psalm 71 is a far-reaching Psalm that covers lots of ground. That said, as usual I likely strayed outside the box.