mls

package module
v0.0.0-...-1041956 Latest Latest
Warning

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

Go to latest
Published: May 17, 2020 License: BSD-2-Clause Imports: 22 Imported by: 0

README

Message Layer Security

Coverage Status

This is a protocol to do group key establishment in an asynchronous, message-oriented setting. Its core ideas borrow a lot from Asynchronous Ratchet Trees.

Right now, this is just a Go library that implements the core protocol. It is missing key things like message sequencing, deconfliction, and retransmission. The interface should not be considered stable.

The most you can really do with it is run the tests:

> go test -v

The tests in state_test.go will illustrate the basic flows that are supported.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStateFromWelcome

func NewStateFromWelcome(suite CipherSuite, epochSecret []byte, welcome Welcome) (*State, LeafIndex, []byte, error)

Types

type AddProposal

type AddProposal struct {
	KeyPackage KeyPackage
}

type ApplicationData

type ApplicationData struct {
	Data []byte `tls:"head=4"`
}

type BasicCredential

type BasicCredential struct {
	Identity           []byte `tls:"head=2"`
	SignatureScheme    SignatureScheme
	SignaturePublicKey SignaturePublicKey
}
struct {
    opaque identity<0..2^16-1>;
    SignatureScheme algorithm;
    SignaturePublicKey public_key;
} BasicCredential;

type Bytes1

type Bytes1 []byte

func (Bytes1) MarshalTLS

func (b Bytes1) MarshalTLS() ([]byte, error)

func (Bytes1) UnmarshalTLS

func (b Bytes1) UnmarshalTLS(data []byte) (int, error)

type CipherSuite

type CipherSuite uint16
const (
	X25519_AES128GCM_SHA256_Ed25519        CipherSuite = 0x0001
	P256_AES128GCM_SHA256_P256             CipherSuite = 0x0002
	X25519_CHACHA20POLY1305_SHA256_Ed25519 CipherSuite = 0x0003
	X448_AES256GCM_SHA512_Ed448            CipherSuite = 0x0004 // UNSUPPORTED
	P521_AES256GCM_SHA512_P521             CipherSuite = 0x0005
	X448_CHACHA20POLY1305_SHA512_Ed448     CipherSuite = 0x0006 // UNSUPPORTED
)

func (CipherSuite) Constants

func (cs CipherSuite) Constants() cipherConstants

func (CipherSuite) Digest

func (cs CipherSuite) Digest(data []byte) []byte

func (CipherSuite) NewAEAD

func (cs CipherSuite) NewAEAD(key []byte) (cipher.AEAD, error)

func (CipherSuite) NewHMAC

func (cs CipherSuite) NewHMAC(key []byte) hash.Hash

func (CipherSuite) Scheme

func (cs CipherSuite) Scheme() SignatureScheme

func (CipherSuite) String

func (cs CipherSuite) String() string

type Commit

type Commit struct {
	Updates []ProposalID `tls:"head=2"`
	Removes []ProposalID `tls:"head=2"`
	Adds    []ProposalID `tls:"head=2"`

	KeyPackage KeyPackage
	Path       DirectPath
}

type CommitData

type CommitData struct {
	Commit       Commit
	Confirmation Confirmation
}

type Confirmation

type Confirmation struct {
	Data []byte `tls:"head=1"`
}

type ContentType

type ContentType uint8
const (
	ContentTypeInvalid     ContentType = 0
	ContentTypeApplication ContentType = 1
	ContentTypeProposal    ContentType = 2
	ContentTypeCommit      ContentType = 3
)

func (ContentType) ValidForTLS

func (ct ContentType) ValidForTLS() error

type Credential

type Credential struct {
	X509  *X509Credential
	Basic *BasicCredential
	// contains filtered or unexported fields
}
	struct {
		CredentialType credential_type;
		select (Credential.credential_type) {
			case basic:
				BasicCredential;
			case x509:
				opaque cert_data<1..2^24-1>;
		};
} Credential;

func NewBasicCredential

func NewBasicCredential(userId []byte, scheme SignatureScheme, priv *SignaturePrivateKey) *Credential

