public IssuerKeyAndParameters CreateIssuerSetupParameters(IssuerSetupParametersSpec spec)
        {
            IssuerSetupParameters isp = new IssuerSetupParameters();

            isp.GroupConstruction = spec.GroupConstruction ?? GroupType.Subgroup;
            isp.UidP = ExtensionMethods.ToByteArray(spec.IssuerID);
            isp.E    = spec.AttributeEncoding != null ? spec.AttributeEncoding : IssuerSetupParameters.GetDefaultEValues(spec.NumberOfAttributes);
            isp.UseRecommendedParameterSet = spec.UseRecommendedParameterSet ?? true;

            if (issuerStore.HasValue(spec.IssuerID) && spec.StoreOnServer)
            {
                ApiArgumentFault fault = new ApiArgumentFault();
                fault.Details       = "Issuer with unique ID was found";
                fault.Argument      = "IssuerSetupParametersSpec.ID";
                fault.ArgumentValue = spec.ParameterSetName;
                throw new FaultException <ApiArgumentFault>(fault);
            }

            // look up ParameterSet.
            if (isp.UseRecommendedParameterSet)
            {
                isp.ParameterSet = IssuerSetupParameters.GetDefaultParameterSet(isp.GroupConstruction);
                // XXX add a check here to see if the name of the default parameterset is that same as
                // specified in spec.ParameterSetName and that match with the sha method specified.
            }
            else
            {
                ParameterSet pSet;
                if (ParameterSet.TryGetNamedParameterSet(spec.ParameterSetName, out pSet))
                {
                    isp.ParameterSet = pSet;
                }
                else
                {
                    ApiArgumentFault fault = new ApiArgumentFault();
                    fault.Details       = "Member value vas not found";
                    fault.Argument      = "IssuerSetupParametersSpec.ParameterSetName";
                    fault.ArgumentValue = spec.ParameterSetName;
                    throw new FaultException <ApiArgumentFault>(fault);
                }
            }

            // specification field unused in ABC4Trust
            isp.S = null;

            IssuerKeyAndParameters issuerKeyParam = isp.Generate(true);

            if (spec.StoreOnServer)
            {
                issuerStore.AddValue(spec.IssuerID, issuerKeyParam);
            }
            return(issuerKeyParam);
        }
    public IssuerKeyAndParameters CreateIssuerSetupParameters(IssuerSetupParametersSpec spec)
    {
      IssuerSetupParameters isp = new IssuerSetupParameters();
      isp.GroupConstruction = spec.GroupConstruction ?? GroupType.Subgroup;
      isp.UidP = ExtensionMethods.ToByteArray(spec.IssuerID);
      isp.E = spec.AttributeEncoding != null ? spec.AttributeEncoding : IssuerSetupParameters.GetDefaultEValues(spec.NumberOfAttributes);
      isp.UseRecommendedParameterSet = spec.UseRecommendedParameterSet ?? true;

      if (issuerStore.HasValue(spec.IssuerID) && spec.StoreOnServer)
      {
        ApiArgumentFault fault = new ApiArgumentFault();
        fault.Details = "Issuer with unique ID was found";
        fault.Argument = "IssuerSetupParametersSpec.ID";
        fault.ArgumentValue = spec.ParameterSetName;
        throw new FaultException<ApiArgumentFault>(fault);
      }

      // look up ParameterSet.
      if (isp.UseRecommendedParameterSet)
      {
        isp.ParameterSet = IssuerSetupParameters.GetDefaultParameterSet(isp.GroupConstruction);
        // XXX add a check here to see if the name of the default parameterset is that same as
        // specified in spec.ParameterSetName and that match with the sha method specified.
      }
      else
      {
        ParameterSet pSet;
        if (ParameterSet.TryGetNamedParameterSet(spec.ParameterSetName, out pSet))
        {
          isp.ParameterSet = pSet;
        }
        else
        {
          ApiArgumentFault fault = new ApiArgumentFault();
          fault.Details = "Member value vas not found";
          fault.Argument = "IssuerSetupParametersSpec.ParameterSetName";
          fault.ArgumentValue = spec.ParameterSetName;
          throw new FaultException<ApiArgumentFault>(fault);
        }
      }

      // specification field unused in ABC4Trust
      isp.S = null;

      IssuerKeyAndParameters issuerKeyParam = isp.Generate(true);
      if (spec.StoreOnServer) { 
        issuerStore.AddValue(spec.IssuerID, issuerKeyParam);
      }
      return issuerKeyParam;
    }