tormessage

package module
v0.0.0-...-5ee4ec6 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2018 License: MIT Imports: 16 Imported by: 0

README

TorMessage

Build Status Go Report Card Coverage Status

Work in progress messenger that communicates over Tor and supports forward secrecy

To build run:

  • go get github.com/ConnorJarvis/TorMessage
  • go build ./examples/command_line_chat.go

To start a conversation run:

  • ./command_line_chat -hostname 127.0.0.1:9000 -name Connor -host

This will start hosting a conversation and output a base64 string Conversation Start

To start the partner conversation run:

  • ./command_line_chat -hostname 127.0.0.1:9001 -name Connor2 -extradata $base64_string

This base64 string contains the hostname, public key and 3 initial keys needed to initialize a conversation

To chat just enter text into the console

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AES

type AES interface {
	Encrypt([]byte, []byte, []byte) ([]byte, error)
	Decrypt([]byte, []byte, []byte) ([]byte, error)
	GenerateAESKey(io.Reader) ([]byte, error)
	GenerateAESNonce(io.Reader) ([]byte, error)
	EncryptHeader(Header, []byte, []byte) ([]byte, error)
	DecryptHeader([]byte, []byte, []byte) (*Header, error)
	EncryptMessageBody(interface{}, []byte, []byte) ([]byte, error)
	DecryptMessageBody([]byte, []byte, []byte, int) (interface{}, error)
}

func NewAES

func NewAES() AES

type Chat

type Chat interface {
	InitializeConversation(*string) (*string, error)
	InitiateConnection() error
	NegotiateNewKeys() error
	SendTextMessage(string) error
	State() ChatInformation
	StartServer()
	StartKeyNegotiatingService()
}

func NewChat

func NewChat(chatInformation ChatInformation) Chat

type ChatInformation

type ChatInformation struct {
	Hostname        string
	PartnerHostname string
	Name            string
	Host            bool
	Conversation    Conversation
}

type Conversation

type Conversation interface {
	CreateSendKeyInitializers(int) ([]MessageKeyInitializer, error)
	CreateReceiveKeyInitializers(int) ([]MessageKeyInitializer, error)
	ComputeKeyMessages([]MessageKeyInitializer, []MessageKeyInitializer) ([]MessageKey, error)
	State() ConversationInfo
	ReceiveMessage(MessageEncrypted) error
	GetSendMessageKey(int) (*MessageKey, error)
	GetReceiveMessageKey(int) (*MessageKey, error)
	GetReceiveMessageKeyInitializer(int) (*MessageKeyInitializer, error)
	RemoveReceiveMessageKey(int) error
	RemoveSendMessageKey(int) error
	HandleNegotiateKeysMessage(*NegotiateKeysMessage) error
	HandleTextMessage(*TextMessage) error
	PrepareMessage(MessageUnencrypted) (*MessageEncrypted, error)
	SendMessage(MessageEncrypted) error
	PrepareNegotiateKeysMessage(*[]MessageKeyInitializer, *[]MessageKeyInitializer) error
	StartConnection(MessageUnencrypted) error
	NegotiateKeys(MessageUnencrypted) error
	ReceiveMessageProcessor(chan MessageEncrypted)
	StartSendService()
}

func NewConversation

func NewConversation(info ConversationInfo) Conversation

type ConversationInfo

type ConversationInfo struct {
	Hostname                             string
	PrivateKey                           rsa.PrivateKey
	PublicKey                            rsa.PublicKey
	SendingMessageKeys                   []MessageKey
	SendingMessageKeyInitializers        []MessageKeyInitializer
	ReceivingMessageKeys                 []MessageKey
	ReceivingMessageKeyInitializers      []MessageKeyInitializer
	SendingMessageIndex                  int
	SendingMessageKeyInitializersIndex   int
	ReceivingMessageIndex                int
	ReceivingMessageKeyInitializersIndex int
	PartnerPublicKey                     *rsa.PublicKey
	PartnerHostname                      string
	SendQueue                            chan MessageUnencrypted
	ReceiveQueue                         chan MessageEncrypted
	DisplayQueue                         chan TextMessage
}

type DesktopInformation

type DesktopInformation struct {
	Platform string
	Chat     Chat
}

type ECDH

type ECDH interface {
	GenerateKey(io.Reader) (crypto.PrivateKey, crypto.PublicKey, error)
	Marshal(crypto.PublicKey) []byte
	Unmarshal([]byte) (crypto.PublicKey, bool)
	GenerateSharedSecret(crypto.PrivateKey, crypto.PublicKey) ([]byte, error)
}

func NewCurve25519ECDH

func NewCurve25519ECDH() ECDH
type Header struct {
	MessageVersion int
	MessageType    int
	Hostname       string
}

type InitialMessage

type InitialMessage struct {
	PublicKey         rsa.PublicKey
	PartnerPublicKeys []MessageKeyInitializer
}

type InitializingData

type InitializingData struct {
	Hostname             string
	PublicKey            rsa.PublicKey
	SendingMessageKeys   []MessageKey
	ReceivingMessageKeys []MessageKey
}

type MessageEncrypted

type MessageEncrypted struct {
	ID              int
	HeaderNonce     []byte
	BodyNonce       []byte
	Header          []byte
	Body            []byte
	HeaderSignature []byte
	BodySignature   []byte
}

type MessageKey

type MessageKey struct {
	ID  int
	Key []byte
}

type MessageKeyInitializer

type MessageKeyInitializer struct {
	ID         int
	PublicKey  []byte
	PrivateKey crypto.PrivateKey
	Key        []byte
}

type MessageUnencrypted

type MessageUnencrypted struct {
	ID              int
	HeaderNonce     []byte
	BodyNonce       []byte
	Header          Header
	Body            interface{}
	HeaderSignature []byte
	BodySignature   []byte
}

type Messages

func NewMessages

func NewMessages() Messages

type NegotiateKeysMessage

type NegotiateKeysMessage struct {
	HostPublicKeys    *[]MessageKeyInitializer
	PartnerPublicKeys *[]MessageKeyInitializer
}

type RSA

type RSA interface {
	GenerateRSAKey(io.Reader) (*rsa.PrivateKey, *rsa.PublicKey, error)
}

func NewRSA

func NewRSA() RSA

type TextMessage

type TextMessage struct {
	Name string
	Body string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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