Created
December 21, 2016 19:35
-
-
Save nestoru/6e6be51f2f87c335bc3dc30e96faeb20 to your computer and use it in GitHub Desktop.
Netsuite tokenPassport Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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