asymmetric

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ed25519PrivateKeySize = 32
)

Variables

This section is empty.

Functions

func Ed25519ToPublicKey

func Ed25519ToPublicKey(pub crypto.PublicKey) (ed25519.PublicKey, error)

func Ed448ToPublicKey

func Ed448ToPublicKey(pub crypto.PublicKey) (ed448.PublicKey, error)

Types

type Attestation added in v0.0.2

type Attestation interface {
	Sign([]byte) (string, error)
	Verify(string) (bool, error)
	Parse(string) (string, error)
}

type Curve25519

type Curve25519 struct {
	PublicKey []byte
	SecretKey []byte
}

func (*Curve25519) GenerateKeypair

func (c *Curve25519) GenerateKeypair() error

func (*Curve25519) GenerateSharedSecret

func (c *Curve25519) GenerateSharedSecret(recipientPublicKey []byte) ([]byte, error)

type DH

type DH interface {
	GenerateKeypair() error
	GenerateSharedSecret([]byte) ([]byte, error)
}

type Ed25519

type Ed25519 struct {
	SecretKey ed25519.PrivateKey
	PublicKey ed25519.PublicKey
	Encoder   generic.Encoder
}

func (*Ed25519) Generate

func (e *Ed25519) Generate() error

func (*Ed25519) GenerateFromSeed

func (e *Ed25519) GenerateFromSeed(seed []byte) error

func (*Ed25519) GetEncoder added in v0.0.2

func (e *Ed25519) GetEncoder() generic.Encoder

func (*Ed25519) GetPublicKey added in v0.0.2

func (e *Ed25519) GetPublicKey() []byte

func (*Ed25519) GetSecretKey added in v0.0.2

func (e *Ed25519) GetSecretKey() []byte

func (*Ed25519) Sign

func (e *Ed25519) Sign(msg []byte) string

func (*Ed25519) Verify

func (e *Ed25519) Verify(msg []byte, sig string) (bool, error)

type Ed448

type Ed448 struct {
	SecretKey ed448.PrivateKey
	PublicKey ed448.PublicKey
	Context   string
	Encoder   generic.Encoder
}

func (*Ed448) Generate

func (e *Ed448) Generate() error

func (*Ed448) GenerateFromSeed

func (e *Ed448) GenerateFromSeed(seed []byte) error

func (*Ed448) GetEncoder added in v0.0.2

func (e *Ed448) GetEncoder() generic.Encoder

func (*Ed448) GetPublicKey added in v0.0.2

func (e *Ed448) GetPublicKey() []byte

func (*Ed448) GetSecretKey added in v0.0.2

func (e *Ed448) GetSecretKey() []byte

func (*Ed448) Sign

func (e *Ed448) Sign(msg []byte) string

func (*Ed448) Verify

func (e *Ed448) Verify(msg []byte, sig string) (bool, error)

type KnownPadding added in v0.0.2

type KnownPadding struct {
	Padding int
}

func (*KnownPadding) Deserializer added in v0.0.2

func (k *KnownPadding) Deserializer(data string) (string, string, error)

func (*KnownPadding) Serializer added in v0.0.2

func (k *KnownPadding) Serializer(payload string, signature string) (string, error)

type KnownSeparator added in v0.0.2

type KnownSeparator struct {
	Separator         string
	PayloadPosition   int
	SignaturePosition int
}

func (*KnownSeparator) Deserializer added in v0.0.2

func (k *KnownSeparator) Deserializer(data string) (string, string, error)

func (*KnownSeparator) Serializer added in v0.0.2

func (k *KnownSeparator) Serializer(payload string, signature string) (string, error)

type Minimalistic added in v0.0.2

type Minimalistic struct {
	Suite         Signing
	Hasher        hash.Algorithms
	Serialization Serializers
	Encoder       generic.Encoder
}

func (*Minimalistic) Parse added in v0.0.2

func (m *Minimalistic) Parse(token string) (string, error)

func (*Minimalistic) Sign added in v0.0.2

func (m *Minimalistic) Sign(payload []byte) (string, error)

func (*Minimalistic) Verify added in v0.0.2

func (m *Minimalistic) Verify(token string) (bool, error)

type Serializers added in v0.0.2

type Serializers interface {
	Serializer(string, string) (string, error)
	Deserializer(string) (string, string, error)
}

type Signing

type Signing interface {
	Generate() error
	GenerateFromSeed([]byte) error
	Sign([]byte) string
	Verify([]byte, string) (bool, error)
	GetSecretKey() []byte
	GetPublicKey() []byte
	GetEncoder() generic.Encoder
}

Jump to

Keyboard shortcuts

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