curve

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrivateKeySize = 32
	PublicKeySize  = 32
)
View Source
const (
	HeaderCommonSize = 24
	HashSize         = 32
	GCMNonceSize     = 12
	GCMTagSize       = 16
	TimestampSize    = 8
	HeaderSize       = HeaderCommonSize + PublicKeySize + PublicKeySize + GCMTagSize + TimestampSize + GCMTagSize + HashSize
)
View Source
const (
	NHP_FLAG_EXTENDEDLENGTH = 1 << iota
	NHP_FLAG_COMPRESS
)

header flags (bit 0 - bit 11)

Variables

This section is empty.

Functions

This section is empty.

Types

type Curve25519ECDH

type Curve25519ECDH struct {
	PrivKey       [PrivateKeySize]byte
	PubKey        [PublicKeySize]byte
	PrivKeyBase64 string
	PubKeyBase64  string
	BriefName     string
}

func NewECDH

func NewECDH() *Curve25519ECDH

func (*Curve25519ECDH) Identity

func (c *Curve25519ECDH) Identity() []byte

func (*Curve25519ECDH) MidPublicKey

func (c *Curve25519ECDH) MidPublicKey() []byte

func (*Curve25519ECDH) Name

func (c *Curve25519ECDH) Name() string

func (*Curve25519ECDH) PrivateKey

func (c *Curve25519ECDH) PrivateKey() []byte

func (*Curve25519ECDH) PrivateKeyBase64

func (c *Curve25519ECDH) PrivateKeyBase64() string

func (*Curve25519ECDH) PublicKey

func (c *Curve25519ECDH) PublicKey() []byte

func (*Curve25519ECDH) PublicKeyBase64

func (c *Curve25519ECDH) PublicKeyBase64() string

func (*Curve25519ECDH) SetPrivateKey

func (c *Curve25519ECDH) SetPrivateKey(prk []byte) (err error)

func (*Curve25519ECDH) SharedSecret

func (c *Curve25519ECDH) SharedSecret(pbk []byte) []byte

type HeaderCurve

type HeaderCurve struct {
	HeaderCommon [HeaderCommonSize]byte
	Ephermeral   [PublicKeySize]byte
	Static       [PublicKeySize + GCMTagSize]byte
	Timestamp    [TimestampSize + GCMTagSize]byte
	HMAC         [HashSize]byte
}

func (*HeaderCurve) Bytes

func (h *HeaderCurve) Bytes() []byte

func (*HeaderCurve) Counter

func (h *HeaderCurve) Counter() uint64

func (*HeaderCurve) EphermeralBytes

func (h *HeaderCurve) EphermeralBytes() []byte

func (*HeaderCurve) Flag

func (h *HeaderCurve) Flag() uint16

func (*HeaderCurve) HMACBytes

func (h *HeaderCurve) HMACBytes() []byte

func (*HeaderCurve) IdentityBytes

func (h *HeaderCurve) IdentityBytes() []byte

func (*HeaderCurve) NonceBytes

func (h *HeaderCurve) NonceBytes() []byte

func (*HeaderCurve) SetCounter

func (h *HeaderCurve) SetCounter(counter uint64)

func (*HeaderCurve) SetFlag

func (h *HeaderCurve) SetFlag(flag uint16)

func (*HeaderCurve) SetTypeAndPayloadSize

func (h *HeaderCurve) SetTypeAndPayloadSize(t int, s int)

func (*HeaderCurve) SetVersion

func (h *HeaderCurve) SetVersion(major int, minor int)

func (*HeaderCurve) Size

func (h *HeaderCurve) Size() int

func (*HeaderCurve) StaticBytes

func (h *HeaderCurve) StaticBytes() []byte

func (*HeaderCurve) TimestampBytes

func (h *HeaderCurve) TimestampBytes() []byte

func (*HeaderCurve) TypeAndPayloadSize

func (h *HeaderCurve) TypeAndPayloadSize() (t int, s int)

curve header implementations

func (*HeaderCurve) Version

func (h *HeaderCurve) Version() (int, int)

Jump to

Keyboard shortcuts

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