signify

package module
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: BSD-3-Clause Imports: 6 Imported by: 2

README

OVERVIEW

Go Reference Go Report Card Go Build

paepcke.de/signify

This implementation does intentionally NOT satisfy the OpenBSD signify private key bcrypt/pbkdf handling interface.

This implementation enables you to handle the secret and all stages of the key processing within your APP context (HSM, Smartcard, KDF, ...)

This is an 100% pure go, stdlib only, no external dependencies, please look at api.go for more details.

DOCS

pkg.go.dev/paepcke.de/signify

CONTRIBUTION

Yes, Please! PRs Welcome!

Documentation

Overview

Package signify creates and verifies OpenBSD signify and minisign compatible signatures.

Index

Constants

View Source
const (
	// PrivateKeySize ...
	PrivateKeySize = ed25519.PrivateKeySize
	// PublicKeySize ...
	PublicKeySize = ed25519.PublicKeySize
	// SignatureSize ...
	SignatureSize = ed25519.SignatureSize
	// PrivatePublicKeyOffset ...
	PrivatePublicKeyOffset = PrivateKeySize - PublicKeySize
	// SeedSize ...
	SeedSize = ed25519.SeedSize
	// FingerPrintSize ...
	FingerPrintSize = 8
	// KeyAlgoSize ...
	KeyAlgoSize = 2
	// SeedTokenSize ...
	SeedTokenSize = SeedSize + FingerPrintSize
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FingerPrint

type FingerPrint [FingerPrintSize]byte

FingerPrint ...

type KeyAlgo

type KeyAlgo [KeyAlgoSize]byte

KeyAlgo ...

type Message

type Message struct {
	Base64           string
	Raw              []byte
	UntrustedComment string
	Signature        Signature
	PublicKey        PublicKey
}

Message ...

func NewMessage

func NewMessage() *Message

NewMessage ...

func (*Message) Decode

func (msg *Message) Decode() (err error)

Decode Base64 Message to Raw Message

func (*Message) Encode

func (msg *Message) Encode() (err error)

Encode Raw Message to Base64

func (*Message) GetSigFile

func (msg *Message) GetSigFile(pk PrivateKey) ([]byte, error)

GetSigFile signs an message (raw or encoded) and provides an OpenBSD Signify compatible signature file

func (*Message) Sign

func (msg *Message) Sign(pk PrivateKey) (err error)

Sign a message decodes, when nessesary, the Message and generates an encoded signature

func (*Message) Verify

func (msg *Message) Verify(pub PublicKey) (bool, error)

Verify a message decodes, when nessesary, the Message and the PublicKey and verifies the signature

type PrivateKey

type PrivateKey struct {
	Base64 string
	Raw    RawPrivateKey
}

PrivateKey ...

func GeneratePKFromSeed

func GeneratePKFromSeed(seedToken [SeedTokenSize]byte) PrivateKey

GeneratePKFromSeed generates a new deterministic, reproduceable PrivateKey from seed

func NewPrivateKey

func NewPrivateKey() PrivateKey

NewPrivateKey ...

func (PrivateKey) GetPubKeyFile

func (pk PrivateKey) GetPubKeyFile(addUntrusted string) ([]byte, error)

GetPubKeyFile from PrivateKey encodes and assembles an OpenBSD Signify compatible publickey file

func (PrivateKey) GetPublicKey

func (pk PrivateKey) GetPublicKey() PublicKey

GetPublicKey from PrivateKey

type PublicKey

type PublicKey struct {
	Base64 string
	Raw    RawPublicKey
}

PublicKey ...

func NewPublicKey

func NewPublicKey() PublicKey

NewPublicKey ...

func (*PublicKey) Decode

func (pub *PublicKey) Decode() (err error)

Decode PublicKey

func (*PublicKey) Encode

func (pub *PublicKey) Encode() error

Encode PublicKey

func (PublicKey) GetPubKeyFile

func (pub PublicKey) GetPubKeyFile(addUntrusted string) ([]byte, error)

GetPubKeyFile from PublicKey encodes and assembles an OpenBSD Signify compatible publickey file

type RawPrivateKey

type RawPrivateKey struct {
	PKAlgo      KeyAlgo
	Fingerprint FingerPrint
	RawKey      [PrivateKeySize]byte
}

RawPrivateKey ...

type RawPublicKey

type RawPublicKey struct {
	PKAlgo      KeyAlgo
	Fingerprint FingerPrint
	RawKey      [PublicKeySize]byte
}

RawPublicKey ...

type RawSignature

type RawSignature struct {
	PKAlgo      KeyAlgo
	Fingerprint FingerPrint
	RawSig      [SignatureSize]byte
}

RawSignature ...

type Signature

type Signature struct {
	Base64 string
	Raw    RawSignature
}

Signature ...

func NewSignature

func NewSignature() Signature

NewSignature ...

func (*Signature) Decode

func (sig *Signature) Decode() (err error)

Decode Base64 Signature to Raw

func (*Signature) Encode

func (sig *Signature) Encode() error

Encode Raw Signature to Base64

Jump to

Keyboard shortcuts

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