bcns

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

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

Go to latest
Published: Nov 10, 2015 License: CC0-1.0 Imports: 7 Imported by: 0

Documentation

Overview

Package bcns implements a key exchange based on the Ring Learning With Errors Problem. It is based heavily on the Public Domain implementation by Joppe W. Bos, Craig Costello, Michael Naehrig, and Douglas Stebila.

For more information see: http://eprint.iacr.org/2014/599

Index

Constants

View Source
const (
	// PublicKeySize is the length of a Ring-LWE public key in bytes.
	PublicKeySize = 4096

	// PrivateKeySize is the length of a Ring-LWE private key in bytes.
	PrivateKeySize = 4096

	// RecDataSize is the length of the reconcilliation data in bytes.
	RecDataSize = 128

	// SharedSecretSize is the length of a Ring-LWE Shared Secret in bytes.
	SharedSecretSize = 128
)

Variables

View Source
var (
	// ErrInvalidPublicKeySize is the error returned when a public key blob
	// is an invalid length.
	ErrInvalidPublicKeySize = errors.New("rlwe: invalid public key length")

	// ErrInvalidRecDataSize is the error returned when a reconcilliation
	// data blob is an invalid length.
	ErrInvalidRecDataSize = errors.New("rlwe: invalid reconcilliation data length")
)

Functions

func GenerateKeyPair

func GenerateKeyPair(r io.Reader) (*PrivateKey, *PublicKey, error)

GenerateKeyPair returns a private/public key pair. The private key is generated using the given reader which must return random data.

func KeyExchangeAlice

func KeyExchangeAlice(bobPk *PublicKey, aliceSk *PrivateKey, rec *RecData) []byte

KeyExchangeAlice is the Initiator side of the Ring-LWE key exchange.

Types

type PrivateKey

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

PrivateKey is a Ring-LWE private key.

type PublicKey

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

PublicKey is a Ring-LWE public key.

func (*PublicKey) Bytes

func (pub *PublicKey) Bytes() []byte

Bytes serializes a Ring-LWE public key.

func (*PublicKey) FromBytes

func (pub *PublicKey) FromBytes(b []byte) error

FromBytes deserializes a Ring-LWE public key.

type RecData

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

RecData is the Ring-LWE reconcilliation data.

func KeyExchangeBob

func KeyExchangeBob(r io.Reader, alicePk *PublicKey, bobSk *PrivateKey) (*RecData, []byte, error)

KeyExchangeBob is the Responder side of the Ring-LWE key exchange. The reconciliation data and shared secret are generated using the given reader which must return random data.

func (*RecData) Bytes

func (rec *RecData) Bytes() []byte

Bytes serializes Ring-LWE reconcilliation data.

func (*RecData) FromBytes

func (rec *RecData) FromBytes(b []byte) error

FromBytes deserializes a Ring-LWE reconcilliation data blob.

Jump to

Keyboard shortcuts

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