func NewX509Credential

func NewX509Credential(chain []*x509.Certificate, priv *SignaturePrivateKey) (*Credential, error)

func (Credential) Equals

func (c Credential) Equals(o Credential) bool

compare the public aspects

func (Credential) Identity

func (c Credential) Identity() []byte

func (Credential) MarshalTLS

func (c Credential) MarshalTLS() ([]byte, error)

func (Credential) PrivateKey

func (c Credential) PrivateKey() (SignaturePrivateKey, bool)

func (Credential) PublicKey

func (c Credential) PublicKey() *SignaturePublicKey

func (*Credential) RemovePrivateKey

func (c *Credential) RemovePrivateKey()

func (Credential) Scheme

func (c Credential) Scheme() SignatureScheme

func (*Credential) SetPrivateKey

func (c *Credential) SetPrivateKey(priv SignaturePrivateKey)

func (Credential) Type

func (c Credential) Type() CredentialType

func (*Credential) UnmarshalTLS

func (c *Credential) UnmarshalTLS(data []byte) (int, error)

type CredentialType

type CredentialType uint8
const (
	CredentialTypeInvalid CredentialType = 255
	CredentialTypeBasic   CredentialType = 0
	CredentialTypeX509    CredentialType = 1
)

func (CredentialType) ValidForTLS

func (ct CredentialType) ValidForTLS() error

type DirectPath

type DirectPath struct {
	Nodes []DirectPathNode `tls:"head=2"`
}

type DirectPathNode

type DirectPathNode struct {
	PublicKey            HPKEPublicKey
	EncryptedPathSecrets []HPKECiphertext `tls:"head=2"`
}

type EncryptedGroupSecrets

type EncryptedGroupSecrets struct {
	KeyPackageHash        []byte `tls:"head=1"`
	EncryptedGroupSecrets HPKECiphertext
}

/ / EncryptedGroupSecrets /

type Epoch

type Epoch uint64

/ / MLSPlaintext and MLSCiphertext /

type ExpirationExtension

type ExpirationExtension uint64

func (ExpirationExtension) Type

type Extension

type Extension struct {
	ExtensionType ExtensionType
	ExtensionData []byte `tls:"head=2"`
}

type ExtensionBody

type ExtensionBody interface {
	Type() ExtensionType
}

type ExtensionList

type ExtensionList struct {
	Entries []Extension `tls:"head=2"`
}

func NewExtensionList

func NewExtensionList() ExtensionList

func (*ExtensionList) Add

func (el *ExtensionList) Add(src ExtensionBody) error

func (ExtensionList) Find

func (el ExtensionList) Find(dst ExtensionBody) (bool, error)

func (ExtensionList) Has

func (el ExtensionList) Has(extType ExtensionType) bool

type ExtensionType

type ExtensionType uint16
const (
	ExtensionTypeInvalid               ExtensionType = 0x0000
	ExtensionTypeSupportedVersions     ExtensionType = 0x0001
	ExtensionTypeSupportedCipherSuites ExtensionType = 0x0002
	ExtensionTypeExpiration            ExtensionType = 0x0003
	ExtensionTypeKeyID                 ExtensionType = 0x0004
	ExtensionTypeParentHash            ExtensionType = 0x0005
)

type GroupContext

type GroupContext struct {
	GroupID                 []byte `tls:"head=1"`
	Epoch                   Epoch
	TreeHash                []byte `tls:"head=1"`
	ConfirmedTranscriptHash []byte `tls:"head=1"`
	Extensions              ExtensionList
}

/ / GroupContext /

type GroupInfo

type GroupInfo struct {
	GroupID                 []byte `tls:"head=1"`
	Epoch                   Epoch
	Tree                    RatchetTree
	ConfirmedTranscriptHash []byte `tls:"head=1"`
	InterimTranscriptHash   []byte `tls:"head=1"`
	Extensions              ExtensionList
	Confirmation            []byte `tls:"head=1"`
	SignerIndex             LeafIndex
	Signature               []byte `tls:"head=2"`
}

type GroupSecrets

