dsa

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKeys

func GenerateKeys() (DSAPrivateKey, DSAPublicKey, error)

GenerateKeys returns private-public DSA key.

func Sign

func Sign(sk DSAPrivateKey, input []byte) ([]byte, error)

Sign signs input byte slice by DSA private key.

func Verify

func Verify(pk DSAPublicKey, input, signed []byte) error

Verify verifies signed byte slice with input byte slice and DSA public key.

Types

type DSAPrivateKey

type DSAPrivateKey [20]byte

DSAPrivateKey is DSA private key that has 20 bytes.

func (DSAPrivateKey) Generate

func (k DSAPrivateKey) Generate() (s DSAPrivateKey, err error)

Generate returns DSA private key from parent DSA private key.

func (DSAPrivateKey) Len

func (k DSAPrivateKey) Len() int

func (DSAPrivateKey) NewSigner

func (k DSAPrivateKey) NewSigner() (Signer, error)

NewSigner create a new dsa signer.

func (DSAPrivateKey) Public

func (k DSAPrivateKey) Public() (DSAPublicKey, error)

Public returns public key from DSA private key.

type DSAPublicKey

type DSAPublicKey [128]byte

DSAPublicKey is DSA public key that has 128 bytes.

func (DSAPublicKey) Len

func (k DSAPublicKey) Len() int

Len returns length of DSA public key.

func (DSAPublicKey) NewVerifier

func (k DSAPublicKey) NewVerifier() (Verifier, error)

NewVerifier create a new DSA verifier.

type DSASigner

type DSASigner struct {
	// contains filtered or unexported fields
}

func (*DSASigner) Sign

func (ds *DSASigner) Sign(data []byte) ([]byte, error)

func (*DSASigner) SignHash

func (ds *DSASigner) SignHash(h []byte) ([]byte, error)

type DSAVerifier

type DSAVerifier struct {
	// contains filtered or unexported fields
}

DSAVerifier is DSA verifier.

func (*DSAVerifier) Verify

func (v *DSAVerifier) Verify(data, sig []byte) error

Verify verifies data with a DSA public key.

func (*DSAVerifier) VerifyHash

func (v *DSAVerifier) VerifyHash(h, sig []byte) error

VerifyHash verifies hash of data with a DSA public key.

type Signer

type Signer interface {
	// sign data with our private key by calling SignHash after hashing the data we are given
	// return signature or nil signature and error if an error happened
	Sign(data []byte) (sig []byte, err error)

	// sign hash of data with our private key
	// return signature or nil signature and error if an error happened
	SignHash(h []byte) (sig []byte, err error)
}

type for signing data

type Verifier

type Verifier interface {
	// verify hashed data with this signing key
	// return nil on valid signature otherwise error
	VerifyHash(h, sig []byte) error
	// verify an unhashed piece of data by hashing it and calling VerifyHash
	Verify(data, sig []byte) error
}

Verifier is type for verifying signatures.

Jump to

Keyboard shortcuts

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