Interface

Encryptor

Encryptor

Methods

# delete()

Delete the underlying WASM instance. Should be called before dereferencing this object to prevent the WASM heap from growing indefinitely.

View Source encryptor.ts, line 49

# encrypt(plainText, cipherTextopt, poolopt) → {CipherText|void}

Encrypts a PlainText and stores the result in the destination parameter. Dynamic memory allocations in the process are allocated from the memory pool pointed to by the given MemoryPoolHandle.
Parameters:
Name Type Attributes Default Description
plainText PlainText PlainText to encrypt
cipherText CipherText <optional>
CipherText destination to store the encrypted result
pool MemoryPoolHandle <optional>
MemoryPoolHandle.global MemoryPool to use

View Source encryptor.ts, line 63

Returns undefined if a CipherText was specified. Otherwise returns a CipherText containing the encrypted result
CipherText | void

# encryptSymmetric(plainText, cipherTextopt, poolopt) → {CipherText|void}

Encrypts a PlainText with the secret key and stores the result in destination. The encryption parameters for the resulting CipherText correspond to: 1) in BFV, the highest (data) level in the modulus switching chain, 2) in CKKS, the encryption parameters of the plaintext. Dynamic memory allocations in the process are allocated from the memory pool pointed to by the given MemoryPoolHandle.
Parameters:
Name Type Attributes Default Description
plainText PlainText PlainText to encrypt
cipherText CipherText <optional>
CipherText destination to store the encrypted result.
pool MemoryPoolHandle <optional>
MemoryPoolHandle.global MemoryPool to use

View Source encryptor.ts, line 90

Returns undefined if a CipherText was specified. Otherwise returns a CipherText containing the encrypted result
CipherText | void

# encryptSymmetricSerializable(plainText, poolopt) → {Serializable}

Encrypts a plaintext with the secret key and returns the ciphertext as a serializable object. The encryption parameters for the resulting CipherText correspond to: 1) in BFV, the highest (data) level in the modulus switching chain, 2) in CKKS, the encryption parameters of the plaintext. Dynamic memory allocations in the process are allocated from the memory pool pointed to by the given MemoryPoolHandle. Half of the ciphertext data is pseudo-randomly generated from a seed to reduce the object size. The resulting serializable object cannot be used directly and is meant to be serialized for the size reduction to have an impact.
Parameters:
Name Type Attributes Default Description
plainText PlainText PlainText to encrypt
pool MemoryPoolHandle <optional>
MemoryPoolHandle.global MemoryPool to use

View Source encryptor.ts, line 123

Returns a Serializable containing the encrypted result
Serializable