A digital signature is a mathematical technique used to verify the authenticity and integrity of digital documents or electronic messages. It is similar to a handwritten signature, but it is created using a unique algorithm that encrypts the message or document and assigns a specific code to it. The code can be decrypted using a public key corresponding to the private key used to create the signature, and this ensures that the document has not been tampered with or altered since it was signed. Digital signatures are often used in e-commerce transactions, online contracts, and other electronic documents to ensure their legal validity and authenticity.