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
- Variables
- type DelegatedKey
- func (delegatedKey DelegatedKey) Contents() (masterPublicKey, subPublicKey ed25519.PublicKey, until time.Time, err error)
- func (delegatedKey DelegatedKey) Delegator() ed25519.PublicKey
- func (delegatedKey DelegatedKey) Key() (masterPublicKey, subPublicKey ed25519.PublicKey, err error)
- func (delegatedKey DelegatedKey) Sign(privateKey ed25519.PrivateKey, msg []byte) DelegatedSignature
- func (delegatedKey DelegatedKey) Until() (time.Time, error)
- type DelegatedSignature
Constants ¶
const ( // DelegatedKeyLength is the length of a delegated key. DelegatedKeyLength = delegatedKeyHeaderLength + signatureLength // DelegatedSignatureLength is the length of a delegated signature. DelegatedSignatureLength = DelegatedKeyLength + signatureLength )
Variables ¶
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.
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.