Methods
# delete()
Delete the underlying WASM instance.
Should be called before dereferencing this object to prevent the
WASM heap from growing indefinitely.
# 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 |
Returns undefined if a CipherText was specified. Otherwise returns a
CipherText containing the encrypted result
CipherText
|
void
# encryptSerializable(plainText, poolopt) → {Serializable.<CipherText>}
Encrypts a PlainText and returns a CipherText as a Serializable object.
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 | ||
pool |
MemoryPoolHandle
|
<optional> |
MemoryPoolHandle.global | MemoryPool to use |
A Serializable containing the encrypted result
# 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 or BGV, 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 |
Returns undefined if a CipherText was specified. Otherwise returns a
CipherText containing the encrypted result
CipherText
|
void
# encryptSymmetricSerializable(plainText, poolopt) → {Serializable.<CipherText>}
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 or BGV, 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 |
Returns a Serializable containing the encrypted result
# encryptZero(cipherTextopt, poolopt) → {CipherText|void}
Encrypts a zero plaintext with the public key and returns the ciphertext
as a serializable object.
The encryption parameters for the resulting ciphertext correspond to the
highest (data) level in the modulus switching chain. Dynamic memory
allocations in the process are allocated from the memory pool pointed to
by the given MemoryPoolHandle.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
cipherText |
CipherText
|
<optional> |
A CipherText to overwrite. | |
pool |
MemoryPoolHandle
|
<optional> |
MemoryPoolHandle.global | MemoryPool to use |
Returns undefined if a CipherText was specified. Otherwise returns a
CipherText containing the encrypted result
CipherText
|
void
# encryptZeroSerializable(poolopt) → {Serializable.<CipherText>}
Encrypts a zero plaintext with the public key and stores the result in
destination.
The encryption parameters for the resulting ciphertext correspond to the
highest (data) level in the modulus switching chain. Dynamic memory
allocations in the process are allocated from the memory pool pointed to
by the given MemoryPoolHandle.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pool |
MemoryPoolHandle
|
<optional> |
MemoryPoolHandle.global | MemoryPool to use |
A CipherText as a serialized object containing the encrypted result