Link Search Menu Expand Document

6.2 Digital Signatures


Data Types

DSSignKey
The RSA private key for public-key signatures with RSA.
DSVerifyKey
The RSA public key, used for verifying RSA signatures.

Functions

DSKeyGen() (DSSignKey, DSVerifyKey, error)

Generate a 256-byte (2048-bit) RSA key pair for digital signatures.


DSSign(sk DSSignKey, msg []byte) (sig []byte, err error)

Use the RSA private key to create a 256-byte (2048-bit) signature.

Parameters
sk (DSSignKey) - RSA signing (private) key
msg ([]byte) - message to encrypt

Returns
sig ([]byte), err (error)


DSVerify(vk DSVerifyKey, msg []byte, sig []byte) (err error)

Use the RSA public key to verify a 256-byte (2048-bit) signature.

Parameters
vk (DSVerifyKey) - RSA verification (public) key
msg ([]byte) - arbitrary-length message to verify
sig ([]byte) - signature to verify

Returns
err (error)