MessageData.encrypt(options)
The content in this help topic pertains to SuiteScript 2.1.
Method Description |
Creates an encrypted message that is optionally signed. |
Returns |
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Parent Object |
|
Sibling Object Members |
|
Since |
2022.2 |
Parameters
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
Required |
One or more keys used to encrypt a message. If a key contains multiple valid encryption (sub)keys, the most recent key added will be used. |
2022.2 |
|
|
optional |
Zero or more keys used for signing. If a key contains multiple valid signing (sub)keys, the most recent key added will be used. Default value = |
2022.2 |
|
|
optional |
The compression algorithm to use. Default value = |
2022.2 |
Errors
Error Code |
Thrown If |
---|---|
PGP_NO_ENCRYPTION_KEY_FOUND_IN_KEY_PARAM_1 |
No valid encryption (sub)key was found in one of the provided keys. |
PGP_NO_SIGNING_KEY_FOUND_IN_KEY_PARAM_1 |
No valid signing (sub)key was found in one of the provided keys. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/pgp Module Script Samples.
// Add additional code
...
const data = pgp.createMessageData({
content: "Hello, world!"
});
const message = data.encrypt({
encryptionKeys: keys.alice.pub,
signingKeys: keys.ours.pri,
});
...
// Add additional code