Testament of Solomon 1

The Testament of Solomon, son of David, who was king in Jerusalem, and mastered and controlled all spirits of the air, on the earth, and under the earth. By means of them also he wrought all the transcendent works of the Temple. Telling also of the authorities they wield against men, and by what angels these demons are brought to naught. Blessed art thou, O Lord God, who didst give Solomon such authority. Glory to thee and might unto the ages. Amen.

And behold, when the Temple of the city of Jerusalem was being built, and the artificers were working thereat, Ornias the demon came among them toward sunset; and he took away half of the pay of the chief-deviser's little boy, as well as half his food. He also continued to suck the thumb of his right hand every day. And the child grew thin, although he was very much loved by the king.

So King Solomon called the boy one day, and questioned him, saying: "Do I not love thee more than all the artisans who are working in the Temple of God? Do I not give thee double wages and a double supply of food? How is it that day by day and hour by hour thou growest thinner?"

But the child said to the king: "I pray thee, O king. Listen to what has befallen all that thy child hath. After we are all released from our work on the Temple of God, after sunset, when I lie down to rest, one of the evil demons comes and takes away from me one half of my pay and one half of my food. Then he also takes hold of my right hand and sucks my thumb. And lo, my soul is oppressed, and so my body waxes thinner every day."

Now when I Solomon heard this, I entered the Temple of God, and prayed with all my soul, night and day, that the demon might be delivered into my hands, and that I might gain authority over him. And it came about through my prayer that grace was given to me from the Lord Sabaoth by Michael his archangel. [He brought me] a little ring, having a seal consisting of an engraved stone, and said to me: "Take, O Solomon, king, son of David, the gift which the Lord God has sent thee, the highest Sabaoth. With it thou shalt lock up all demons of the earth, male and female; and with their help thou shalt build up Jerusalem. [But] thou [must] wear this seal of God. And this engraving of the seal of the ring sent thee is a Pentalpha."


Gittin 68a

Solomon said to them: Where is it found? They said to him: Bring a male demon and a female demon and torment them together. It is possible that they know where, and due to the suffering they will reveal the place to you. Solomon brought a male demon and a female demon and tormented them together, and they said: We do not know where to find the shamir. Perhaps Ashmedai, king of the demons, knows.

Solomon said to them: Where is Ashmedai? They said to him: He is on such-and-such a mountain. He has dug a pit for himself there, and filled it with water, and covered it with a rock, and sealed it with his seal. And every day he ascends to Heaven and studies in the heavenly study hall and he descends to the earth and studies in the earthly study hall. And he comes and checks his seal to ensure that nobody has entered his pit, and then he uncovers it and drinks from the water in the pit. And then he covers it and seals it again and goes.

Solomon sent for Benayahu, son of Jehoiada, a member of the royal entourage, and gave him a chain onto which a sacred name of God was carved, and a ring onto which a sacred name of God was carved, and fleeces of wool and wineskins of wine. What did Benayahu do? He went and dug a pit lower down the mountain, below the pit dug by Ashmedai, drained the water, and plugged it with the fleeces of wool so that Ashmedai’s pit was emptied. And he dug a pit higher up the mountain, above Ashmedai’s pit. And he poured the wine into it so that the wine filled Ashmedai’s pit, and he plugged the lower and upper pits that he dug. He climbed up and sat in a tree.