A handle, describing the secret-key element that "matches" a part, of the form s^r(X^t). More...

#include <Ctxt.h>

Public Member Functions

 SKHandle (long newPowerOfS=0, long newPowerOfX=1, long newSecretKeyID=0)
 
void setBase (long newSecretKeyID=-1)
 Set powerOfS=powerOfX=1. More...
 
bool isBase (long ofKeyID=0) const
 Is powerOfS==powerOfX==1? More...
 
void setOne (long newSecretKeyID=-1)
 Set powerOfS=0, powerOfX=1. More...
 
bool isOne () const
 Is powerOfS==0? More...
 
bool operator== (const SKHandle &other) const
 
bool operator!= (const SKHandle &other) const
 
long getPowerOfS () const
 
long getPowerOfX () const
 
long getSecretKeyID () const
 
bool mul (const SKHandle &a, const SKHandle &b)
 Computes the "product" of two handles. More...
 
void writeTo (std::ostream &str) const
 Write out the SKHandle object in binary format. More...
 
void writeToJSON (std::ostream &str) const
 Write out the secret key handle (SKHandle) object to the output stream using JSON format. More...
 
JsonWrapper writeToJSON () const
 Write out the secret key handle (SKHandle) object to a JsonWrapper. More...
 
void readJSON (std::istream &str)
 Read from the stream the serialized secret key handle (SKHandle) object using JSON format. More...
 
void readJSON (const JsonWrapper &j)
 Read from the JsonWrapper the serialized secret key handle (SKHandle) object. More...
 

Static Public Member Functions

static SKHandle readFrom (std::istream &str)
 Read from the stream the serialized SKHandle object in binary format. More...
 
static SKHandle readFromJSON (std::istream &str)
 Read from the stream the serialized secret key handle (SKHandle) object using JSON format. More...
 
static SKHandle readFromJSON (const JsonWrapper &j)
 Read from the JsonWrapper the serialized secret key handle (SKHandle) object. More...
 

Friends

class Ctxt
 
std::istream & operator>> (std::istream &s, SKHandle &handle)
 

Detailed Description

A handle, describing the secret-key element that "matches" a part, of the form s^r(X^t).

Constructor & Destructor Documentation

◆ SKHandle()

helib::SKHandle::SKHandle ( long  newPowerOfS = 0,
long  newPowerOfX = 1,
long  newSecretKeyID = 0 
)
inline

Member Function Documentation

◆ getPowerOfS()

long helib::SKHandle::getPowerOfS ( ) const
inline

◆ getPowerOfX()

long helib::SKHandle::getPowerOfX ( ) const
inline

◆ getSecretKeyID()

long helib::SKHandle::getSecretKeyID ( ) const
inline

◆ isBase()

bool helib::SKHandle::isBase ( long  ofKeyID = 0) const
inline

Is powerOfS==powerOfX==1?

◆ isOne()

bool helib::SKHandle::isOne ( ) const
inline

Is powerOfS==0?

◆ mul()

bool helib::SKHandle::mul ( const SKHandle a,
const SKHandle b 
)
inline

Computes the "product" of two handles.

The key-ID's and powers of X must match, else an error state arises, which is represented using a key-ID of -1 and returning false. Also, note that inputs may alias outputs.

To determine if the resulting handle can be re-linearized using some key-switching matrices from the public key, use the method pubKey.haveKeySWmatrix(handle,handle.secretKeyID), from the class PubKey in keys.h

◆ operator!=()

bool helib::SKHandle::operator!= ( const SKHandle other) const
inline

◆ operator==()

bool helib::SKHandle::operator== ( const SKHandle other) const
inline

◆ readFrom()

SKHandle helib::SKHandle::readFrom ( std::istream &  str)
static

Read from the stream the serialized SKHandle object in binary format.

Parameters
strInput std::istream.
Returns
The deserialized SKHandle object.

◆ readFromJSON() [1/2]

SKHandle helib::SKHandle::readFromJSON ( const JsonWrapper j)
static

Read from the JsonWrapper the serialized secret key handle (SKHandle) object.

Parameters
jThe JsonWrapper containing the serialized SKHandle object.
Returns
The deserialized SKHandle object.

◆ readFromJSON() [2/2]

SKHandle helib::SKHandle::readFromJSON ( std::istream &  str)
static

Read from the stream the serialized secret key handle (SKHandle) object using JSON format.

Parameters
strInput std::istream.
Returns
The deserialized SKHandle object.

◆ readJSON() [1/2]

void helib::SKHandle::readJSON ( const JsonWrapper j)

Read from the JsonWrapper the serialized secret key handle (SKHandle) object.

Parameters
jThe JsonWrapper containing the serialized SKHandle object.

◆ readJSON() [2/2]

void helib::SKHandle::readJSON ( std::istream &  str)

Read from the stream the serialized secret key handle (SKHandle) object using JSON format.

Parameters
strInput std::istream.

◆ setBase()

void helib::SKHandle::setBase ( long  newSecretKeyID = -1)
inline

Set powerOfS=powerOfX=1.

◆ setOne()

void helib::SKHandle::setOne ( long  newSecretKeyID = -1)
inline

Set powerOfS=0, powerOfX=1.

◆ writeTo()

void helib::SKHandle::writeTo ( std::ostream &  str) const

Write out the SKHandle object in binary format.

Parameters
strOutput std::ostream.

◆ writeToJSON() [1/2]

JsonWrapper helib::SKHandle::writeToJSON ( ) const

Write out the secret key handle (SKHandle) object to a JsonWrapper.

Returns
The JsonWrapper.

◆ writeToJSON() [2/2]

void helib::SKHandle::writeToJSON ( std::ostream &  str) const

Write out the secret key handle (SKHandle) object to the output stream using JSON format.

Parameters
strOutput std::ostream.

Friends And Related Function Documentation

◆ Ctxt

friend class Ctxt
friend

◆ operator>>

std::istream& operator>> ( std::istream &  s,
SKHandle handle 
)
friend