Members
number
# readonly coeffModulusSize
The number of primes in the coefficient modulus of the
associated encryption parameters. This directly affects the
allocation size of the CipherText.
boolean
# readonly isTransparent
Whether the current CipherText is transparent, i.e. does not require
a secret key to decrypt. In typical security models such transparent
CipherTexts would not be considered to be valid. Starting from the second
polynomial in the current CipherText, this function returns true if all
following coefficients are identically zero. Otherwise, returns false.
ParmsIdType
# readonly parmsId
The reference to parmsId.
- See:
-
- EncryptionParameters for more information about parmsId.
number
# readonly polyModulusDegree
The degree of the polynomial modulus of the associated
encryption parameters. This directly affects the allocation size
of the CipherText.
number
# readonly scale
The reference to the scale. This is only needed when using the
CKKS encryption scheme. The user should have little or no reason to ever
change the scale by hand.
number
# readonly sizeCapacity
The capacity of the allocation. This means the largest size
of the CipherText that can be stored in the current allocation with
the current encryption parameters.
Methods
# clone() → {CipherText}
Clone and return a new instance of this CipherText
Example
const cipherTextA = seal.CipherText()
// ... after encoding some data ...
const cipherTextB = cipherTextA.clone()
// cipherTextB holds a copy of cipherTextA
# copy(cipher)
Copy an existing CipherText and overwrite this instance
Parameters:
Name | Type | Description |
---|---|---|
cipher |
CipherText
|
CipherText to copy |
Example
const cipherTextA = seal.CipherText()
// ... after encoding some data ...
const cipherTextB = seal.CipherText()
cipherTextB.copy(cipherTextA)
// cipherTextB holds a copy of cipherTextA
# delete()
Delete the underlying WASM instance.
Should be called before dereferencing this object to prevent the
WASM heap from growing indefinitely.
# load(context, encoded)
Load a CipherText from a base64 string
Parameters:
Name | Type | Description |
---|---|---|
context |
Context
|
Encryption context to enforce |
encoded |
string
|
Base64 encoded string |
# loadArray(context, array)
Load a CipherText from an Uint8Array holding binary data
Parameters:
Name | Type | Description |
---|---|---|
context |
Context
|
Encryption context to enforce |
array |
Uint8Array
|
TypedArray containing binary data |
# move(cipher)
Move a CipherText into this one and delete the old reference
Parameters:
Name | Type | Description |
---|---|---|
cipher |
CipherText
|
CipherText to move |
Example
const cipherTextA = seal.CipherText()
// ... after encoding some data ...
const cipherTextB = seal.CipherText()
cipherTextB.move(cipherTextA)
// cipherTextB holds a the instance of cipherTextA.
// cipherTextA no longer holds an instance
# release()
Resets the CipherText. This function releases any memory allocated
by the CipherText, returning it to the memory pool. It also sets all
encryption parameter specific size information to zero.
# reserve(context, capacity)
Allocates enough memory to accommodate the backing array of a ciphertext
with given capacity. In addition to the capacity, the allocation size is
determined by the current encryption parameters.
Parameters:
Name | Type | Description |
---|---|---|
context |
Context
|
The SEAL Context |
capacity |
number
|
The capacity to reserve |
# resize(size)
Resizes the CipherText to given size, reallocating if the capacity
of the CipherText is too small.
This function is mainly intended for internal use and is called
automatically by functions such as Evaluator.multiply and
Evaluator.relinearize. A normal user should never have a reason
to manually resize a CipherText.
Parameters:
Name | Type | Description |
---|---|---|
size |
number
|
The new size |
# save(compressionopt) → {string}
Save the CipherText to a base64 string
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
compression |
ComprModeType
|
<optional> |
ComprModeType.zstd | The compression mode to use |
Base64 encoded string
string
# saveArray(compressionopt) → {Uint8Array}
Save the CipherText as a binary Uint8Array
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
compression |
ComprModeType
|
<optional> |
ComprModeType.zstd | The compression mode to use |
A byte array containing the CipherText in binary form
Uint8Array
# setScale(scale)
Sets the CipherText scale. This is only needed when using the
CKKS encryption scheme. The user should have little or no reason to ever
change the scale by hand.
Parameters:
Name | Type | Description |
---|---|---|
scale |
number
|
The scale to set |