/// <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."); } } }