internal void OnSerializing(StreamingContext context) { _uidp = this.UidP.ToBase64String(); _group = new GroupSerializable(this.Gq); _uidh = this.UidH; _e = this.E.ToBase64String(); _s = this.S.ToBase64String(); if (ParameterSet.ContainsParameterSet(this.group.GroupName) && (this.UsesRecommendedParameters == true)) { this._g = new string[] { this.G[0].ToBase64String() }; } else { this._g = this.G.ToBase64StringArray(); this._gd = (this.Gd == null) ? null : this.Gd.ToBase64String(); } }
/// <summary> /// Generates a fresh Issuer key and parameters. /// </summary> /// <param name="supportDevice">If true, the parameters will support issuing Device-protected tokens. Defaults to <code>false</code>.</param> /// <returns>A Issuer key and parameters instance.</returns> public IssuerKeyAndParameters Generate(bool supportDevice = false) { // first validate the data we have Validate(); GroupElement[] gValues = null; if (ip.Gq == null) { if (this.ParameterSet != null) { ip.Gq = this.ParameterSet.Group; gValues = this.ParameterSet.G; if (supportDevice) { ip.Gd = this.ParameterSet.Gd; } // is that a known parameter set? ip.UsesRecommendedParameters = ParameterSet.ContainsParameterSet(this.ParameterSet.Name); } else { ParameterSet defaultParamSet = IssuerSetupParameters.GetDefaultParameterSet(this.GroupConstruction); ip.Gq = defaultParamSet.Group; if (UseRecommendedParameterSet) { gValues = defaultParamSet.G; // recommended groups always support devices ip.Gd = defaultParamSet.Gd; ip.UsesRecommendedParameters = true; } } } FieldZqElement y0 = ProtocolHelper.GenerateIssuerParametersCryptoData(ip, gValues, supportDevice); return(new IssuerKeyAndParameters(y0, ip)); }