Documentation ¶
Overview ¶
Copyright (c) 2021 - for information on the respective copyright owner see the NOTICE file and/or the repository https://github.com/carbynestack/ephemeral.
SPDX-License-Identifier: Apache-2.0
Copyright (c) 2021 - for information on the respective copyright owner see the NOTICE file and/or the repository https://github.com/carbynestack/ephemeral.
SPDX-License-Identifier: Apache-2.0
Copyright (c) 2021 - for information on the respective copyright owner see the NOTICE file and/or the repository https://github.com/carbynestack/ephemeral.
SPDX-License-Identifier: Apache-2.0
Copyright (c) 2021 - for information on the respective copyright owner see the NOTICE file and/or the repository https://github.com/carbynestack/ephemeral.
SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
const BodySize = 32
BodySize equals to 32 = 16 bytes secret share + 16 bytes MAC.
const ErrInvalidBodySize = "Body size must be a multiple of 32"
ErrInvalidBodySize is thrown when a message of invalid length is provided.
const ErrInvalidResponseSize = "Response size must be equal to 20"
ErrInvalidResponseSize is thrown when a message of invalid length is returned.
const ErrInvalidWordSize = "plain text message size must be a multiple of 16"
ErrInvalidWordSize is thrown when a SPDZ runtime socket response is not equal to word size.
const ErrMarshal = "at 1 object must be provided to marshal"
ErrMarshal is thrown when provided input is < 1.
const ErrParcelToSPDZ = "parcelsToSPDZ error: "
ErrParcelToSPDZ is thrown when an error in parcelsToSPDZ method has occured.
const ErrSPDZToParcel = "spdzToParcels error: "
ErrSPDZToParcel is thrown when an error in spdzToParcels method has occured.
const ErrSizeTooBig = "size array must be <= 32 bits"
ErrSizeTooBig is thrown when the size of the parameters is exceeded.
const MessageSize = 36
MessageSize equals to 36 = 4 bytes Length + 32 bytes of message
const ParcelSizeLength = 4
ParcelSizeLength is the length of the Parcel size header in bytes.
const ResponseSizeCipher = 36
ResponseSizeCipher is the size of a byte array containing plain text.
const WordSize = 16
WordSize is the size of a single word in SPDZ runtime notation, e.g. secret share or MAC.
Variables ¶
var MaxLength = int(math.Pow(2, 32))
MaxLength is the max size of Param's octet.
Functions ¶
This section is empty.
Types ¶
type AbstractCarrier ¶
type AbstractCarrier interface { Connect(context.Context, string, string) error Close() error Send([]amphora.SecretShare) error Read(ResponseConverter, bool) (*Result, error) }
AbstractCarrier is the carriers interface.
type AmphoraFeeder ¶
type AmphoraFeeder struct {
// contains filtered or unexported fields
}
AmphoraFeeder provides parameters to the SPDZ execution based on the given activation.
func NewAmphoraFeeder ¶
func NewAmphoraFeeder(l *zap.SugaredLogger, conf *SPDZEngineTypedConfig) *AmphoraFeeder
NewAmphoraFeeder returns a new instance of amphora feeder.
func (*AmphoraFeeder) Close ¶
func (f *AmphoraFeeder) Close() error
Close closes the underlying socket connection.
func (*AmphoraFeeder) LoadFromRequestAndFeed ¶
func (f *AmphoraFeeder) LoadFromRequestAndFeed(act *Activation, feedPort string, ctx *CtxConfig) ([]byte, error)
LoadFromRequestAndFeed loads input parameteters from the request body.
func (*AmphoraFeeder) LoadFromSecretStoreAndFeed ¶
func (f *AmphoraFeeder) LoadFromSecretStoreAndFeed(act *Activation, feedPort string, ctx *CtxConfig) ([]byte, error)
LoadFromSecretStoreAndFeed loads input parameters from Amphora.
type Carrier ¶
type Carrier struct { Dialer func(ctx context.Context, addr, port string) (net.Conn, error) Conn net.Conn Packer Packer // contains filtered or unexported fields }
Carrier is a TCP client for TCP sockets.
func (*Carrier) Connect ¶
Connect establishes a TCP connection to a socket on a given host and port.
type Feeder ¶
type Feeder interface { LoadFromSecretStoreAndFeed(act *Activation, feedPort string, ctx *CtxConfig) ([]byte, error) LoadFromRequestAndFeed(act *Activation, feedPort string, ctx *CtxConfig) ([]byte, error) Close() error }
Feeder is an interface.
type Packer ¶
type Packer interface { Marshal([]string, *[]byte) error Unmarshal(*[]byte, ResponseConverter, bool) ([]string, error) }
Packer is an interface to marshal and unmarshal strings to the format specified by a given MPC runtime.
type PlaintextConverter ¶
type PlaintextConverter struct {
Params []interface{}
}
PlaintextConverter expects plain-text response from SPDZ and converts it into a human readable base64 encoded int64 param. base64 encoding is used to comply with the format we use when storing objects in Amphora.
type ResponseConverter ¶
type ResponseConverter interface {
// contains filtered or unexported methods
}
ResponseConverter is an interface for a struct that mutates the response from SPDZ runtime to a required format.
type Result ¶
type Result struct {
Response []string `json:"response"`
}
Result contains the response from SPDZ runtime computation.
type SPDZPacker ¶
type SPDZPacker struct { // maxBulkSize is the maximum size of bulk objects received as parameters. MaxBulkSize int32 }
SPDZPacker is an implementation of Packer interface for SPDZ runtime.
func (*SPDZPacker) Marshal ¶
func (p *SPDZPacker) Marshal(b64 []string, dst *[]byte) (err error)
Marshal converts a base64 encoded string into a byte array consumable by SPDZ runtime.
func (*SPDZPacker) Unmarshal ¶
func (p *SPDZPacker) Unmarshal(in *[]byte, conv ResponseConverter, bulkSecrets bool) ([]string, error)
Unmarshal converts a byte sequence to a base64 encoded secret share representation consumable by Amphora.
type SecretSharesConverter ¶
type SecretSharesConverter struct {
}SecretSharesConverter is to be used for encoding base64 secret shared responses received from SPDZ runtime.