suitedev
07/31/2024, 1:52 AMN/pgp
reaches to heavens… YES!!suitedev
07/31/2024, 1:57 AMpgp.createMessageData(options)
method.
Next, use the MessageData.encrypt(options)
method to securely encrypt and optionally sign the message contents.
Message recipients can optionally enable configuration preferences to customize how messages are decrypted.
You can also use this module to create certificate.Signer objects to sign plain strings.
For more information, see the help topic N/pgp Module. (not yet available)suitedev
07/31/2024, 2:53 PMN/pgp
!!suitedev
07/31/2024, 2:55 PM/**
* Use a Cryptographic Key for a Signature
* @NApiVersion 2.1
*/
require(['N/pgp', 'N/crypto/certificate', 'N/encode'], (pgp, cryptoCertificate, encode) => {
const keys = {
ours: {
pub: pgp.loadKeyFromSecret({
secret: { scriptId: 'custsecret_pgp_key_ours_public' }
}),
pri: pgp.loadKeyFromSecret({
secret: { scriptId: 'custsecret_pgp_key_ours_private' },
password: { scriptId: 'custsecret_pgp_key_ours_private_password' }
})
}
}
const signer = pgp.createSigner({
key: keys.ours.pri,
algorithm: cryptoCertificate.HashAlg.SHA256
})
signer.update({
input: 'Test'
})
const signature = signer.sign({
outputEncoding: encode.Encoding.BASE_64_URL_SAFE
})
log.debug(signature)
})
Emanuel V
08/20/2024, 1:30 AMTimothy Wong
11/08/2024, 7:44 AM