Exemple #1
0
        public static string ExtractUrl(string hashAndMessage, bool legacyFormat)
        {
            DateTime dateTime;

            byte[] message;
            CryptoMessage.ParseMessage(hashAndMessage, null, true, out dateTime, out message);
            return(CryptoMessage.DecodeToString(message, legacyFormat));
        }
Exemple #2
0
        public static bool ParseMessage(string hashAndMessage, byte[] hiddenMessageBinary, bool ignoreHmac, out DateTime timeStamp, out byte[] message)
        {
            timeStamp = DateTime.MinValue;
            bool flag = false;

            message = null;
            try
            {
                byte[] array = CryptoMessage.Decode(hashAndMessage ?? string.Empty);
                byte[] array2;
                flag = CryptoMessage.ParseMessage(array, hiddenMessageBinary, out array2);
                if (flag || ignoreHmac)
                {
                    long ticks = BitConverter.ToInt64(array2, 0);
                    timeStamp = new DateTime(ticks, DateTimeKind.Utc);
                    int num = array2.Length - 8;
                    message = new byte[num];
                    Array.Copy(array2, 8, message, 0, num);
                }
                else
                {
                    ExTraceGlobals.CryptoTracer.TraceDebug(2L, "{0}.{1}: failed: messageString={2}, hiddenMessage={3}", new object[]
                    {
                        "Clients.Common.CryptoMessage",
                        "ParseMessage",
                        hashAndMessage,
                        CryptoMessage.GetHexString(hiddenMessageBinary)
                    });
                }
            }
            catch (Exception ex)
            {
                flag = false;
                ExTraceGlobals.CryptoTracer.TraceDebug(3L, "{0}.{1}: Exception: messageString={2}, hiddenMessage={3}, exception={3}", new object[]
                {
                    "Clients.Common.CryptoMessage",
                    "ParseMessage",
                    hashAndMessage,
                    CryptoMessage.GetHexString(hiddenMessageBinary),
                    ex
                });
            }
            return(flag);
        }
Exemple #3
0
 public static bool ParseMessage(string hashAndMessage, byte[] hiddenMessageBinary, out DateTime timeStamp, out byte[] message)
 {
     return(CryptoMessage.ParseMessage(hashAndMessage, hiddenMessageBinary, false, out timeStamp, out message));
 }