type GroupSecrets struct {
	EpochSecret []byte `tls:"head=1"`
	PathSecret  []byte `tls:"head=1"`
}

/ / GroupSecrets /

type HPKECiphertext

type HPKECiphertext struct {
	KEMOutput  []byte `tls:"head=2"`
	Ciphertext []byte `tls:"head=4"`
}

type HPKEInstance

type HPKEInstance struct {
	BaseSuite CipherSuite
	Suite     hpke.CipherSuite
}

func (HPKEInstance) Decrypt

func (h HPKEInstance) Decrypt(priv HPKEPrivateKey, aad []byte, ct HPKECiphertext) ([]byte, error)

func (HPKEInstance) Derive

func (h HPKEInstance) Derive(seed []byte) (HPKEPrivateKey, error)

func (HPKEInstance) Encrypt

func (h HPKEInstance) Encrypt(pub HPKEPublicKey, aad, pt []byte) (HPKECiphertext, error)

func (HPKEInstance) Generate

func (h HPKEInstance) Generate() (HPKEPrivateKey, error)

type HPKEPrivateKey

type HPKEPrivateKey struct {
	Data      []byte `tls:"head=2"`
	PublicKey HPKEPublicKey
}

type HPKEPublicKey

type HPKEPublicKey struct {
	Data []byte `tls:"head=2"`
}

func (HPKEPublicKey) Equals

func (k HPKEPublicKey) Equals(o HPKEPublicKey) bool

type KeyPackage

type KeyPackage struct {
	Version     ProtocolVersion
	CipherSuite CipherSuite
	InitKey     HPKEPublicKey
	Credential  Credential
	Extensions  ExtensionList
	Signature   Signature
	// contains filtered or unexported fields
}

func NewKeyPackage

func NewKeyPackage(suite CipherSuite, cred *Credential) (*KeyPackage, error)

func NewKeyPackageWithInitKey

func NewKeyPackageWithInitKey(suite CipherSuite, initKey HPKEPrivateKey, cred *Credential) (*KeyPackage, error)

func (KeyPackage) Clone

func (kp KeyPackage) Clone() KeyPackage

func (KeyPackage) Equals

func (kp KeyPackage) Equals(other KeyPackage) bool

func (KeyPackage) PrivateKey

func (kp KeyPackage) PrivateKey() (HPKEPrivateKey, bool)

func (*KeyPackage) RemovePrivateKey

func (kp *KeyPackage) RemovePrivateKey()

func (*KeyPackage) SetExtensions

func (kp *KeyPackage) SetExtensions(exts []ExtensionBody) error

func (*KeyPackage) SetPrivateKey

func (kp *KeyPackage) SetPrivateKey(priv HPKEPrivateKey) error

func (*KeyPackage) Sign

func (kp *KeyPackage) Sign() error

func (*KeyPackage) UpdateInitKey

func (kp *KeyPackage) UpdateInitKey() error

func (KeyPackage) Verify

func (kp KeyPackage) Verify() bool

type LeafCount

type LeafCount uint32

type LeafIndex

type LeafIndex uint32

type LeafNodeHashInput

type LeafNodeHashInput struct {
	LeafIndex  LeafIndex
	KeyPackage *KeyPackage `tls:"optional"`
}

type MLSCiphertext

type MLSCiphertext struct {
	GroupID             []byte `tls:"head=1"`
	Epoch               Epoch
	ContentType         ContentType
	SenderDataNonce     []byte `tls:"head=1"`
	EncryptedSenderData []byte `tls:"head=1"`
	AuthenticatedData   []byte `tls:"head=4"`
	Ciphertext          []byte `tls:"head=4"`
}

type MLSPlaintext

type MLSPlaintext struct {
	GroupID           []byte `tls:"head=1"`
	Epoch             Epoch
	Sender            Sender
	AuthenticatedData []byte `tls:"head=4"`
	Content           MLSPlaintextContent
	Signature         Signature
}

type MLSPlaintextContent

type MLSPlaintextContent struct {
	Application *ApplicationData
	Proposal    *Proposal
	Commit      *CommitData
}

func (MLSPlaintextContent) MarshalTLS

