Digital signature encrypts documents with difficult to duplicate digital codes. It encrypts the message with the sender's private key and decrypts it with their public key, allowing the receiver to verify the sender's identity and that the message hasn't changed. The process involves generating a message digest from the document, encrypting it with the private key to create the digital signature, and attaching it to the message sent to the receiver who can then decrypt it with the public key to validate it matches their own calculation of the message digest and verify the signature.