delegatesign

package
v0.0.0-...-785270f Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: CC0-1.0 Imports: 5 Imported by: 0

Documentation

Overview

Package delegatesign contains delegated signing functionality. A master-key signs a sub-key that can then sign until a specified date.

Index

Constants

View Source
const (

	// DelegatedKeyLength is the length of a delegated key.
	DelegatedKeyLength = delegatedKeyHeaderLength + signatureLength

	// DelegatedSignatureLength is the length of a delegated signature.
	DelegatedSignatureLength = DelegatedKeyLength + signatureLength
)

Variables

View Source
var (
	ErrFormat    = errors.New("delegatesign: invalid key format")
	ErrExpired   = errors.New("delegatesign: expired delegation")
	ErrSignature = errors.New("delegatesign: delegation signature invalid")
)

Errors

Functions

This section is empty.

Types

type DelegatedKey

type DelegatedKey []byte

DelegatedKey contains: Master-PublicKey, Sub-PublicKey, NotAfter (unixtime), Master-PublicKey-Signature

func DelegateKey

func DelegateKey(masterPrivateKey ed25519.PrivateKey, subPublicKey ed25519.PublicKey, notAfter time.Time) DelegatedKey

DelegateKey creates a key delegation from masterPrivateKey to subPublicKey with notAfter determining after which time the key shall not be valid anymore.

func (DelegatedKey) Contents

func (delegatedKey DelegatedKey) Contents() (masterPublicKey, subPublicKey ed25519.PublicKey, until time.Time, err error)

Contents returns the embedded contents of the key.

func (DelegatedKey) Delegator

func (delegatedKey DelegatedKey) Delegator() ed25519.PublicKey

Delegator returns the master public key embedded in the DelegatedKey.

func (DelegatedKey) Key

func (delegatedKey DelegatedKey) Key() (masterPublicKey, subPublicKey ed25519.PublicKey, err error)

Key returns the embedded keys in a DelegatedKey while verifying that signature and notAfter are valid

func (DelegatedKey) Sign

func (delegatedKey DelegatedKey) Sign(privateKey ed25519.PrivateKey, msg []byte) DelegatedSignature

Sign msg with delegatedKey and privateKey.

func (DelegatedKey) Until

func (delegatedKey DelegatedKey) Until() (time.Time, error)

Until returns the time until which the delegation is valid. Does NOT verify the delegation.

type DelegatedSignature

type DelegatedSignature []byte

DelegatedSignature is a signature that contains delegation information.

func (DelegatedSignature) Key

func (delegatedSig DelegatedSignature) Key() DelegatedKey

Key returns the embedded key from a signature.

func (DelegatedSignature) Verify

func (delegatedSig DelegatedSignature) Verify(publicKey ed25519.PublicKey, msg []byte) (subPublicKey ed25519.PublicKey, ok bool)

Verify that the delegatedSig is a valid delegated signature of publicKey over msg.

Jump to

Keyboard shortcuts

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