Template Class CiphertextImpl
Defined in File ciphertext.h
Inheritance Relationships
Base Type
public lbcrypto::CryptoObject< Element >(Template Class CryptoObject)
Template Parameter Order
class Element
Class Documentation
-
template<class Element>
class lbcrypto::CiphertextImpl : public lbcrypto::CryptoObject<Element> Inheritence diagram for lbcrypto::CiphertextImpl:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"2" [label="lbcrypto::CryptoObject< Element >" tooltip="lbcrypto::CryptoObject< Element >"]
"1" [label="lbcrypto::CiphertextImpl< Element >" tooltip="lbcrypto::CiphertextImpl< Element >" fillcolor="#BFBFBF"]
"1" -> "2" [dir=forward tooltip="public-inheritance"]
}](../_images/graphviz-81983e0608a67b8d2bbda3ed19540a48ffb3e9e0.png)
Collaboration diagram for lbcrypto::CiphertextImpl:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"2" [label="lbcrypto::CryptoObject< Element >" tooltip="lbcrypto::CryptoObject< Element >"]
"1" [label="lbcrypto::CiphertextImpl< Element >" tooltip="lbcrypto::CiphertextImpl< Element >" fillcolor="#BFBFBF"]
"1" -> "2" [dir=forward tooltip="public-inheritance"]
}](../_images/graphviz-81983e0608a67b8d2bbda3ed19540a48ffb3e9e0.png)
The CiphertextImpl object is used to contain encrypted text in the OpenFHE library
- Template Parameters
Element – a ring element.
Public Functions
-
CiphertextImpl() = default
Default constructor
-
inline explicit CiphertextImpl(const CryptoContext<Element> &cc, const std::string &id = "", PlaintextEncodings encType = INVALID_ENCODING)
Construct a new ciphertext in the given context
- Parameters
cc –
Construct a new ciphertext from the parameters of a given public key
- Parameters
k – key whose CryptoObject parameters will get cloned
-
CiphertextImpl(const CiphertextImpl<Element> &ct) = default
Copy constructor
-
inline explicit CiphertextImpl(const Ciphertext<Element> &ct)
-
CiphertextImpl(CiphertextImpl<Element> &&ct) noexcept = default
Move constructor
-
inline explicit CiphertextImpl(Ciphertext<Element> &&ct) noexcept
-
virtual ~CiphertextImpl() = default
Destructor
-
CiphertextImpl<Element> &operator=(const CiphertextImpl<Element> &rhs) = default
Assignment Operator.
- Parameters
&rhs – the CiphertextImpl to assign from
- Returns
this CiphertextImpl
-
CiphertextImpl<Element> &operator=(CiphertextImpl<Element> &&rhs) noexcept = default
Move Assignment Operator.
- Parameters
&rhs – the CiphertextImpl to move from
- Returns
this CiphertextImpl
-
inline const Element &GetElement() const
GetElement - get the ring element for the cases that use only one element in the vector this method will throw an exception if it’s ever called in cases with other than 1 element
- Returns
the first (and only!) ring element
-
inline Element &GetElement()
GetElement - get the ring element for the cases that use only one element in the vector this method will throw an exception if it’s ever called in cases with other than 1 element
- Returns
the first (and only!) ring element
-
inline const std::vector<Element> &GetElements() const
GetElements: get all of the ring elements in the CiphertextImpl
- Returns
vector of ring elements
-
inline std::vector<Element> &GetElements()
GetElements: get all of the ring elements in the CiphertextImpl
- Returns
vector of ring elements
-
inline size_t NumberCiphertextElements() const
-
inline void SetElement(const Element &element)
SetElement - sets the ring element for the cases that use only one element in the vector this method will throw an exception if it’s ever called in cases with other than 1 element
- Parameters
&element – is a polynomial ring element.
-
inline void SetElements(const std::vector<Element> &elements)
Sets the data elements.
- Parameters
&element – is a polynomial ring element.
-
inline void SetElements(std::vector<Element> &&elements) noexcept
Sets the data elements by std::move.
- Parameters
&&element – is a polynomial ring element.
-
inline size_t GetNoiseScaleDeg() const
Get the degree of the scaling factor for the encrypted message.
-
inline void SetNoiseScaleDeg(size_t noiseScaleDeg)
Set the degree of the scaling factor for the encrypted message.
-
inline size_t GetLevel() const
Get the number of scalings performed
-
inline void SetLevel(size_t level)
Set the number of scalings
-
inline size_t GetHopLevel() const
Get the re-encryption level of the ciphertext.
-
inline void SetHopLevel(size_t hoplevel)
Set the re-encryption level of the ciphertext.
-
inline double GetScalingFactor() const
Get the scaling factor of the ciphertext.
-
inline void SetScalingFactor(double sf)
Set the scaling factor of the ciphertext.
-
inline NativeInteger GetScalingFactorInt() const
Get the scaling factor of the ciphertext.
-
inline void SetScalingFactorInt(NativeInteger sf)
Set the scaling factor of the ciphertext.
-
inline uint32_t GetSlots() const
Get the number of slots of the ciphertext.
-
inline void SetSlots(uint32_t slots)
Set the number of slots of the ciphertext.
-
inline PlaintextEncodings GetEncodingType() const
GetEncodingType
- Returns
how the Plaintext that this CiphertextImpl was created from was encoded
-
inline void SetEncodingType(PlaintextEncodings et)
SetEncodingType - after Encrypt, remember the CiphertextImpl’s encoding type
- Parameters
et –
-
inline MetadataMap GetMetadataMap() const
Get the Metadata map of the ciphertext.
-
inline void SetMetadataMap(const MetadataMap &mdata)
Set the Metadata map of the ciphertext.
-
inline std::map<std::string, std::shared_ptr<Metadata>>::iterator FindMetadataByKey(std::string key) const
This method searches the metadata map for metadata of a specific key.
- Parameters
key – the string value which serves as a key in the metadata map
- Returns
an iterator pointing at the position in the map where the key was found (or the map.end() if not found).
This method checks whether an iterator return from FindMetadataByKey corresponds to whether the key was found or not.
- Parameters
it – iterator pointing at the position in the map where the key was found (or the map.end() if not found).
- Returns
a boolean value indicating whether the key was found or not.
This method returns the Metadata object stored in the iterator position returned by FindMetadataByKey.
- Parameters
it – iterator pointing at the position in the map where the key was found (or the map.end() if not found).
- Returns
a shared pointer pointing to the Metadata object in the map.
-
inline std::shared_ptr<Metadata> GetMetadataByKey(const std::string &key) const
Get a Metadata element from the Metadata map of the ciphertext.
-
inline virtual Ciphertext<Element> CloneEmpty() const
This method creates a copy of this, skipping the actual encrypted elements. This means it copies parameters, key tags, encoding type, and metadata.
-
inline virtual Ciphertext<Element> Clone() const
-
inline bool operator==(const CiphertextImpl<Element> &rhs) const
-
inline bool operator!=(const CiphertextImpl<Element> &rhs) const
-
inline std::string SerializedObjectName() const
-
void SetLevel(size_t level)
-
void SetLevel(size_t level)
Public Static Functions
-
static inline uint32_t SerializedVersion()
Friends
-
inline friend std::ostream &operator<<(std::ostream &out, const CiphertextImpl<Element> &c)
-
inline friend std::ostream &operator<<(std::ostream &out, Ciphertext<Element> c)