func (c MLSPlaintextContent) MarshalTLS() ([]byte, error)

func (MLSPlaintextContent) Type

func (*MLSPlaintextContent) UnmarshalTLS

func (c *MLSPlaintextContent) UnmarshalTLS(data []byte) (int, error)

type Node

type Node struct {
	Leaf   *KeyPackage
	Parent *ParentNode
	Hash   []byte
}

/ / Node /

func (*Node) Clone

func (n *Node) Clone() *Node

func (*Node) Equals

func (n *Node) Equals(other *Node) bool

func (Node) MarshalTLS

func (n Node) MarshalTLS() ([]byte, error)

func (*Node) ParentHash

func (n *Node) ParentHash() ([]byte, bool)

func (Node) PrivateKey

func (n Node) PrivateKey() (HPKEPrivateKey, bool)

func (Node) PublicKey

func (n Node) PublicKey() HPKEPublicKey

func (*Node) SetPrivateKey

func (n *Node) SetPrivateKey(priv HPKEPrivateKey)

func (Node) Type

func (n Node) Type() NodeType

func (*Node) UnmarshalTLS

func (n *Node) UnmarshalTLS(data []byte) (int, error)

type NodeIndex

type NodeIndex uint32

type NodeType

type NodeType uint8
const (
	NodeTypeLeaf   NodeType = 0x00
	NodeTypeParent NodeType = 0x01
)

type OptionalNode

type OptionalNode struct {
	Node *Node  `tls:"optional"`
	Hash []byte `tls:"omit"`
}

/ / OptionalNode /

func (OptionalNode) Blank

func (n OptionalNode) Blank() bool

func (OptionalNode) Clone

func (n OptionalNode) Clone() OptionalNode

func (*OptionalNode) MergePublic

func (n *OptionalNode) MergePublic(pub HPKEPublicKey)

func (*OptionalNode) ParentHash

func (n *OptionalNode) ParentHash(suite CipherSuite) ([]byte, error)

func (*OptionalNode) SetLeafNodeHash

func (n *OptionalNode) SetLeafNodeHash(suite CipherSuite, index LeafIndex) error

func (*OptionalNode) SetParentNodeHash

func (n *OptionalNode) SetParentNodeHash(suite CipherSuite, index NodeIndex, left, right []byte) error

func (*OptionalNode) SetToBlank

func (n *OptionalNode) SetToBlank()

type ParentHashExtension

type ParentHashExtension struct {
	ParentHash []byte `tls:"head=1"`
}

func (ParentHashExtension) Type

type ParentNode

type ParentNode struct {
	PublicKey      HPKEPublicKey
	UnmergedLeaves []LeafIndex     `tls:"head=4"`
	ParentHash     []byte          `tls:"head=1"`
	PrivateKey     *HPKEPrivateKey `tls:"omit"`
}

func (*ParentNode) AddUnmerged

func (n *ParentNode) AddUnmerged(l LeafIndex)

func (ParentNode) Clone

func (n ParentNode) Clone() ParentNode

func (*ParentNode) Equals

func (n *ParentNode) Equals(other *ParentNode) bool

func (*ParentNode) SetPrivateKey

func (n *ParentNode) SetPrivateKey(priv HPKEPrivateKey)

func (*ParentNode) SetPublicKey

func (n *ParentNode) SetPublicKey(pub HPKEPublicKey)

func (*ParentNode) SetSecret

func (n *ParentNode) SetSecret(suite CipherSuite, pathSecret []byte) error

type ParentNodeHashInput

type ParentNodeHashInput struct {
	NodeIndex  NodeIndex
	ParentNode *ParentNode `tls:"optional"`
	LeftHash   []byte      `tls:"head=1"`
	RightHash  []byte      `tls:"head=1"`
}

type Proposal

type Proposal struct {
	Add    *AddProposal
	Update *UpdateProposal
	Remove *RemoveProposal
}

func (Proposal) MarshalTLS

func (p Proposal) MarshalTLS() ([]byte, error)

func (Proposal) Type

func (p Proposal) Type() ProposalType

