When it comes to digital signature, public key cryptosystem and hash technology are indispensable.
There are several public key algorithms that can be used as digital signatures. In some algorithms, such as RSA, either the public key or the private key can be used as encryption. Encrypt the file with your private key and you have a secure digital signature. In other cases, such as DSA, the algorithm is different, that is, the digital signature algorithm can not be used for encryption. This idea was first put forward by Diffie and Hellman.