keys.h
An object that mimics the functionality of the Ctxt object, and acts as a convenient entry point for ...
Definition: Ctxt.h:67
const DoubleCRT & getRecryptKey() const
Getter method for the recryption key.
Definition: keys.h:398
SecKey()=delete
bool haveKeySWmatrix(const SKHandle &from, long toID=0) const
Definition: keys.cpp:285
long getKSStrategy(long dim) const
get KS strategy for dimension dim dim == -1 is Frobenius
Definition: keys.cpp:314
static constexpr std::string_view typeName
Class label to be added to JSON serialization as object type information.
Definition: keys.h:302
bool haveAnyKeySWmatrix(const SKHandle &from) const
Definition: keys.cpp:298
double RLWE1(DoubleCRT &c0, const DoubleCRT &c1, const DoubleCRT &s, long p)
Same as RLWE, but assumes that c1 is already chosen by the caller.
Definition: keys.cpp:33
static constexpr std::string_view typeName
Class label to be added to JSON serialization as object type information.
Definition: keys.h:77
void writeTo(std::ostream &str) const
Write out the PubKey object in binary format.
Definition: keys.cpp:881
friend std::ostream & operator<<(std::ostream &str, const SecKey &sk)
Definition: keys.cpp:1708
Implementing polynomials (elements in the ring R_Q) in double-CRT form.
Definition: DoubleCRT.h:75
friend std::istream & operator>>(std::istream &str, SecKey &sk)
Definition: keys.cpp:1723
bool isReachable(long k, long keyID=0) const
Is it possible to re-linearize the automorphism X -> X^k See Section 3.2.2 in the design document (Ke...
Definition: keys.cpp:309
PubKey()=delete
Definition: JsonWrapper.h:8
void readJSON(std::istream &str)
In-place read from the stream the serialized public key (PubKey) object using JSON format.
Definition: keys.cpp:1008
static PubKey readFrom(std::istream &str, const Context &context)
Read from the stream the serialized PubKey object in binary format.
Definition: keys.cpp:916
void setKeySwitchMap(long keyId=0)
Compute the reachability graph of key-switching matrices See Section 3.2.2 in the design document (Ke...
Definition: keys.cpp:115
A handle, describing the secret-key element that "matches" a part, of the form s^r(X^t).
Definition: Ctxt.h:80
static long ePlusR(long p)
static SecKey readFrom(std::istream &str, const Context &context)
Read from the stream the serialized SecKey object in binary format.
Definition: keys.cpp:1745
void GenKeySWmatrix(long fromSPower, long fromXPower, long fromKeyIdx=0, long toKeyIdx=0, long ptxtSpace=0)
Definition: keys.cpp:1152
Definition: EncodedPtxt.h:142
friend std::ostream & operator<<(std::ostream &str, const PubKey &pk)
Definition: keys.cpp:866
JsonWrapper writeToJSON() const
Write out the secret key (SecKey) object to a JsonWrapper.
Definition: keys.cpp:1775
static SecKey readFromJSON(std::istream &str, const Context &context)
Read from the stream the serialized secret key (SecKey) object using JSON format.
Definition: keys.cpp:1786
~SecKey() override=default
Represents the set of long int's plus a distinguished value that can be used to denote "undefined"....
Definition: NumbTh.h:997
static PubKey readFromJSON(std::istream &str, const Context &context)
Read from the stream the serialized public key (PubKey) object using JSON format.
Definition: keys.cpp:992
Definition: EncodedPtxt.h:20
long genRecryptData()
Generate bootstrapping data if needed, returns index of key.
Definition: keys.cpp:1671
const KeySwitch & getAnyKeySWmatrix(const SKHandle &from) const
Is there a matrix from this key to any base key?
Definition: keys.cpp:188
void CKKSencrypt(Ctxt &ciphertxt, const NTL::ZZX &plaintxt, double ptxtSize=1.0, double scaling=0.0) const
Definition: keys.cpp:494
long Encrypt(Ctxt &ciphertxt, const NTL::ZZX &plaintxt, long ptxtSpace, bool highNoise) const
Definition: keys.cpp:351
std::ostream & writeSecKeyDerivedASCII(std::ostream &str) const
Definition: keys.cpp:1715
Definition: apiAttributes.h:21
JsonWrapper writeToJSON() const
Write out the public key (PubKey) object to a JsonWrapper.
Definition: keys.cpp:974
void writeTo(std::ostream &str) const
Write out the SecKey object in binary format.
Definition: keys.cpp:1729
double RLWE(DoubleCRT &c0, DoubleCRT &c1, const DoubleCRT &s, long p, NTL::ZZ *prgSeed=nullptr)
Definition: keys.cpp:69
long GenSecKey(long ptxtSpace=0, long maxDegKswitch=3)
Definition: keys.cpp:1132
void setKSStrategy(long dim, int val)
set KS strategy for dimension dim dim == -1 is Frobenius
Definition: keys.cpp:328
Definition: EncodedPtxt.h:38
void Decrypt(NTL::ZZX &plaintxt, const Ctxt &ciphertxt) const
Definition: keys.cpp:1251
const KeySwitch & getNextKSWmatrix(long fromXPower, long fromID=0) const
Get the next matrix to use for multi-hop automorphism See Section 3.2.2 in the design document.
Definition: keys.cpp:303
long skEncrypt(Ctxt &ctxt, const NTL::ZZX &ptxt, long ptxtSpace, long skIdx) const
Symmetric encryption using the secret key.
Definition: keys.cpp:1417
long Encrypt(Ctxt &ciphertxt, const NTL::ZZX &plaintxt, long ptxtSpace=0) const override
Definition: keys.cpp:1533
void readJSON(std::istream &str)
Read from the stream the serialized secret key (SecKey) object using JSON format.
Definition: keys.cpp:1804
double getSKeyBound(long keyID=0) const
The size of the secret key.
Definition: keys.cpp:273
friend std::istream & operator>>(std::istream &str, PubKey &pk)
Definition: keys.cpp:872
const KeySwitch & getKeySWmatrix(const SKHandle &from, long toID=0) const
Find a key-switching matrix by its indexes. If no such matrix exists it returns a dummy matrix with t...
Definition: keys.cpp:167
long ImportSecKey(const DoubleCRT &sKey, double bound, long ptxtSpace=0, long maxDegKswitch=3)
Definition: keys.cpp:1092