func (*Proposal) UnmarshalTLS

func (p *Proposal) UnmarshalTLS(data []byte) (int, error)

type ProposalID

type ProposalID struct {
	Hash []byte `tls:"head=1"`
}

/ / Commit /

func (ProposalID) String

func (pid ProposalID) String() string

type ProposalRef

type ProposalRef uint64

type ProposalType

type ProposalType uint8

/ / Proposal /

const (
	ProposalTypeInvalid ProposalType = 0
	ProposalTypeAdd     ProposalType = 1
	ProposalTypeUpdate  ProposalType = 2
	ProposalTypeRemove  ProposalType = 3
)

func (ProposalType) ValidForTLS

func (pt ProposalType) ValidForTLS() error

type ProtocolVersion

type ProtocolVersion uint8
const (
	ProtocolVersionMLS10 ProtocolVersion = 0x00
)

type RatchetTree

type RatchetTree struct {
	Suite CipherSuite    `tls:"omit"`
	Nodes []OptionalNode `tls:"head=4"`
}

/ / RatchetTree /

func NewRatchetTree

func NewRatchetTree(suite CipherSuite) *RatchetTree

func (*RatchetTree) AddLeaf

func (t *RatchetTree) AddLeaf(index LeafIndex, keyPkg KeyPackage) error

func (*RatchetTree) BlankPath

func (t *RatchetTree) BlankPath(index LeafIndex) error

func (RatchetTree) Clone

func (t RatchetTree) Clone() RatchetTree

func (*RatchetTree) Decap

func (t *RatchetTree) Decap(from LeafIndex, context []byte, path DirectPath) ([]byte, error)

func (*RatchetTree) Encap

func (t *RatchetTree) Encap(from LeafIndex, context, leafSecret []byte) (DirectPath, []byte, []byte, error)

func (RatchetTree) Equals

func (t RatchetTree) Equals(o RatchetTree) bool

func (RatchetTree) Find

func (t RatchetTree) Find(kp KeyPackage) (LeafIndex, bool)

func (RatchetTree) GetSecrets

func (t RatchetTree) GetSecrets() TreeSecrets

func (*RatchetTree) Implant

func (t *RatchetTree) Implant(start NodeIndex, pathSecret []byte) ([]byte, error)

func (*RatchetTree) ImplantFrom

func (t *RatchetTree) ImplantFrom(from, to LeafIndex, pathSecret []byte) ([]byte, error)

func (RatchetTree) KeyPackage

func (t RatchetTree) KeyPackage(index LeafIndex) (KeyPackage, bool)

func (RatchetTree) LeftmostFree

func (t RatchetTree) LeftmostFree() LeafIndex

func (RatchetTree) ParentHashValid

func (t RatchetTree) ParentHashValid() bool

A tree's parent hashes are valid if every non-blank parent node is listed as parent hash for at least one of its children.

func (RatchetTree) PathSecrets

func (t RatchetTree) PathSecrets(start NodeIndex, pathSecret []byte) map[NodeIndex][]byte

func (RatchetTree) RootHash

func (t RatchetTree) RootHash() []byte

func (*RatchetTree) SetHashAll

func (t *RatchetTree) SetHashAll() error

func (*RatchetTree) SetLeaf

func (t *RatchetTree) SetLeaf(index LeafIndex, keyPkg KeyPackage) error

func (*RatchetTree) SetLeafPrivateKeys

func (t *RatchetTree) SetLeafPrivateKeys(index LeafIndex, initPriv HPKEPrivateKey, sigPriv SignaturePrivateKey) error

func (*RatchetTree) SetSecrets

func (t *RatchetTree) SetSecrets(ts TreeSecrets)

func (RatchetTree) Size

func (t RatchetTree) Size() LeafCount

number of leaves in the ratchet tree

func (*RatchetTree) UpdateLeaf

func (t *RatchetTree) UpdateLeaf(index LeafIndex, keyPkg KeyPackage) error

type ReadStream

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

func NewReadStream

func NewReadStream(data []byte) *ReadStream

func (*ReadStream) Position

func (s *ReadStream) Position() int

