sectest

package
Version: v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package sectest contains support for security related tests

Index

Constants

This section is empty.

Variables

View Source
var SuffixCaveat = security.CaveatDescriptor{
	Id:        uniqueid.Id{0xce, 0xc4, 0xd0, 0x98, 0x94, 0x53, 0x90, 0xdb, 0x15, 0x7c, 0xa8, 0x10, 0xae, 0x62, 0x80, 0x0},
	ParamType: vdl.TypeOf(string("")),
}

SuffixCaveat is a Caveat that validates iff Call.Suffix matches the string.

Since at the time of this writing, it was not clear that we want to make caveats on suffixes generally available, this type is implemented in this test file. If there is a general need for such a caveat, it should be defined similar to other caveats (like methodCaveat) in caveat.vdl and removed from this test file.

Functions

func AddToRoots

func AddToRoots(t *testing.T, p security.Principal, b security.Blessings)

AddToRoots calls security.AddAddToRoots.

func BlessSelf

func BlessSelf(t *testing.T, p security.Principal, name string, caveats ...security.Caveat) security.Blessings

BlessSelf returns a named blessing for the supplied principal.

func NewECDSAPrincipalP256

func NewECDSAPrincipalP256(t testing.TB) security.Principal

NewECDSAPrincipalP256 returns a new ECDSA based principal using &Roots{} and the P256 curve.

func NewECDSAPrincipalP256TrustAllRoots

func NewECDSAPrincipalP256TrustAllRoots(t testing.TB) security.Principal

NewECDSAPrincipalP256TrustAllRoots returns a new ECDSA based principal using &TrustAllRoots{} and the P256 curve.

func NewECDSASigner

func NewECDSASigner(t testing.TB, curve elliptic.Curve) security.Signer

NewECDSASigner creates a new ECDSA based signer.

func NewECDSASignerP256

func NewECDSASignerP256(t testing.TB) security.Signer

NewECDSASignerP256 creates a new ECDSA based signer using the P256 curve.

func NewED25519Principal

func NewED25519Principal(t testing.TB) security.Principal

NewED25519Principal returns a new ED25519 based principal using &Roots{}.

func NewED25519PrincipalTrustAllRoots

func NewED25519PrincipalTrustAllRoots(t testing.TB) security.Principal

NewED25519PrincipalTrustAllRoots returns a new ED25519 based principal using &TrustAllRoots{}.

func NewED25519Signer

func NewED25519Signer(t testing.TB) security.Signer

NewED25519Signer creates a new ED25519 signer.

func NewExpiryCaveat

func NewExpiryCaveat(t testing.TB, until time.Time) security.Caveat

NewExpiryCaveat is like security.NewNewExpiryCaveat except that it fails on error.

func NewMethodCaveat

func NewMethodCaveat(t testing.TB, method string, additionalMethods ...string) security.Caveat

NewMethodCaveat is like security.NewNewMethodCaveat except that it fails on error.

func NewPrincipal

NewPrincipal creates a new security.Principal using the supplied signer, blessings store and roots.

func NewPublicKeyUnconstrainedCaveat

func NewPublicKeyUnconstrainedCaveat(t testing.TB, p security.Principal, name string) security.Caveat

NewPublicKeyUnconstrainedCaveat creates a named, unconstrained caveat using the supplied principal and with no third party caveats.

func NewSuffixCaveat

func NewSuffixCaveat(t *testing.T, suffix string) security.Caveat

NewSuffixCaveat returns a caveat for SuffixCaveat.

func RoundTrip

func RoundTrip(in, out interface{}) error

RoundTrip simulates a network round trip by encoding/decoding from to/from vom.

Types

type Roots

type Roots struct {
	// contains filtered or unexported fields
}

Roots is an implementation of security.BlessingRoots that trusts the roots that have been added to it.

func (*Roots) Add

func (r *Roots) Add(root []byte, pattern security.BlessingPattern) error

func (*Roots) DebugString

func (*Roots) DebugString() string

func (*Roots) Dump

func (*Roots) Recognized

func (r *Roots) Recognized(root []byte, blessing string) error

type TrustAllRoots

type TrustAllRoots struct {
	// contains filtered or unexported fields
}

TrustAllRoots is an implementation of security.BlessingRoots that trusts all roots, regardless of whether they have been added to it.

func (*TrustAllRoots) Add

func (r *TrustAllRoots) Add(root []byte, pattern security.BlessingPattern) error

func (*TrustAllRoots) DebugString

func (r *TrustAllRoots) DebugString() string

func (*TrustAllRoots) Dump

func (*TrustAllRoots) Recognized

func (r *TrustAllRoots) Recognized(root []byte, blessing string) error

Source Files

Jump to

Keyboard shortcuts

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