Want to get rid of Google Ads, click here.
+ Reply to Thread
Results 1 to 5 of 5

Thread: Encrypted URL using JavaScript

  1. #1
    Senior Member
    Join Date
    Apr 2007
    Posts
    160

    Default Encrypted URL using JavaScript

    Hi all,

    I need to pass a url to us.launch.external but I would like the url to be encrypted to avoid the username from being shown.

    My thinking was to pass a portion (after the http://www.) of the url to a JS function to encrypt and pass back, then I'll just concatenate and pass to the RAD.

    Can anyone share anything on this and let me know the best way to look in to implementing this.

    Thanks in advance.

  2. #2

    Default

    I m looking for some ting like this to encrypt a part of one URL sending with a notification, i have found this on SM7 help.

    base64Encode
    Description
    This method converts binary data to a base 64 string format. You can also use this method to encode plain text data in base 64 format.
    Example
    This example does the following:
    · Reads the contents of a binary file
    · Converts the file to a base 64 string format
    · Prints the base 64 string
    This example requires the following sample data:
    · A binary file on the local file system (for example, an image file)

    var source = ("https://localhots... ");
    var encode = base64Encode( source );
    print( "The value of encode is:\n" + encode );


    You can search this expression on sm7 help for morz informatiosn:

    JavaScript global methods
    Last edited by mostafa.errahmani; 2010-01-06 at 01:21.

  3. #3
    Senior Member
    Join Date
    Sep 2008
    Posts
    115

    Default

    I had a similar requirement, but needed a PHP library to decode it as well. I ended up using the following http://farhadi.ir/works/rc4 for it and it works well.

  4. #4

    Default

    Think you leonv,


    I want to add; you have to encrypt only what after the URL for example:

    For the URL https:\\sm7\incidents\id=SD00001

    You have to encrypt only “SD00001” or “incidents\id=SD00001”

    Because instruction must be arrive to the apache or tomcat webtier.

  5. #5
    Senior Member
    Join Date
    Apr 2007
    Posts
    160

    Default

    I ended up writing two functions, one to encrypt and one to decrypt. It's a simple one using chracter code mapping, but it was all I needed. I needed just the operator id to be encrypted and concatenated t the end of the url, so I just calle this function and passed over the Operator() function.

    function getEncryptedString(sWord)
    {
    var sToEncrypt = sWord;
    var sXorKey= sToEncrypt.length;
    var sResult="";//the result will be here

    for(i=0;i<sToEncrypt.length;++i)
    {
    sResult+=String.fromCharCode(sXorKey^sToEncrypt.ch arCodeAt(i));
    }
    return sResult;
    }

    function getDecryptedString(sWord)
    {
    var sToDecrypt = sWord;
    var sXorKey = sToDecrypt.length;

    var sResult="";//the result will be here
    for(i=0;i<sToDecrypt.length;i++)
    {
    sResult+=String.fromCharCode(sXorKey^sToDecrypt.ch arCodeAt(i));
    }
    //print("Decrypted string is " + sToDecrypt);
    return sResult;
    }

    Hope this helps someoe.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts