delphi

package
v3.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const GlobalSalt = "oracle/v2"

Variables

View Source
var ErrWrongSize = errors.New("wrong size")
View Source
var ErrZeroKey = errors.New("zero key")

Functions

This section is empty.

Types

type Key

type Key [2]SubKey

A Key is either public or private. It combines encryption and signing sub-keys

var ZeroKey Key

func KeyFromBytes

func KeyFromBytes(b []byte) (Key, error)

func KeyFromString

func KeyFromString(s string) (Key, error)

func NewKey

func NewKey(randy io.Reader) Key

func (Key) Bytes

func (k Key) Bytes() []byte

func (Key) Equal

func (k Key) Equal(j Key) bool

func (Key) MarshalJSON

func (k Key) MarshalJSON() ([]byte, error)

func (Key) MustBeValid

func (k Key) MustBeValid()

func (Key) Read

func (k Key) Read(p []byte) (int, error)

func (Key) String

func (k Key) String() string

func (*Key) UnmarshalJSON

func (k *Key) UnmarshalJSON(data []byte) error

func (*Key) Write

func (k *Key) Write(p []byte) (int, error)

type KeyPair

type KeyPair [2]Key
var ZeroKeyPair KeyPair

func NewKeyPair

func NewKeyPair(randy io.Reader) KeyPair

NewKeyPair generates valid ed25519 and X25519 keys

func (KeyPair) Bytes

func (kp KeyPair) Bytes() []byte

func (KeyPair) Decrypt

func (kp KeyPair) Decrypt(msg, eph, nonce, aad []byte) (plaintext []byte, err error)

func (KeyPair) GenerateSharedSecret

func (kp KeyPair) GenerateSharedSecret(randomness io.Reader, pubKey PublicKey) (sharedSecret []byte, ephemeralPubKey []byte, err error)

func (KeyPair) MarshalJSON

func (kp KeyPair) MarshalJSON() ([]byte, error)

func (KeyPair) MustBeValid

func (kp KeyPair) MustBeValid()

func (KeyPair) PrivateKey

func (kp KeyPair) PrivateKey() PrivateKey

func (KeyPair) PrivateSigningKey

func (kp KeyPair) PrivateSigningKey() Key

A PrivateSigningKey contains both private and public key material. That's just how ed25519 works

func (KeyPair) Public

func (kp KeyPair) Public() crypto.PublicKey

func (KeyPair) PublicKey

func (kp KeyPair) PublicKey() PublicKey

func (KeyPair) Seal

func (kp KeyPair) Seal(sec []byte, plainText []byte, nonce []byte, aad []byte) ([]byte, error)

func (KeyPair) Sign

func (kp KeyPair) Sign(_ io.Reader, digest []byte, _ crypto.SignerOpts) ([]byte, error)

Sign signs a digest. This satisfies crypto.Signer.

func (KeyPair) String

func (kp KeyPair) String() string

String is a hex representation of the key.

func (*KeyPair) UnmarshalJSON

func (kp *KeyPair) UnmarshalJSON(data []byte) error

func (KeyPair) Verify

func (kp KeyPair) Verify(pubKey crypto.PublicKey, digest []byte, signature []byte) bool

func (*KeyPair) Write

func (kp *KeyPair) Write(p []byte) (int, error)

type PrivateKey

type PrivateKey Key

func (PrivateKey) Bytes

func (k PrivateKey) Bytes() []byte

func (PrivateKey) Encryption

func (k PrivateKey) Encryption() SubKey

func (PrivateKey) Equal

func (p PrivateKey) Equal(k crypto.PublicKey) bool

func (PrivateKey) Signing

func (k PrivateKey) Signing() SubKey

type PublicKey

type PublicKey Key

func (PublicKey) Bytes

func (k PublicKey) Bytes() []byte

func (PublicKey) Encryption

func (k PublicKey) Encryption() SubKey

func (PublicKey) Equal

func (p PublicKey) Equal(k crypto.PublicKey) bool

func (PublicKey) MarshalJSON

func (k PublicKey) MarshalJSON() ([]byte, error)

func (PublicKey) Nickname

func (k PublicKey) Nickname() string

A Nickname is a very memorable string for humans only. It has weak uniqueness that is good enough for some uses.

func (PublicKey) Signing

func (k PublicKey) Signing() SubKey

func (PublicKey) String

func (k PublicKey) String() string

func (*PublicKey) UnmarshalJSON

func (k *PublicKey) UnmarshalJSON(data []byte) error

func (*PublicKey) Write

func (k *PublicKey) Write(p []byte) (int, error)

type SubKey

type SubKey [subKeySize]byte

func (SubKey) Bytes

func (s SubKey) Bytes() []byte

func (SubKey) String

func (s SubKey) String() string

Jump to

Keyboard shortcuts

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