ake

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package ake provides high-level functions for the 3DH AKE.

Package ake provides high-level functions for the 3DH AKE.

Package ake provides high-level functions for the 3DH AKE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyGen

func KeyGen(id group.Group) (sk, pk []byte)

KeyGen returns private and public keys in the group.

Types

type Client

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

Client exposes the client's AKE functions and holds its state.

func NewClient

func NewClient() *Client

NewClient returns a new, empty, 3DH client.

func (*Client) Finalize

func (c *Client) Finalize(p *internal.Parameters, clientIdentity []byte, clientSecretKey *group.Scalar, serverIdentity, serverPublicKey []byte,
	ke1 *message.KE1, ke2 *message.KE2) (*message.KE3, error)

Finalize verifies and responds to KE3. If the handshake is successful, the session key is stored and this functions returns a KE3 message.

func (*Client) SessionKey

func (c *Client) SessionKey() []byte

SessionKey returns the secret shared session key if a previous call to Finalize() was successful.

func (*Client) SetValues

func (c *Client) SetValues(id group.Group, esk *group.Scalar, nonce []byte, nonceLen int) *group.Point

SetValues - testing: integrated to support testing, to force values. There's no effect if esk, epk, and nonce have already been set in a previous call.

func (*Client) Start

func (c *Client) Start(cs group.Group) *message.KE1

Start initiates the 3DH protocol, and returns a KE1 message with clientInfo.

type Server

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

Server exposes the server's AKE functions and holds its state.

func NewServer

func NewServer() *Server

NewServer returns a new, empty, 3DH server.

func (*Server) ExpectedMAC

func (s *Server) ExpectedMAC() []byte

ExpectedMAC returns the expected client MAC if a previous call to Response() was successful.

func (*Server) Finalize

func (s *Server) Finalize(p *internal.Parameters, ke3 *message.KE3) bool

Finalize verifies the authentication tag contained in ke3.

func (*Server) Response

func (s *Server) Response(p *internal.Parameters, serverIdentity []byte, serverSecretKey *group.Scalar, clientIdentity, clientPublicKey []byte,
	ke1 *message.KE1, response *cred.CredentialResponse) (*message.KE2, error)

Response produces a 3DH server response message.

func (*Server) SerializeState

func (s *Server) SerializeState() []byte

SerializeState will return a []byte containing internal state of the Server.

func (*Server) SessionKey

func (s *Server) SessionKey() []byte

SessionKey returns the secret shared session key if a previous call to Response() was successful.

func (*Server) SetState

func (s *Server) SetState(clientMac, sessionSecret []byte) error

SetState will set the given clientMac and sessionSecret in the server's internal state.

func (*Server) SetValues

func (s *Server) SetValues(id group.Group, esk *group.Scalar, nonce []byte, nonceLen int) *group.Point

SetValues - testing: integrated to support testing, to force values. There's no effect if esk, epk, and nonce have already been set in a previous call.

Jump to

Keyboard shortcuts

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