Example #1
0
        // Private helper function
        private static byte[] ComputeChallenge(IssuerParameters ip, GroupElement h0, GroupElement CGamma,
                                               GroupElement Ch0, GroupElement[] C, GroupElement tildeD, GroupElement tildeCgamma, GroupElement tildeT,
                                               GroupElement[] tildeC, byte[] message)
        {
            HashFunction H = ip.HashFunction;

            H.Hash(ip.Digest(false));
            H.Hash(h0);
            H.Hash(CGamma);
            H.Hash(Ch0);
            H.Hash(C);
            H.Hash(tildeD);
            H.Hash(tildeCgamma);
            H.Hash(tildeT);
            H.Hash(tildeC);
            H.Hash(message);

            byte[] digest = H.Digest;

#if DEBUG
            Debug.WriteLine("h0 = " + BitConverter.ToString(h0.GetEncoded()));
            Debug.WriteLine("CGamma = " + BitConverter.ToString(CGamma.GetEncoded()));
            Debug.WriteLine("Ch0 = " + BitConverter.ToString(Ch0.GetEncoded()));
            if (tildeC != null)
            {
                Debug.WriteLine("tildeC[0] = " + BitConverter.ToString(tildeC[0].GetEncoded()));
            }
            Debug.WriteLine("tildeD = " + BitConverter.ToString(tildeD.GetEncoded()));
            Debug.WriteLine("tildeT = " + BitConverter.ToString(tildeT.GetEncoded()));
            Debug.WriteLine("tildeCgamma = " + BitConverter.ToString(tildeCgamma.GetEncoded()));
            Debug.WriteLine("digest = " + BitConverter.ToString(digest));
#endif

            return(digest);
        }
 /// <summary>
 /// Convert a GroupElement to a base64 representation.
 /// </summary>
 /// <param name="groupElement">The value to convert.</param>
 /// <returns>The base64 representation.</returns>
 public static String ToBase64String(this GroupElement groupElement)
 {
     if (groupElement == null)
     {
         return(null);
     }
     return(Convert.ToBase64String(groupElement.GetEncoded()));
 }