Skip to content

Instantly share code, notes, and snippets.

@nestoru
Created December 21, 2016 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nestoru/6e6be51f2f87c335bc3dc30e96faeb20 to your computer and use it in GitHub Desktop.
Save nestoru/6e6be51f2f87c335bc3dc30e96faeb20 to your computer and use it in GitHub Desktop.
Netsuite tokenPassport Generator
#!/bin/bash -e
# netsuiteTokenPassportGenerator.sh
# @author: Nestor Urquiza
# @date: 20121221
account=******
consumerKey=********
token=*********
nonce=`cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 1`
timestamp=`date +%s`
base="$account&$consumerKey&$token&$nonce&$timestamp"
consumerSecret=************
tokenSecret=**********
key="$consumerSecret&$tokenSecret"
algorithm=HMAC-SHA256
signature=`echo -en "$base" | openssl dgst -sha256 -hmac "$key" -binary | openssl enc -base64`
echo " <platformMsgs:tokenPassport>"
echo " <platformMsgs:account>$account</platformMsgs:account>"
echo " <platformMsgs:consumerKey>$consumerKey</platformMsgs:consumerKey>"
echo " <platformMsgs:token>$token</platformMsgs:token>"
echo " <platformMsgs:nonce>$nonce</platformMsgs:nonce>"
echo " <platformMsgs:timestamp>$timestamp</platformMsgs:timestamp>"
echo " <platformMsgs:signature algorithm=\"$algorithm\">$signature</platformMsgs:signature>"
echo " </platformMsgs:tokenPassport>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment