Documentation ¶
Index ¶
- Variables
- func ByteSliceAdd(A []byte, B []byte) (X []byte)
- func ByteSliceMul(A []byte, B []byte) (X []byte)
- func BytesFromRSAPrivateKey(sk *rsa.PrivateKey) []byte
- func BytesFromRSAPublicKey(pk *rsa.PublicKey) []byte
- func ClientHTTP()
- func ClientRegister()
- func ClientRegisterDecentralized(username string, cleosKey string)
- func Comm(cir string, cID int64, numberOfServers int, feePerGate float64, ...)
- func CompareWires(gcm GarbledMessage, arrIn [][]byte, arrOut [][]byte) bool
- func Convert32BytesToByteStream(msg [32]byte) []byte
- func CreateAccount(URL string, r RegisterationMessage)
- func DecryptAES(encKey []byte, cipherText []byte) (plainText []byte, ok bool)
- func EncryptAES(encKey []byte, plainText []byte) (ciphertext []byte, ok bool)
- func GenNRandNumbers(n int, length int, r int64, considerR bool) [][]byte
- func GenerateElGamalKey(hexS []byte) *elgamal.PrivateKey
- func GenerateInputWiresValidate(circ Circuit, rArr []Randomness, cID int64) (in [][]byte, out [][]byte)
- func GenerateMessageArray(cycleMessage CycleMessage, cID int64, circ Circuit) (mArr MessageArray, rArr []Randomness, keys [][]byte)
- func GenerateRSAKey(rsaKeySize int) (*rsa.PrivateKey, *rsa.PublicKey)
- func GetCircuitSize(circ Circuit) int
- func GetFreePort() (int, error)
- func GetFromServerEval(id string) (res [][]byte, ok bool)
- func GetHandlerClient(w http.ResponseWriter, r *http.Request)
- func GetIP() (net.IP, error)
- func GetInputSizeOutputSize(circ Circuit) (inputSize int, outputSize int)
- func IPtoProperByte(ip net.IP) []byte
- func PostHandlerClient(w http.ResponseWriter, r *http.Request)
- func RSAPrivateDecrypt(key *rsa.PrivateKey, data []byte) ([]byte, error)
- func RSAPrivateKeyFromBytes(key []byte) *rsa.PrivateKey
- func RSAPrivateSign(key *rsa.PrivateKey, data []byte) ([]byte, error)
- func RSAPrivateVerify(key *rsa.PrivateKey, sign, data []byte) error
- func RSAPublicEncrypt(key *rsa.PublicKey, data []byte) ([]byte, error)
- func RSAPublicKeyFromBytes(key []byte) *rsa.PublicKey
- func RSAPublicSign(key *rsa.PublicKey, data []byte) ([]byte, error)
- func RSAPublicVerify(key *rsa.PublicKey, sign, data []byte) error
- func RandomSymmKeyGen() (key []byte)
- func RegisterOnDecentralizedDS(URL string, ActionAccount string, r RegisterationMessage) error
- func SHA256Hash(msg []byte) [32]byte
- func SendToClient(res ResEval, ip []byte, port int) bool
- func SendToDirectory(k RegisterationMessage, ip []byte, port int) bool
- func SendToServer(k MessageArray, ip []byte, port int) bool
- func SendToServerEval(k GarbledMessage) bool
- func SendToServerGarble(k CircuitMessage) bool
- func ServerRegisterDecentralized(username string, cleosKey string, numberOfGates int, feePerGate float64)
- func SetDecentralizedDirectoryInfo(url string, actionAccount string, passwordWallet string)
- func SetDirectoryInfo(ip []byte, port int)
- func SetMyInfo(username string, cleosKey string)
- func UnlockWallet(url string, walletKey string) error
- func YaoGarbledCkt_in(rIn int64, length int, inputSize int) [][]byte
- func YaoGarbledCkt_mask(rMask int64, length int, outputSize int) [][]byte
- func YaoGarbledCkt_out(rOut int64, length int, outputSize int) [][]byte
- type ChannelContainer
- type Circuit
- type CircuitGate
- type CircuitMessage
- type ClientInfo
- type ComID
- type Cycle
- type CycleMessage
- type CycleRequestMessage
- type FunctionInfo
- type GarbledCircuit
- type GarbledGate
- type GarbledMessage
- type Gate
- type Message
- type MessageArray
- type MyInfo
- type PartyInfo
- type Randomness
- type RegisterationMessage
- type ResEval
- type ServerCapabilities
- type ServerInfo
- type Token
- type Wire
Constants ¶
This section is empty.
Variables ¶
var Decentralization bool
Decentralization indicates whether the central or decentralized directory of service is used
var DecentralizedDirectoryInfo = struct { URL string ActionAccount string PasswordWallet string }{ URL: "", ActionAccount: "", PasswordWallet: "", }
DecentralizedDirectoryInfo Global Variable to store Directory communication info
var DirctoryInfo = struct { Port int IP []byte }{ Port: 0, IP: []byte(""), }
DirctoryInfo Global Variable to store Directory communication info
var ReadyFlag bool
ReadyFlag is a simulation for channels between the post handler and the eval function
var ReadyMutex = sync.RWMutex{}
ReadyMutex is a simulation for channels between the post handler and the eval function
Functions ¶
func ByteSliceAdd ¶
ByteSliceAdd performs addition of (A + B) % P by converting them into Big Ints and storing the byte slice value into X
func ByteSliceMul ¶
ByteSliceMul performs multiplication of (A * B) % P by converting them into Big Ints and storing the byte slice value into X
func BytesFromRSAPrivateKey ¶
func BytesFromRSAPrivateKey(sk *rsa.PrivateKey) []byte
BytesFromRSAPrivateKey returns byte array encoding from an rsa.privatekey
func BytesFromRSAPublicKey ¶
BytesFromRSAPublicKey returns byte array encoding from an rsa.publickey
func ClientRegister ¶
func ClientRegister()
ClientRegister registers a client to directory of service
func ClientRegisterDecentralized ¶
ClientRegisterDecentralized registers a client to the decentralized directory of service
func Comm ¶
func Comm(cir string, cID int64, numberOfServers int, feePerGate float64, chVDCSCommCircRes chan<- ChannelContainer)
Comm basically, the channel will need to send the input/output mapping as well
func CompareWires ¶
func CompareWires(gcm GarbledMessage, arrIn [][]byte, arrOut [][]byte) bool
CompareWires Takes a garbled circuit and compares wires to input,output wires provided by the user
func Convert32BytesToByteStream ¶
Convert32BytesToByteStream receives a byte array returns the first 32 bytes from it
func CreateAccount ¶
func CreateAccount(URL string, r RegisterationMessage)
CreateAccount to create a new account in the blockchain.
func DecryptAES ¶
DecryptAES symmetric decryption using AES algorithm
func EncryptAES ¶
EncryptAES symmetric encryption using AES algorithm
func GenNRandNumbers ¶
GenNRandNumbers generating random byte arrays
func GenerateElGamalKey ¶
func GenerateElGamalKey(hexS []byte) *elgamal.PrivateKey
GenerateElGamalKey takes a hexadecimal number and generates a private key
func GenerateInputWiresValidate ¶
func GenerateInputWiresValidate(circ Circuit, rArr []Randomness, cID int64) (in [][]byte, out [][]byte)
GenerateInputWiresValidate Given circuit and randomness generate the input wires corresponding to server n-1
func GenerateMessageArray ¶
func GenerateMessageArray(cycleMessage CycleMessage, cID int64, circ Circuit) (mArr MessageArray, rArr []Randomness, keys [][]byte)
GenerateMessageArray Takes a CycleMessage, a cID, and a circuit and creates a message array encrypted and returns it with the corresponding randomness for the user to use
func GenerateRSAKey ¶
func GenerateRSAKey(rsaKeySize int) (*rsa.PrivateKey, *rsa.PublicKey)
GenerateRSAKey generates Public/Private Key pair, advised rsaKeySize = 2048
func GetCircuitSize ¶
GetCircuitSize get the number of gates in a circuit
func GetFreePort ¶
GetFreePort asks the kernel for a free open port that is ready to use.
func GetFromServerEval ¶
GetFromServerEval used in pt2
func GetHandlerClient ¶
func GetHandlerClient(w http.ResponseWriter, r *http.Request)
GetHandlerClient recieves a token challenge and solves it
func GetInputSizeOutputSize ¶
GetInputSizeOutputSize returns the number of inputs and outputs of a given circuit
func IPtoProperByte ¶
IPtoProperByte puts the IP in its proper formatting
func PostHandlerClient ¶
func PostHandlerClient(w http.ResponseWriter, r *http.Request)
PostHandlerClient recieves the result of evaluation
func RSAPrivateDecrypt ¶
func RSAPrivateDecrypt(key *rsa.PrivateKey, data []byte) ([]byte, error)
RSAPrivateDecrypt decrypts encrypted data with a given rsa.privatekey
func RSAPrivateKeyFromBytes ¶
func RSAPrivateKeyFromBytes(key []byte) *rsa.PrivateKey
RSAPrivateKeyFromBytes extracts rsa.privatekey from its byte array encoding
func RSAPrivateSign ¶
func RSAPrivateSign(key *rsa.PrivateKey, data []byte) ([]byte, error)
RSAPrivateSign makes a signature with a private key
func RSAPrivateVerify ¶
func RSAPrivateVerify(key *rsa.PrivateKey, sign, data []byte) error
RSAPrivateVerify verifies a signature made with a private key
func RSAPublicEncrypt ¶
RSAPublicEncrypt encrypts data with a given rsa.publickey
func RSAPublicKeyFromBytes ¶
RSAPublicKeyFromBytes extracts rsa.publickey from its byte array encoding
func RSAPublicSign ¶
RSAPublicSign makes a signature with a public key
func RSAPublicVerify ¶
RSAPublicVerify verifies a signature made with a public key
func RandomSymmKeyGen ¶
func RandomSymmKeyGen() (key []byte)
RandomSymmKeyGen Generates a random key for the AES algorithm
func RegisterOnDecentralizedDS ¶
func RegisterOnDecentralizedDS(URL string, ActionAccount string, r RegisterationMessage) error
RegisterOnDecentralizedDS to register in the decentralized Directory of Service
func SendToClient ¶
SendToClient Invokes the post method on the server
func SendToDirectory ¶
func SendToDirectory(k RegisterationMessage, ip []byte, port int) bool
SendToDirectory Invokes the post method on the directory
func SendToServer ¶
func SendToServer(k MessageArray, ip []byte, port int) bool
SendToServer Invokes the post method on the server
func SendToServerGarble ¶
func SendToServerGarble(k CircuitMessage) bool
SendToServerGarble used in pt2
func ServerRegisterDecentralized ¶
func ServerRegisterDecentralized(username string, cleosKey string, numberOfGates int, feePerGate float64)
ServerRegisterDecentralized registers a client to the decentralized directory of service
func SetDecentralizedDirectoryInfo ¶
SetDecentralizedDirectoryInfo to set the decentralized dircotry info
func SetDirectoryInfo ¶
SetDirectoryInfo to set the dircotry info
func UnlockWallet ¶
UnlockWallet for a node to unlock its eosio wallet
func YaoGarbledCkt_in ¶
YaoGarbledCkt_in input wire garbling
func YaoGarbledCkt_mask ¶
YaoGarbledCkt_mask mask for garbling and rerandomization
Types ¶
type ChannelContainer ¶
type ChannelContainer struct { InputWires []Wire `json:"InputWires"` OutputWires []Wire `json:"OutputWires"` PartyInfo Keys [][]byte `json:"Keys"` }
ChannelContainer contains what is passed through message channels within the client code
type Circuit ¶
type Circuit struct { InputGates []CircuitGate `json:"CircuitInputGates"` MiddleGates []CircuitGate `json:"CircuitMiddleGates"` OutputGates []CircuitGate `json:"CircuitOutputGates"` }
Circuit circuit abstraction
type CircuitGate ¶
CircuitGate a gate in a boolean circuit
func DecryptCircuitGatesAES ¶
func DecryptCircuitGatesAES(key []byte, gates []CircuitGate) []CircuitGate
DecryptCircuitGatesAES decrypts an array of circuit gates with a given symmetric key using AES algorithm
func EncryptCircuitGatesAES ¶
func EncryptCircuitGatesAES(key []byte, gates []CircuitGate) []CircuitGate
EncryptCircuitGatesAES encrypts an array of circuit gates with a given symmetric key using AES algorithm
type CircuitMessage ¶
type CircuitMessage struct { Circuit ComID Randomness }
CircuitMessage a complete circuit message
type ClientInfo ¶
type ClientInfo struct {
PartyInfo
}
ClientInfo container for client relevant info in Directory of Service
type Cycle ¶
type Cycle struct {
ServersCycle []PartyInfo `json:"ServersCycle"`
}
Cycle cycle wrapper
type CycleMessage ¶
CycleMessage a complete cycle message reply
func ConstructCycleStruct ¶
func ConstructCycleStruct(outs []byte, size int) (bool, CycleMessage)
ConstructCycleStruct construct the cycle returned from the transaction
func FetchCycleDecentralized ¶
func FetchCycleDecentralized(URL string, ActionAccount string, c CycleRequestMessage) (bool, CycleMessage)
FetchCycleDecentralized fetches a cycle from the decentralized directory of service
func GetFromDirectory ¶
func GetFromDirectory(k CycleRequestMessage, ip []byte, port int) (cyc CycleMessage, ok bool)
GetFromDirectory Invokes the get method on the directory
type CycleRequestMessage ¶
type CycleRequestMessage struct {
FunctionInfo
}
CycleRequestMessage Wrapping In case we needed to add new request types for failure handling
type FunctionInfo ¶
type FunctionInfo struct { Token NumberOfServers int `json:"NumberOfServers"` ServerCapabilities //in this case we describe the capabilities needed to compute the circuit }
FunctionInfo a container for function requirements
type GarbledCircuit ¶
type GarbledCircuit struct { InputGates []GarbledGate `json:"GarbledInputGates"` MiddleGates []GarbledGate `json:"GarbledMiddleGates"` OutputGates []GarbledGate `json:"GarbledOutputGates"` ComID }
GarbledCircuit garbled circuit abstraction
type GarbledGate ¶
type GarbledGate struct { Gate KeyY [][]byte `json:"EncryptedY"` GarbledValuesC1 [][]byte `json:"GarbledValuesC1"` GarbledValuesC2 [][]byte `json:"GarbledValuesC2"` GarbledValues [][]byte `json:"GarbledValues"` //to be removed later. }
GarbledGate a gate in a garbled circuit
func DecryptGarbledGatesAES ¶
func DecryptGarbledGatesAES(key []byte, gates []GarbledGate) []GarbledGate
DecryptGarbledGatesAES decrypts an array of garbled gates with a given symmetric key using AES algorithm
func EncryptGarbledGatesAES ¶
func EncryptGarbledGatesAES(key []byte, gates []GarbledGate) []GarbledGate
EncryptGarbledGatesAES encrypts an array of garbled gates with a given symmetric key using AES algorithm
type GarbledMessage ¶
type GarbledMessage struct { InputWires []Wire `json:"GarbledInputWires"` GarbledCircuit OutputWires []Wire `json:"GarbledOutputWires"` }
GarbledMessage complete garbled circuit message
func Garble ¶
func Garble(circ CircuitMessage) GarbledMessage
Garble circuit garbling. This now supports only 2-input gates
func GetFromServerGarble ¶
func GetFromServerGarble(id string) (k GarbledMessage, ok bool)
GetFromServerGarble used in pt2
func ReRand ¶
func ReRand(gcm GarbledMessage, r Randomness) GarbledMessage
ReRand does things for a certain circuit view
type Message ¶
type Message struct { Type []byte `json:"Type"` //Garble, Rerand, Eval Circuit GarbledMessage InputWires []Wire `json:"GeneralInputWires"` Randomness ComID NextServer PartyInfo `json:"NextServer"` }
Message passed through cycle
func DecryptMessageAES ¶
DecryptMessageAES takes a symmetric key and message, and decrypts the message using that key
func EncryptMessageAES ¶
EncryptMessageAES takes a symmetric key and message, and encrypts the message using that key
type MessageArray ¶
MessageArray container of messages
type MyInfo ¶
type MyInfo struct { PartyInfo CleosKey []byte `json:"CleosKey"` PrivateKey []byte `json:"PrivateKey"` }
MyInfo container for general and private information about a node
var MyOwnInfo MyInfo
MyOwnInfo personal info container
type PartyInfo ¶
type PartyInfo struct { IP []byte `json:"IP"` Port int `json:"Port"` PublicKey []byte `json:"PublicKey"` UserName []byte `json:"UserName"` }
PartyInfo container for general information about a node
func DecryptPartyInfoAES ¶
DecryptPartyInfoAES decrypts PartyInfo container with a given key using AES Algorithm
func EncryptPartyInfoAES ¶
EncryptPartyInfoAES encrypts PartyInfo container with a given key using AES Algorithm
func GetPartyInfo ¶
GetPartyInfo for a party to extract his own communication info
type Randomness ¶
type Randomness struct { Rin int64 `json:"Rin"` Rout int64 `json:"Rout"` Rmask int64 `json:"Rmask"` Rgc int64 `json:"Rgc"` LblLength int `json:"LblLength"` }
Randomness container for randomness
func DecryptRandomnessAES ¶
func DecryptRandomnessAES(key []byte, rArr Randomness) Randomness
DecryptRandomnessAES decrypts a randomness container with a given key using AES Algorithm
func EncryptRandomnessAES ¶
func EncryptRandomnessAES(key []byte, rArr Randomness) Randomness
EncryptRandomnessAES encrypts a randomness container with a given key using AES Algorithm
func GenerateRandomness ¶
func GenerateRandomness(numberOfServers int, cID int64) []Randomness
GenerateRandomness generates randomness array corresponding to NumberOfServers with a certain computation ID
type RegisterationMessage ¶
type RegisterationMessage struct { Type []byte `json:"Type"` //Server, Client Server ServerInfo `json:"ServerInfo"` }
RegisterationMessage a complete registration message
type ResEval ¶
ResEval evaluation result abstraction
var MyResult ResEval
MyResult is a simulation for channels between the post handler and the eval function
func Evaluate ¶
func Evaluate(gc GarbledMessage) (result ResEval)
Evaluate evaluate a garbled circuit
type ServerCapabilities ¶
type ServerCapabilities struct { NumberOfGates int `json:"NumberOfGates"` FeePerGate float64 `json:"FeePerGate"` }
ServerCapabilities server capabilities abstraction
type ServerInfo ¶
type ServerInfo struct { PartyInfo ServerCapabilities }
ServerInfo container for server relevant info in Directory of Service
type Token ¶
type Token struct {
TokenGen []byte `json:"TokenGen"`
}
Token a token container for the ease of message passing
var MyToken Token
MyToken holds directory sent token
func GetFromClient ¶
GetFromClient Invokes the get method on the client
func GetFromServer ¶
GetFromServer Invokes the get method on the server
func SolveToken ¶
SolveToken recieves a token challenge and solves it
type Wire ¶
Wire wire abstraction
func DecryptWiresAES ¶
DecryptWiresAES decrypts an array of wires with a given key using AES Algorithm
func EncryptWiresAES ¶
EncryptWiresAES encrypts an array of wires with a given key using AES Algorithm
Directories ¶
Path | Synopsis |
---|---|
Package elgamal implements ElGamal encryption, suitable for OpenPGP, as specified in "A Public-Key Cryptosystem and a Signature Scheme Based on Discrete Logarithms," IEEE Transactions on Information Theory, v.
|
Package elgamal implements ElGamal encryption, suitable for OpenPGP, as specified in "A Public-Key Cryptosystem and a Signature Scheme Based on Discrete Logarithms," IEEE Transactions on Information Theory, v. |