Interface

CipherText

CipherText

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.

View Source cipher-text.ts, line 131

boolean

# readonly isNttForm

Whether the CipherText is in NTT form.

View Source cipher-text.ts, line 191

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.

View Source cipher-text.ts, line 177

ParmsIdType

# readonly parmsId

The reference to parmsId.
See:

View Source cipher-text.ts, line 201

number

# readonly polyModulusDegree

The degree of the polynomial modulus of the associated encryption parameters. This directly affects the allocation size of the CipherText.

View Source cipher-text.ts, line 143

MemoryPoolHandle

# readonly pool

The currently used MemoryPoolHandle.

View Source cipher-text.ts, line 238

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.

View Source cipher-text.ts, line 214

number

# readonly size

The size of the CipherText.

View Source cipher-text.ts, line 155

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.

View Source cipher-text.ts, line 165

Methods

# clone() → {CipherText}

Clone and return a new instance of this CipherText

View Source cipher-text.ts, line 329

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

View Source cipher-text.ts, line 308

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.

View Source cipher-text.ts, line 67

# 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

View Source cipher-text.ts, line 276

# 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

View Source cipher-text.ts, line 292

# move(cipher)

Move a CipherText into this one and delete the old reference
Parameters:
Name Type Description
cipher CipherText CipherText to move

View Source cipher-text.ts, line 358

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.

View Source cipher-text.ts, line 120

# 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

View Source cipher-text.ts, line 81

# 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

View Source cipher-text.ts, line 99

# 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

View Source cipher-text.ts, line 248

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

View Source cipher-text.ts, line 259

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

View Source cipher-text.ts, line 226