Internally all transactions are being digitally signed automatically. If you need manually to sign some data you can do that easy with the function SignData from the identity namespace.
The parameters for SignData are:
Message: The data to be signed
ChainAddress: Your blockchain address
Password: The password to unlock your private key
Note: Obviously your private key must be hosted on the node used!
With the function ValidateSignature you can validate a signature. If the signature is correct the return value is the blockchain address of the signer.
The parameters for ValidateSignature are:
Message: The signed data
Signature: The Signature returned by SignData
Example
If 0x890927F95D54f128B0163030fCd8016Bb62a0492 signs the string CodeB the digital signature is:
0x92963d45cfde58c50e26f72d2f5081630608083c8f6d6ddfffb98c84563718c022a9f9aaa34bc09b882a8a66b30933c29db85e9b113b508009dcf210bab05cbb1c
To validate the above signature you need to pass the Message CodeB and the signature to the function ValidateSignature: