Documentation
¶
Index ¶
- func NewStateFromWelcome(suite CipherSuite, epochSecret []byte, welcome Welcome) (*State, LeafIndex, []byte, error)
- type AddProposal
- type ApplicationData
- type BasicCredential
- type Bytes1
- type CipherSuite
- type Commit
- type CommitData
- type Confirmation
- type ContentType
- type Credential
- func (c Credential) Equals(o Credential) bool
- func (c Credential) Identity() []byte
- func (c Credential) MarshalTLS() ([]byte, error)
- func (c Credential) PrivateKey() (SignaturePrivateKey, bool)
- func (c Credential) PublicKey() *SignaturePublicKey
- func (c *Credential) RemovePrivateKey()
- func (c Credential) Scheme() SignatureScheme
- func (c *Credential) SetPrivateKey(priv SignaturePrivateKey)
- func (c Credential) Type() CredentialType
- func (c *Credential) UnmarshalTLS(data []byte) (int, error)
- type CredentialType
- type DirectPath
- type DirectPathNode
- type EncryptedGroupSecrets
- type Epoch
- type ExpirationExtension
- type Extension
- type ExtensionBody
- type ExtensionList
- type ExtensionType
- type GroupContext
- type GroupInfo
- type GroupSecrets
- type HPKECiphertext
- type HPKEInstance
- func (h HPKEInstance) Decrypt(priv HPKEPrivateKey, aad []byte, ct HPKECiphertext) ([]byte, error)
- func (h HPKEInstance) Derive(seed []byte) (HPKEPrivateKey, error)
- func (h HPKEInstance) Encrypt(pub HPKEPublicKey, aad, pt []byte) (HPKECiphertext, error)
- func (h HPKEInstance) Generate() (HPKEPrivateKey, error)
- type HPKEPrivateKey
- type HPKEPublicKey
- type KeyPackage
- func (kp KeyPackage) Clone() KeyPackage
- func (kp KeyPackage) Equals(other KeyPackage) bool
- func (kp KeyPackage) PrivateKey() (HPKEPrivateKey, bool)
- func (kp *KeyPackage) RemovePrivateKey()
- func (kp *KeyPackage) SetExtensions(exts []ExtensionBody) error
- func (kp *KeyPackage) SetPrivateKey(priv HPKEPrivateKey) error
- func (kp *KeyPackage) Sign() error
- func (kp *KeyPackage) UpdateInitKey() error
- func (kp KeyPackage) Verify() bool
- type LeafCount
- type LeafIndex
- type LeafNodeHashInput
- type MLSCiphertext
- type MLSPlaintext
- type MLSPlaintextContent
- type Node
- func (n *Node) Clone() *Node
- func (n *Node) Equals(other *Node) bool
- func (n Node) MarshalTLS() ([]byte, error)
- func (n *Node) ParentHash() ([]byte, bool)
- func (n Node) PrivateKey() (HPKEPrivateKey, bool)
- func (n Node) PublicKey() HPKEPublicKey
- func (n *Node) SetPrivateKey(priv HPKEPrivateKey)
- func (n Node) Type() NodeType
- func (n *Node) UnmarshalTLS(data []byte) (int, error)
- type NodeIndex
- type NodeType
- type OptionalNode
- func (n OptionalNode) Blank() bool
- func (n OptionalNode) Clone() OptionalNode
- func (n *OptionalNode) MergePublic(pub HPKEPublicKey)
- func (n *OptionalNode) ParentHash(suite CipherSuite) ([]byte, error)
- func (n *OptionalNode) SetLeafNodeHash(suite CipherSuite, index LeafIndex) error
- func (n *OptionalNode) SetParentNodeHash(suite CipherSuite, index NodeIndex, left, right []byte) error
- func (n *OptionalNode) SetToBlank()
- type ParentHashExtension
- type ParentNode
- func (n *ParentNode) AddUnmerged(l LeafIndex)
- func (n ParentNode) Clone() ParentNode
- func (n *ParentNode) Equals(other *ParentNode) bool
- func (n *ParentNode) SetPrivateKey(priv HPKEPrivateKey)
- func (n *ParentNode) SetPublicKey(pub HPKEPublicKey)
- func (n *ParentNode) SetSecret(suite CipherSuite, pathSecret []byte) error
- type ParentNodeHashInput
- type Proposal
- type ProposalID
- type ProposalRef
- type ProposalType
- type ProtocolVersion
- type RatchetTree
- func (t *RatchetTree) AddLeaf(index LeafIndex, keyPkg KeyPackage) error
- func (t *RatchetTree) BlankPath(index LeafIndex) error
- func (t RatchetTree) Clone() RatchetTree
- func (t *RatchetTree) Decap(from LeafIndex, context []byte, path DirectPath) ([]byte, error)
- func (t *RatchetTree) Encap(from LeafIndex, context, leafSecret []byte) (DirectPath, []byte, []byte, error)
- func (t RatchetTree) Equals(o RatchetTree) bool
- func (t RatchetTree) Find(kp KeyPackage) (LeafIndex, bool)
- func (t RatchetTree) GetSecrets() TreeSecrets
- func (t *RatchetTree) Implant(start NodeIndex, pathSecret []byte) ([]byte, error)
- func (t *RatchetTree) ImplantFrom(from, to LeafIndex, pathSecret []byte) ([]byte, error)
- func (t RatchetTree) KeyPackage(index LeafIndex) (KeyPackage, bool)
- func (t RatchetTree) LeftmostFree() LeafIndex
- func (t RatchetTree) ParentHashValid() bool
- func (t RatchetTree) PathSecrets(start NodeIndex, pathSecret []byte) map[NodeIndex][]byte
- func (t RatchetTree) RootHash() []byte
- func (t *RatchetTree) SetHashAll() error
- func (t *RatchetTree) SetLeaf(index LeafIndex, keyPkg KeyPackage) error
- func (t *RatchetTree) SetLeafPrivateKeys(index LeafIndex, initPriv HPKEPrivateKey, sigPriv SignaturePrivateKey) error
- func (t *RatchetTree) SetSecrets(ts TreeSecrets)
- func (t RatchetTree) Size() LeafCount
- func (t *RatchetTree) UpdateLeaf(index LeafIndex, keyPkg KeyPackage) error
- type ReadStream
- type RemoveProposal
- type Sender
- type SenderType
- type Signature
- type SignaturePrivateKey
- type SignaturePublicKey
- type SignatureScheme
- func (ss SignatureScheme) Derive(preSeed []byte) (SignaturePrivateKey, error)
- func (ss SignatureScheme) Generate() (SignaturePrivateKey, error)
- func (ss SignatureScheme) Sign(priv *SignaturePrivateKey, message []byte) ([]byte, error)
- func (ss SignatureScheme) String() string
- func (ss SignatureScheme) Verify(pub *SignaturePublicKey, message, signature []byte) bool
- type State
- func NewEmptyState(groupID []byte, kp KeyPackage) (*State, error)
- func NewEmptyStateWithExtensions(groupID []byte, kp KeyPackage, ext ExtensionList) (*State, error)
- func NewJoinedState(kps []KeyPackage, welcome Welcome) (*State, error)
- func NewStateFromWelcomeAndSecrets(welcome Welcome, ss StateSecrets) (*State, error)
- func (s State) Add(kp KeyPackage) (*MLSPlaintext, error)
- func (s State) Clone() *State
- func (s *State) Commit(leafSecret []byte) (*MLSPlaintext, *Welcome, *State, error)
- func (s State) Equals(o State) bool
- func (s State) GetSecrets() StateSecrets
- func (s *State) Handle(pt *MLSPlaintext) (*State, error)
- func (s *State) Protect(data []byte) (*MLSCiphertext, error)
- func (s *State) Remove(removed LeafIndex) (*MLSPlaintext, error)
- func (s *State) SetSecrets(ss StateSecrets)
- func (s *State) Unprotect(ct *MLSCiphertext) ([]byte, error)
- func (s State) Update(kp KeyPackage) (*MLSPlaintext, error)
- type StateSecrets
- type SupportedCipherSuitesExtension
- type SupportedVersionsExtension
- type TreeSecrets
- type UpdateProposal
- type Welcome
- type WriteStream
- type X509Credential
- func (cred X509Credential) Equals(other *X509Credential) bool
- func (cred X509Credential) MarshalTLS() ([]byte, error)
- func (cred X509Credential) PublicKey() *SignaturePublicKey
- func (cred X509Credential) Scheme() SignatureScheme
- func (cred *X509Credential) UnmarshalTLS(data []byte) (int, error)
- func (cred X509Credential) Verify(trusted []*x509.Certificate) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStateFromWelcome ¶
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 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) 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) 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 ExpirationExtension ¶
type ExpirationExtension uint64
func (ExpirationExtension) Type ¶
func (ee ExpirationExtension) Type() ExtensionType
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 ¶
/ / GroupSecrets /
type HPKECiphertext ¶
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 LeafNodeHashInput ¶
type LeafNodeHashInput struct { LeafIndex LeafIndex KeyPackage *KeyPackage `tls:"optional"` }
type MLSCiphertext ¶
type MLSPlaintext ¶
type MLSPlaintextContent ¶
type MLSPlaintextContent struct { Application *ApplicationData Proposal *Proposal Commit *CommitData }
func (MLSPlaintextContent) MarshalTLS ¶
func (c MLSPlaintextContent) MarshalTLS() ([]byte, error)
func (MLSPlaintextContent) Type ¶
func (c MLSPlaintextContent) Type() ContentType
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) MarshalTLS ¶
func (*Node) ParentHash ¶
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)
type OptionalNode ¶
/ / 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 ¶
func (phe ParentHashExtension) Type() ExtensionType
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 (Proposal) Type ¶
func (p Proposal) Type() ProposalType
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 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) GetSecrets ¶
func (s State) GetSecrets() StateSecrets
func (*State) SetSecrets ¶
func (s *State) SetSecrets(ss StateSecrets)
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 ¶
func (sce SupportedCipherSuitesExtension) Type() ExtensionType
type SupportedVersionsExtension ¶
type SupportedVersionsExtension struct {
SupportedVersions []ProtocolVersion `tls:"head=1"`
}
func (SupportedVersionsExtension) Type ¶
func (sve SupportedVersionsExtension) Type() ExtensionType
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.