libcipher

package
v1.0.0-rc.13 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	SigningSeedSize       = ed25519.SeedSize
	SigningPublicKeySize  = ed25519.PublicKeySize
	SigningPrivateKeySize = ed25519.PrivateKeySize
	SignatureSize         = ed25519.SignatureSize
)
View Source
const (
	ErrBadPublicKey  = SigningKeyError("not an ed25519 public key")
	ErrBadPrivateKey = SigningKeyError("not an ed25519 private key")
	ErrBadSeed       = SigningKeyError("not an ed25519 seed")
	ErrKeyGeneration = SigningKeyError("error generating signing key")
)

Variables

View Source
var SigningKeyEncoding = base64.StdEncoding

Functions

func CheckHash

func CheckHash(signingKey string, salt string, shouldBe string, hash []byte) (bool, error)

func Equal

func Equal(sealedHash1, sealedHash2 []byte) bool

func EqualSigningKey

func EqualSigningKey(a, b SigningPrivateKey) bool

func FormatPublicKey

func FormatPublicKey(pub SigningPublicKey) string

func FormatSigningSeed

func FormatSigningSeed(priv SigningPrivateKey) (string, error)

func GenerateKey

func GenerateKey(keyLength int) (string, error)

func GenerateSigningKey

func GenerateSigningKey() (SigningPublicKey, SigningPrivateKey, error)

func NewHash

func NewHash(args GenerateHashArgs, hashfn func() hash.Hash) ([]byte, error)

func Sign

func Sign(priv SigningPrivateKey, message []byte) ([]byte, error)

func Verify

func Verify(pub SigningPublicKey, message, sig []byte) bool

Types

type CipherTextError

type CipherTextError string

func (CipherTextError) Error

func (e CipherTextError) Error() string

type Decryptor

type Decryptor interface {
	Crypt(cipherpackage []byte) ([]byte, []byte, error)
}

func NewCBCHMACDecryptor

func NewCBCHMACDecryptor(encryptionKey []byte, integrityKey []byte, calculateMAC func() hash.Hash) (Decryptor, error)

func NewGCMDecryptor

func NewGCMDecryptor(encryptionKey []byte) (Decryptor, error)

type EncryptionKeyError

type EncryptionKeyError string

func (EncryptionKeyError) Error

func (e EncryptionKeyError) Error() string

type Encryptor

type Encryptor interface {
	Crypt(message []byte, additionalData []byte) ([]byte, error)
}

func NewCBCHMACEncryptor

func NewCBCHMACEncryptor(encryptionKey []byte, integrityKey []byte, calculateMAC func() hash.Hash, rand io.Reader) (Encryptor, error)

func NewGCMEncryptor

func NewGCMEncryptor(encryptionKey []byte, rand io.Reader) (Encryptor, error)

type GenerateHashArgs

type GenerateHashArgs struct {
	Payload    []byte
	SigningKey []byte
	Salt       []byte
}

type HashError

type HashError string

func (HashError) Error

func (e HashError) Error() string

type IntegrityKeyError

type IntegrityKeyError string

func (IntegrityKeyError) Error

func (e IntegrityKeyError) Error() string

type InvalidUsageError

type InvalidUsageError string

func (InvalidUsageError) Error

func (e InvalidUsageError) Error() string

type KeyGenerationError

type KeyGenerationError string

func (KeyGenerationError) Error

func (e KeyGenerationError) Error() string

type MessageError

type MessageError string

func (MessageError) Error

func (e MessageError) Error() string

type SigningKeyError

type SigningKeyError string

func (SigningKeyError) Error

func (e SigningKeyError) Error() string

type SigningPrivateKey

type SigningPrivateKey = ed25519.PrivateKey

type SigningPublicKey

type SigningPublicKey = ed25519.PublicKey

func ParsePublicKey

func ParsePublicKey(s string) (SigningPublicKey, error)

Jump to

Keyboard shortcuts

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