HElib 1.0 Implementing Homomorphic Encryption

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Files Functions Variables Friends Pages
Public Member Functions | Public Attributes | Friends | List of all members
FHESecKey Class Reference

The secret key. More...

`#include <FHE.h>`

Inheritance diagram for FHESecKey:

## Public Member Functions
| FHESecKey (const FHEcontext &_context)
bool | operator== (const FHESecKey &other) const
bool | operator!= (const FHESecKey &other) const
void | clear ()
long | ImportSecKey (const DoubleCRT &sKey, long hwt, long ptxtSpace=0)
long | GenSecKey (long hwt, long ptxtSpace=0)
void | GenKeySWmatrix (long fromSPower, long fromXPower, long fromKeyIdx=0, long toKeyIdx=0, long ptxtSpace=0)
void | Decrypt (ZZX &plaintxt, const Ctxt &ciphertxt) const
void | Decrypt (ZZX &plaintxt, const Ctxt &ciphertxt, ZZX &f) const
| Debugging version, returns in f the polynomial before reduction modulo the ptxtSpace.
long | Encrypt (Ctxt &ctxt, const ZZX &ptxt, long ptxtSpace=0, long skIdx=0) const
| Symmetric encryption using the secret key.
Public Member Functions inherited from FHEPubKey
| FHEPubKey (const FHEcontext &_context)
void | clear ()
bool | operator== (const FHEPubKey &other) const
bool | operator!= (const FHEPubKey &other) const
const FHEcontext & | getContext () const
long | getSKeyWeight (long keyID=0) const
| The Hamming weight of the secret key.
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 (KeySwitchMap)
void | setKeySwitchMap (long keyId=0)
| Compute the reachability graph of key-switching matrices See Section 3.2.2 in the design document (KeySwitchMap)
long | Encrypt (Ctxt &ciphertxt, const ZZX &plaintxt, long ptxtSpace=0) const
| Result returned in the ciphertext argument, The resurn value is the plaintext-space for that ciphertext.
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 toKeyID==-1.
const KeySwitch & | getKeySWmatrix (long fromSPower, long fromXPower, long fromID=0, long toID=0) const
bool | haveKeySWmatrix (const SKHandle &from, long toID=0) const
bool | haveKeySWmatrix (long fromSPower, long fromXPower, long fromID=0, long toID=0) const
const KeySwitch & | getAnyKeySWmatrix (const SKHandle &from) const
| Is there a matrix from this key to any base key?
bool | haveAnyKeySWmatrix (const SKHandle &from) const
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.

## Public Attributes
vector< DoubleCRT > | sKeys

## Friends
ostream & | operator<< (ostream &str, const FHESecKey &sk)
istream & | operator>> (istream &str, FHESecKey &sk)

## Detailed Description

The secret key.

## Member Function Documentation

void FHESecKey::GenKeySWmatrix | ( | long | fromSPower,
|  | long | fromXPower,
|  | long | fromKeyIdx = `0`,
|  | long | toKeyIdx = `0`,
|  | long | ptxtSpace = `0`
| ) |  |

Generate a key-switching matrix and store it in the public key. The i'th column of the matrix encrypts fromKey*B1*B2*...*B{i-1}*Q under toKey, relative to the largest modulus (i.e., all primes) and plaintext space p. Q is the product of special primes, and the Bi's are the products of primes in the i'th digit. The plaintext space defaults to 2^r, as defined by context.mod2r.

long FHESecKey::GenSecKey | ( | long | hwt,
|  | long | ptxtSpace = `0`
| ) |  |
| inline

Key generation: This procedure generates a single secret key, pushes it onto the sKeys list using ImportSecKey from above.

long FHESecKey::ImportSecKey | ( | const DoubleCRT & | sKey,
|  | long | hwt,
|  | long | ptxtSpace = `0`
| ) |  |

We allow the calling application to choose a secret-key polynomial by itself, then insert it into the FHESecKey object, getting the index of that secret key in the sKeys list. If this is the first secret-key for this object then the procedure below also generate a corresponding public encryption key. It is assumed that the context already contains all parameters.

The documentation for this class was generated from the following files:

- src/FHE.h
- src/FHE.cpp