func (*ReadStream) Read

func (s *ReadStream) Read(val interface{}) (int, error)

func (*ReadStream) ReadAll

func (s *ReadStream) ReadAll(vals ...interface{}) (int, error)

func (ReadStream) Remaining

func (s ReadStream) Remaining() int

type RemoveProposal

type RemoveProposal struct {
	Removed LeafIndex
}

type Sender

type Sender struct {
	Type   SenderType
	Sender uint32
}

type SenderType

type SenderType uint8
const (
	SenderTypeInvalid       SenderType = 0
	SenderTypeMember        SenderType = 1
	SenderTypePreconfigured SenderType = 2
	SenderTypeNewMember     SenderType = 3
)

func (SenderType) ValidForTLS

func (st SenderType) ValidForTLS() error

type Signature

type Signature struct {
	Data []byte `tls:"head=2"`
}

/ / KeyPackage /

type SignaturePrivateKey

type SignaturePrivateKey struct {
	Data      []byte `tls:"head=2"`
	PublicKey SignaturePublicKey
}

type SignaturePublicKey

type SignaturePublicKey struct {
	Data []byte `tls:"head=2"`
}

func (SignaturePublicKey) Equals

func (pub SignaturePublicKey) Equals(other SignaturePublicKey) bool

type SignatureScheme

type SignatureScheme uint16
const (
	ECDSA_SECP256R1_SHA256 SignatureScheme = 0x0403
	ECDSA_SECP521R1_SHA512 SignatureScheme = 0x0603
	Ed25519                SignatureScheme = 0x0807
)

func (SignatureScheme) Derive

func (ss SignatureScheme) Derive(preSeed []byte) (SignaturePrivateKey, error)

func (SignatureScheme) Generate

func (ss SignatureScheme) Generate() (SignaturePrivateKey, error)

func (SignatureScheme) Sign

func (ss SignatureScheme) Sign(priv *SignaturePrivateKey, message []byte) ([]byte, error)

func (SignatureScheme) String

func (ss SignatureScheme) String() string

func (SignatureScheme) Verify

func (ss SignatureScheme) Verify(pub *SignaturePublicKey, message, signature []byte) bool

type State

type State struct {
	// Shared confirmed state
	CipherSuite             CipherSuite
	GroupID                 []byte `tls:"head=1"`
	Epoch                   Epoch
	Tree                    RatchetTree
	ConfirmedTranscriptHash []byte `tls:"head=1"`
	InterimTranscriptHash   []byte `tls:"head=1"`
	Extensions              ExtensionList

	// Per-participant non-secret state
	Index            LeafIndex           `tls:"omit"`
	IdentityPriv     SignaturePrivateKey `tls:"omit"`
	Scheme           SignatureScheme     `tls:"omit"`
	PendingProposals []MLSPlaintext      `tls:"omit"`

	// Secret state
	UpdateKeys map[ProposalRef]HPKEPrivateKey `tls:"omit"`
	Keys       keyScheduleEpoch               `tls:"omit"`

	// Helpful information
	NewCredentials map[LeafIndex]bool
}

func NewEmptyState

func NewEmptyState(groupID []byte, kp KeyPackage) (*State, error)

func NewEmptyStateWithExtensions

func NewEmptyStateWithExtensions(groupID []byte, kp KeyPackage, ext ExtensionList) (*State, error)

func NewJoinedState

func NewJoinedState(kps []KeyPackage, welcome Welcome) (*State, error)

func NewStateFromWelcomeAndSecrets

func NewStateFromWelcomeAndSecrets(welcome Welcome, ss StateSecrets) (*State, error)

func (State) Add

func (s State) Add(kp KeyPackage) (*MLSPlaintext, error)

func (State) Clone

func (s State) Clone() *State

func (*State) Commit

func (s *State) Commit(leafSecret []byte) (*MLSPlaintext, *Welcome, *State, error)

func (State) Equals

func (s State) Equals(o State) bool

Compare the public and shared private aspects of two nodes

func (State) GetSecrets

func (s State) GetSecrets() StateSecrets

func (*State) Handle

