dnd 5e – Is there a spell that encrypts or protects documents and tomes in DnD 5e?

The Linguist feat sort of lets you do this. It’s not a spell, but it’s the only official option I know that last indefinitely. It also doesn’t work on existing documents, but you could make a copy.

You can ably create written ciphers. Others can’t decipher a code you create unless you teach them, they succeed on an Intelligence check (DC equal to your Intelligence score + your proficiency bonus), or they use magic to decipher it.