Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions ApiUtilLib/ApiAuthorization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,23 +220,21 @@ public static long NewTimestamp()
return dto.ToUnixTimeMilliseconds();
}

public static long NewNonce()
public static string NewNonce()
{
long nonce = 0;
byte[] data = null;
using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
{
// Buffer storage.
byte[] data = new byte[8];
data = new byte[8];

// Fill buffer.
rng.GetBytes(data);

// Convert to int 64.
nonce = BitConverter.ToInt64(data, 0);
}

Logger.LogEnterExit(LoggerBase.Args(nonce.ToString()));
return nonce;
return System.Convert.ToBase64String(data);
}

public static String Token(
Expand Down
15 changes: 13 additions & 2 deletions ApiUtilLib/ApiList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,22 @@ public string ToString(string delimiter = "&", bool sort = true, bool quote = fa
if (sort)
{
// sort by key, than by value
var sortedList = this.OrderBy(k => k.Key).ThenBy(v => v.Value);
var sortedList = this.OrderBy(k => k.Key,StringComparer.Ordinal).ThenBy(v => v.Value,StringComparer.Ordinal); //Fixed issue to sort by capital letter.


foreach (var item in sortedList)
{
list.Add(string.Format(format, item.Key, item.Value));
format = "{0}={1}";
if (quote) format = "{0}=\"{1}\"";

if (item.Value == null && !quote)
{
list.Add(string.Format("{0}", item.Key, item.Value));
}
else
{
list.Add(string.Format(format, item.Key, item.Value));
}
}
}
else
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
## Added
### V1.0-SNAPSHOT
+ 2017-10-29 - Initial release.
### V1.1-SNAPSHOT
+ 2018-09-10 - Bug fixes to return basestring nonce value as basestring64 from integer value.
### V1.2-SNAPSHOT
+ 2018-09-13 - Bug fixes to sort list by ordinal comparison.