func (s *State) Handle(pt *MLSPlaintext) (*State, error)

func (*State) Protect

func (s *State) Protect(data []byte) (*MLSCiphertext, error)

func (*State) Remove

func (s *State) Remove(removed LeafIndex) (*MLSPlaintext, error)

func (*State) SetSecrets

func (s *State) SetSecrets(ss StateSecrets)

func (*State) Unprotect

func (s *State) Unprotect(ct *MLSCiphertext) ([]byte, error)

func (State) Update

func (s State) Update(kp KeyPackage) (*MLSPlaintext, error)

type StateSecrets

type StateSecrets struct {
	CipherSuite CipherSuite

	// Per-participant non-secret state
	Index            LeafIndex
	InitPriv         HPKEPrivateKey
	IdentityPriv     SignaturePrivateKey
	Scheme           SignatureScheme
	PendingProposals []MLSPlaintext `tls:"head=4"`

	// Secret state
	UpdateKeys map[ProposalRef]HPKEPrivateKey `tls:"head=4"`
	Keys       keyScheduleEpoch
	Tree       TreeSecrets
}

Isolated getters and setters for public and secret state

Note that the get/set operations here are very shallow. We basically assume that the StateSecrets object is temporary, as a carrier for marshaling / unmarshaling.

type SupportedCipherSuitesExtension

type SupportedCipherSuitesExtension struct {
	SupportedCipherSuites []CipherSuite `tls:"head=1"`
}

func (SupportedCipherSuitesExtension) Type

type SupportedVersionsExtension

type SupportedVersionsExtension struct {
	SupportedVersions []ProtocolVersion `tls:"head=1"`
}

func (SupportedVersionsExtension) Type

type TreeSecrets

type TreeSecrets struct {
	PrivateKeys map[NodeIndex]HPKEPrivateKey `tls:"head=4"`
}

Isolated getters and setters for secret state

type UpdateProposal

type UpdateProposal struct {
	KeyPackage KeyPackage
}

type Welcome

type Welcome struct {
	Version            ProtocolVersion
	CipherSuite        CipherSuite
	Secrets            []EncryptedGroupSecrets `tls:"head=4"`
	EncryptedGroupInfo []byte                  `tls:"head=4"`
	// contains filtered or unexported fields
}

func (Welcome) Decrypt

func (w Welcome) Decrypt(suite CipherSuite, epochSecret []byte) (*GroupInfo, error)

func (*Welcome) EncryptTo

func (w *Welcome) EncryptTo(kp KeyPackage, pathSecret []byte)

type WriteStream

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

func NewWriteStream

func NewWriteStream() *WriteStream

func (*WriteStream) Append

func (s *WriteStream) Append(b []byte) error

func (*WriteStream) Data

func (s *WriteStream) Data() []byte

func (*WriteStream) Write

func (s *WriteStream) Write(val interface{}) error

func (*WriteStream) WriteAll

func (s *WriteStream) WriteAll(vals ...interface{}) error

type X509Credential

type X509Credential struct {
	Chain []*x509.Certificate
}

case x509:

opaque cert_data<1..2^24-1>;

func (X509Credential) Equals

func (cred X509Credential) Equals(other *X509Credential) bool

func (X509Credential) MarshalTLS

func (cred X509Credential) MarshalTLS() ([]byte, error)

func (X509Credential) PublicKey

func (cred X509Credential) PublicKey() *SignaturePublicKey

func (X509Credential) Scheme

func (cred X509Credential) Scheme() SignatureScheme

func (*X509Credential) UnmarshalTLS

func (cred *X509Credential) UnmarshalTLS(data []byte) (int, error)

func (X509Credential) Verify

func (cred X509Credential) Verify(trusted []*x509.Certificate) error

XXX(RLB): This is a very simple chain validation, just looking at signatures and whatever basic hop-by-hop policy is applied by CheckSignatureFrom. More complex things like name constraints are not considered. They would be if we were using x509.Certificate.Verify, but that method (1) requires a DNS name as the authentication anchor, and (2) builds its own chain without strict ordering.

Jump to

Keyboard shortcuts

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