Documentation ¶
Overview ¶
Package sign implements a digital signature scheme using the Edwards form of Curve25519.
Index ¶
Constants ¶
const ( // PrivateKeySize is the size of the private-key in bytes. PrivateKeySize = 64 // PublicKeySize is the size of the public-key in bytes. PublicKeySize = 32 // SignatureSize is the size of the created signature in bytes. SignatureSize = 64 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrivateKey ¶
type PrivateKey ed25519.PrivateKey
PrivateKey wraps the underlying private-key (ed25519.PrivateKey). It provides some wrapper methods: Sign(), Public()
func GenerateKey ¶
func GenerateKey(rnd io.Reader) (PrivateKey, error)
GenerateKey generates and returns a fresh random private-key, from which the corresponding public-key can be derived (by calling Public() on it). It will use the passed io.Reader rnd as a source of randomness, or, if rnd is nil it will use a sane default (rand.Reader).
It returns an error if the key couldn't be properly generated. This, for example, can happen if there isn't enough entropy for the randomness.
func (PrivateKey) Public ¶
func (key PrivateKey) Public() (PublicKey, bool)
Public derives the corresponding public-key from the underlying private-key. It returns the derived key, if possible, and a boolean flag which indicates if the operations to derive the public-key were successful.
func (PrivateKey) Sign ¶
func (key PrivateKey) Sign(message []byte) []byte
Sign returns a signature on the passed byte slice message using the underlying private-key. The passed slice won't be modified.