iTraceiT - Documentation
General iTraceiT inquiries and more information: support@itraceit.io
Webservices test page: http://europe-ws.itraceit.io/itraceit_core?test
or
You can use Postman to test Webservices
Description in JSON: https://europe-ws.itraceit.io/itraceit_core?description
NOTE: Please scroll to the bottom of the page for instructions on how to use the API documentation.
Application key: Please contact the iTraceiT support team via support@itraceit.io to get the Application key
Public key (for decryption/encryption): kokopdDE*-_223TgEZ!++* (Use the hash value)
Credentials: Please contact the iTraceiT support team to get your credentials
Notes
Note: Only authorized domains/users can generate the key. You have to ask us to activate a new domain/user when you need it.
sData = Your serial key
bufCryptedResult (Buffer) = <string to decrypt>;
bufKeySHA3
(Buffer)
// 1 - Hash the password
bufKeySHA3
= HashString(HA_SHA3_256, iTraceiT_PublicKey)
// 2 - Decode the string to decrypt in BASE 64
bufCryptedResult = decode64 (bufCryptedResult) with NO CR;
// 3 - Decrypt
bufCryptedResult = Decrypt with algorithm <crypt AES 256> with following parameters :
bufKeySHA3, cryptCBC,cryptPaddingPKCS
<?php
function decryptMobileTokenData($mobileToken){
$public_key = "kokopdDE*-_223TgEZ!++*"; //fixed, given by email from iTraceIT
$encrypt_method = "AES-256-CBC";
$pub_key = hash('sha3-256', $public_key, true); //Hashing the key with SHA3-256
$iv_length = openssl_cipher_iv_length($encrypt_method);
$iv = openssl_random_pseudo_bytes($iv_length);
$output = openssl_decrypt(base64_decode($mobileToken), $encrypt_method, $pub_key, OPENSSL_PKCS1_PADDING, $iv); //decryption done by here
//Check the start of curly braces to identify correct response received
if(strpos($output,'{ ')){
//Then explode it by curly brace and get the second part of it if it is exit.
$ex_resp = explode('{ ', $output);
$output = $ex_resp[1] ?? $ex_resp[0];
}
//Concat the Start of curly brace to make proper json format array
$output = '{'.$output;
return $output; //Return the output
}
//The public_key is kokopdDE*-_223TgEZ!++*
//You have to hash this public key with sha3-256
//Hashed PUBLIC_KEY = e539e8ed062736dc9a66a9a8081e007f1cf1c5d31e5c1487b6a7378d8af72451
var publicKey = CryptoJS.enc.Hex.parse(PUBLIC_KEY);
var mobileToken = responce.mobiletoken;
enbuffer = CryptoJS.enc.Base64.parse(mobileToken);
var ivBuffer = enbuffer.clone(enbuffer);
var dataBuffer = enbuffer.clone(enbuffer);
ivBuffer.words = enbuffer.words.slice(0,4);
ivBuffer.sigBytes = 16;
dataBuffer.words = enbuffer.words.slice(4);
dataBuffer.sigBytes = enbuffer.sigBytes - 16;
dataBuffer = CryptoJS.enc.Base64.stringify(dataBuffer);
var responceData = CryptoJS.AES.decrypt(dataBuffer, publicKey, {'mode': CryptoJS.mode.CBC, 'iv': ivBuffer, 'padding': CryptoJS.pad.Pkcs7});
responceData = responceData.toString(CryptoJS.enc.Utf8);
responceData = JSON.parse(responceData);
More info about Authenticate request
Note: You need to encrypt all the POST requests before you call the relevant web service.
Sample PHP code for Encryption
<?php
/**
* Here I wrote a common function for encrypt the data so we can use it again
* $data_to_encrypt : json encoded string
*/
function encryptDataToSend($data_to_encrypt){
$encrypt_method = "AES-256-CBC";
$public_key = "kokopdDE*-_223TgEZ!++*"; //fixed, given by email from iTraceIT
$encrypted_pub_key = hash('sha3-256', $public_key,true); //Hashing the key with SHA3-256
$iv_length = openssl_cipher_iv_length($encrypt_method);
$iv = openssl_random_pseudo_bytes($iv_length);
$encrypted_data = openssl_encrypt($data_to_encrypt, $encrypt_method, $encrypted_pub_key, OPENSSL_PKCS1_PADDING, $iv); //Encrypt with AES-256-CBC
$encrypted_data_base64 = base64_encode($iv.$encrypted_data); //Encoding with base64 encode
return $encrypted_data_base64; //Return the output
}
Sample JavaScript code for Encryption
//Request data for Authentication function
var reqData = {
"applicationid":'APPLICATIN_ID',
"domainid":'YOUR_DOMAIN_ID',
"refresh_token": "REFRESH_TOKEN",
"userid":'YOUR_USER_ID'
};
reqData = JSON.stringify(reqData);
//Here we are using cryptojs library
//The public_key is kokopdDE*-_223TgEZ!++*
//You have to hash this public key with sha3-256
//Hashed PUBLIC_KEY = e539e8ed062736dc9a66a9a8081e007f1cf1c5d31e5c1487b6a7378d8af72451
var hashKey = CryptoJS.enc.Hex.parse(PUBLIC_KEY);
var iv = CryptoJS.lib.WordArray.random(16);
var encrypted = CryptoJS.AES.encrypt(reqData, hashKey, {'mode': CryptoJS.mode.CBC, 'iv': iv, 'padding': CryptoJS.pad.Pkcs7});
var merge = iv.concat(encrypted.ciphertext);
var encryptedString = CryptoJS.enc.Base64.stringify(merge);


More info about parcel requests

* For more information about all the web services, please click on “Broese → How to integrate iTraceiT API”. Then you will see all the web services under the categories.
End