コード例 #1
0
        /// <summary>
        /// Finishes deserializing once json deserialization is complete.
        /// </summary>
        /// <param name="group">May be null. Used only if group was not serialized.</param>
        /// <param name="bases">May be null.  Used only if group was not serialized.</param>
        public void FinishDeserializing(Group group, GroupElement[] bases)
        {
            // get group
            if (this.Group == null)
            {
                if (group == null)
                {
                    throw new SerializationException("Cannot deserialize because serialized group and group argument are both null.");
                }
                this.Group = group;
            }

            // get value
            this.Value = CryptoSerializer.DeserializeGroupElement(_value, this.Group);

            // get bases
            if (this._bases == null)
            {
                if (bases == null)
                {
                    throw new SerializationException("Cannot deserialize because serialized bases and bases argument are both null.");
                }
                if (bases.Length == this._representationLength)
                {
                    this.Bases = bases;
                }
                else
                {
                    this.Bases = new GroupElement[this._representationLength];
                    for (int i = 0; i < this.Bases.Length; ++i)
                    {
                        this.Bases[i] = bases[i];
                    }
                }
            }
            else
            {
                this.Bases = CryptoSerializer.DeserializeGroupElementArray(this._bases, "bases", this.Group);
            }

            // get exponents
            if (this._exponents == null)
            {
                this.Exponents = null;
            }
            else
            {
                this.Exponents = CryptoSerializer.DeserializeFieldZqElementArray(this._exponents, "Exponents", this.Group);
                if (this.Exponents.Length != this.Bases.Length)
                {
                    throw new SerializationException("Cannot Deserialize. Must have equal number of exponents and bases.");
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Deserialize a,c,r.
        /// </summary>
        public override void FinishDeserializing()
        {
            a = CryptoSerializer.DeserializeGroupElementArray(_a, "a", this.Group);
            c = CryptoSerializer.DeserializeFieldZqElementArray(_c, "c", this.Group);
            r = CryptoSerializer.DeserializeFieldZqElementArray(_r, "r", this.Group);

            if (a.Length - 1 != c.Length || a.Length != r.Length)
            {
                throw new SerializationException("Arrays a, and r must have the same length, while c must be one element shorter.");
            }

            if (this.UPIProof != null)
            {
                this.UPIProof.FinishDeserializing(this.Group);
            }
        }
コード例 #3
0
 public void VSMDeserialized(StreamingContext context)
 {
     MemberSet = CryptoSerializer.DeserializeFieldZqElementArray(_memberSet, "MemberSet", this.Group);
 }
コード例 #4
0
 /// <summary>
 /// Deserialize b, responseEqual, responseUnequal
 /// </summary>
 public override void FinishDeserializing()
 {
     this.b               = CryptoSerializer.DeserializeGroupElementArray(this._b, "b", this.Group);
     this.responseEqual   = CryptoSerializer.DeserializeFieldZqElementArray(this._responseEqual, "responseEqual", this.Group);
     this.responseUnequal = CryptoSerializer.DeserializeFieldZqElementArray(this._responseUnequal, "responseUnequal", this.Group);
 }