Security v1 (deprecated)

Api calls expects 3 parameters:

  • k as your client key
  • t as the timestamp
  • s as the generated hash
All the calls must end with that keys:
&k={YOUR_CLIENT_KEY}&s={HASH}&t={TIMESTAMP}
k, s, t will be valid for 15 minutes.

k

FXstreet will provide client's public key.

t

The current datetime in utc as "yyyyMMddHHmm". For example, 2012-02-15 17:14:33 should be formated ad 201202151714

s

FXstreet will provide client's private key (YOUR_CLIENT_PRIVATE_KEY). s will is a SHA1 hash string generated using that private key concatenated with t.

C# Sample:

  
                  
    public string GenerateHash(System.DateTime dt, string input)
    {
        var hasher = System.Security.Cryptography.SHA1.Create();
        string res = string.Empty;
        byte[] data = hasher.ComputeHash(System.Text.Encoding.ASCII.GetBytes(string.Concat(input, dt.ToString("yyyyMMddHHmm"))));
        foreach (byte b in data)
        {
            res += string.Format("{0:x2}", b);
        }
        return res;
    }
    

Bash Sample:

                
    #!/bin/bash
    t=`date --utc +%Y%m%d%H%M`
    puk=YOUR_CLIENT_KEY
    prk=YOUR_CLIENT_PRIVATE_KEY
    s=`echo -n ${prk}${t} | openssl dgst -sha1 | awk '{print $2}'`
    
    echo "XML day request:"
    echo "  public key: "${puk}
    echo "  private key: "${prk}
    echo "  timestamp: "${t}
    echo "  sha1(private key + timestamp): "${s}
    echo ""
    echo
    "http://calendar.fxstreet.com/eventdate/?view=day&f=xml&k=${puk}&s=${s}&t=${t}"
            

Doing TDD?

  • YOUR_CLIENT_PRIVATE_KEY = "4504D22E7FEC4B0EA3549117C8EDEB"
    DateTime = (1975, 1, 1, 0, 0, 0) // yyyy, MM, dd, HH, mm, ss
    expectedhash = "fad07c53ec84a894d1f4ca0390edc4c2c3100e17" // HASH -> (clientkey concat DateTime.ToString(yyyyMMddHHmm))
  • YOUR_CLIENT_PRIVATE_KEY = "06DA43DD91584F82BF2EB9D7F5BAD7"
    DateTime = (2002, 2, 2, 4, 5, 10) // yyyy, MM, dd, HH, mm, ss
    expectedhash = "0b6bbf5f16f0d4e4520625d418ac46c44f42f278" // HASH -> (clientkey concat DateTime.ToString(yyyyMMddHHmm))
  • YOUR_CLIENT_PRIVATE_KEY = "3E4E462F117A4C1D90D4386D6004B6"
    DateTime = (2015, 12, 5, 20, 17, 30) // yyyy, MM, dd, HH, mm, ss
    expectedhash = "ac896095c275e85e223a2b9df5d3324e354f05fe" // HASH -> (clientkey concat DateTime.ToString(yyyyMMddHHmm))
  • YOUR_CLIENT_PRIVATE_KEY = "06DA43DD91584F82BF2EB9D7F5BAD7"
    DateTime = (2002, 2, 2, 4, 5, 10) // yyyy, MM, dd, HH, mm, ss
    expectedhash = "0b6bbf5f16f0d4e4520625d418ac46c44f42f278" // HASH -> (clientkey concat dt.ToString(yyyyMMddHHmm))