secrethandshake

package
v0.0.0-...-4d4f4d6 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2016 License: GPL-3.0 Imports: 16 Imported by: 1

README

go-shs

A Go implementation of dominic's secret-handshake.

Two instances of go-shs can secretly shake hands over a connection. The implementation should be compatible to the JS implementation but this has not been tested yet.

Documentation

Overview

This file is part of secretstream.

secretstream is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

secretstream is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with secretstream. If not, see <http://www.gnu.org/licenses/>.

This file is part of secretstream.

secretstream is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

secretstream is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with secretstream. If not, see <http://www.gnu.org/licenses/>.

This file is part of secretstream.

secretstream is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

secretstream is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with secretstream. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const ChallengeLength = 64

ChallengeLength is the length of a challenge message in bytes

View Source
const ClientAuthLength = 16 + 32 + 64

ClientAuthLength is the length of a clientAuth message in bytes

View Source
const MACLength = 16

MACLength is the length of a MAC in bytes

View Source
const ServerAuthLength = 16 + 64

ServerAuthLength is the length of a serverAuth message in bytes

Variables

This section is empty.

Functions

func Client

func Client(state *State, conn io.ReadWriter) (err error)

Client shakes hands using the cryptographic identity specified in s using conn in the client role

func Server

func Server(state *State, conn io.ReadWriter) (err error)

Server shakes hands using the cryptographic identity specified in s using conn in the server role

Types

type CurveKeyPair

type CurveKeyPair struct {
	Public [32]byte
	Secret [32]byte
}

CurveKeyPair is a keypair for use with github.com/agl/ed25519

type EdKeyPair

type EdKeyPair struct {
	Public [ed25519.PublicKeySize]byte
	Secret [ed25519.PrivateKeySize]byte
}

EdKeyPair is a keypair for use with github.com/agl/ed25519

func GenEdKeyPair

func GenEdKeyPair(r io.Reader) (*EdKeyPair, error)

GenEdKeyPair generates a ed25519 keyPair using the passed reader if r == nil it uses crypto/rand.Reader

func LoadSSBKeyPair

func LoadSSBKeyPair(fname string) (*EdKeyPair, error)

type State

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

State is the state each peer holds during the handshake

func NewClientState

func NewClientState(appKey []byte, local EdKeyPair, remotePublic [ed25519.PublicKeySize]byte) (*State, error)

NewClientState initializes the state for the client side

func NewServerState

func NewServerState(appKey []byte, local EdKeyPair) (*State, error)

NewServerState initializes the state for the server side

func (*State) GetBoxstreamDecKeys

func (s *State) GetBoxstreamDecKeys() ([32]byte, [24]byte)

GetBoxstreamDecKeys returns the decryption key and nonce suitable for boxstream

func (*State) GetBoxstreamEncKeys

func (s *State) GetBoxstreamEncKeys() ([32]byte, [24]byte)

GetBoxstreamEncKeys returns the encryption key and nonce suitable for boxstream

func (*State) Remote

func (s *State) Remote() []byte

Remote returns the public key of the remote party

func (*State) String

func (s *State) String() string

Jump to

Keyboard shortcuts

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