How to create and apply a digital signature?