dsign

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2022 License: MIT Imports: 5 Imported by: 0

README

Dsign

Dsign is a Go package for working with digital signatures.

Documentation

Overview

Package dsign is a package for working with digital signatures.

Index

Constants

View Source
const (
	// SignatureSize is the size of signatures in bytes.
	SignatureSize = 64
	// PrivateKeySize is the size of private keys in bytes.
	PrivateKeySize = 64
	// PublicKeySize is the size of public keys in bytes.
	PublicKeySize = 32
)

Variables

View Source
var ErrInvalidKeySize = errors.New("invalid key size")

ErrInvalidKeySize is error that is returned when key has invalid size.

Functions

func GenerateKeys

func GenerateKeys() (PrivateKey, PublicKey, error)

GenerateKeys generates a pair of PrivateKey and PublicKey.

Types

type PrivateKey

type PrivateKey []byte

PrivateKey is a private key used for signing.

func (PrivateKey) Sign

func (k PrivateKey) Sign(data io.Reader) (Signature, error)

Sign signs data hash with PrivateKey.

func (PrivateKey) Size

func (k PrivateKey) Size() int

Size returns the size of PrivateKey.

type PublicKey

type PublicKey []byte

PublicKey is a public key used for signature verification.

func (PublicKey) Size

func (k PublicKey) Size() int

Size returns the size of PublicKey.

func (PublicKey) Verify

func (k PublicKey) Verify(s Signature, data io.Reader) (bool, error)

Verify verifies that Signature is a valid signature of data by PublicKey.

type Signature

type Signature []byte

Signature is a data hash signed with PrivateKey.

func (Signature) Equals

func (s Signature) Equals(ss Signature) bool

Equals checks if two signatures are equal.

func (Signature) Size

func (s Signature) Size() int

Size returns the size of Signature.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL