This topic contains 1 reply, has 0 voices, and was last updated by chanarbon 7 years, 8 months ago.

  • Author
    Posts
  • #1319

    tukutela_mw

    Hi all,

    Never had the opportunity to use N/crypto, but not finding it useful for anything other than ‘UNEXPECTED_ERROR’s……

    Code:
    require([‘N/crypto’, ‘N/encode’], function(crypto, encode) {

    var skey = crypto.createSecretKey({
    encoding: encode.Encoding.HEX,
    guid: ‘264CFB2D225B2D76FB94D150207E49DF’
    });

    var cipher = crypto.createCipher({algorithm: crypto.EncryptionAlg.AES, key: skey, padding: crypto.Padding.NoPadding});

    cipher.update({input: ‘password’, inputEncoding: encode.Encoding.UTF_8 });
    var cipherPayload = cipher.final({
    outputEncoding: encode.Encoding.UTF_8
    });

    })
    Tried all sorts of combinations with encoding, no joy! Anybody got any working code?
    This is a cached copy. Click here to see the original post.

  • #1320

    chanarbon

    One thing, is that GUID that you are using provisioned for the script where you are trying to run it. GUIDs can only be used on scripts to where they are generated for with restrictToScriptIds param of addCredentialField()

You must be logged in to reply to this topic.