Esempio n. 1
0
        private static IssuerKeyAndParametersComposite UsePreComputeParameterSet(string uniqueIdentifier, byte[] attributeEncoding, string hash, string sessionID)
        {
            IssuerSetupParameters isp = new IssuerSetupParameters();

            // pick the group construction (defaults to subgroup, but ECC is more efficient)
            // TODOv2: Enable the UProve module to switch between ECC and subgroup based on ie. a config file.
            // isp.GroupConstruction = GroupConstruction.ECC;
            // right now, we need to use the subgroup construction to interop with Idemix
            isp.GroupConstruction             = GroupConstruction.Subgroup;
            isp.ParameterSet                  = sessionDB[sessionID].parameterSet;
            sessionDB[sessionID].group        = isp.ParameterSet.Group;
            sessionDB[sessionID].groupElement = isp.ParameterSet.Gd;

            isp.UidH = hash;

            // pick a unique identifier for the issuer params
            isp.UidP = encoding.GetBytes(uniqueIdentifier);

            // set the encoding parameters for the attributes
            isp.E = attributeEncoding;

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

            // generate the serializable IssuerKeyAndParameters
            IssuerKeyAndParameters          ikap = isp.Generate(true);
            IssuerKeyAndParametersComposite ikpc = new IssuerKeyAndParametersComposite();

            ikpc.IssuerParameters = ConvertUtils.convertIssuerParameters(ikap.IssuerParameters);
            ikpc.PrivateKey       = ikap.PrivateKey.ToByteArray();

            return(ikpc);
        }
Esempio n. 2
0
        private static IssuerKeyAndParametersComposite UseCustomParameterSet(string uniqueIdentifier, byte[] attributeEncoding, string hash, string sessionID)
        {
            IssuerSetupParameters isp = new IssuerSetupParameters();


            isp.GroupConstruction = GroupConstruction.Subgroup;
            // pick a unique identifier for the issuer params
            isp.UidP = encoding.GetBytes(uniqueIdentifier);

            // set the encoding parameters for the attributes
            isp.E = attributeEncoding;

            isp.UseRecommendedParameterSet = false; // we don't use the recommended parameters

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

            // generate the serializable IssuerKeyAndParameters
            IssuerKeyAndParameters ikap = isp.Generate(true);

            sessionDB[sessionID].group        = ikap.IssuerParameters.Gq;
            sessionDB[sessionID].groupElement = ikap.IssuerParameters.Gd;
            IssuerKeyAndParametersComposite ikpc = new IssuerKeyAndParametersComposite();

            ikpc.IssuerParameters = ConvertUtils.convertIssuerParameters(ikap.IssuerParameters);
            ikpc.PrivateKey       = ikap.PrivateKey.ToByteArray();

            return(ikpc);
        }
Esempio n. 3
0
    private static IssuerKeyAndParametersComposite UsePreComputeParameterSet(string uniqueIdentifier, byte[] attributeEncoding, string hash, string sessionID)
    {
      IssuerSetupParameters isp = new IssuerSetupParameters();

      // pick the group construction (defaults to subgroup, but ECC is more efficient)
      // TODOv2: Enable the UProve module to switch between ECC and subgroup based on ie. a config file.
      // isp.GroupConstruction = GroupConstruction.ECC;
      // right now, we need to use the subgroup construction to interop with Idemix
      isp.GroupConstruction = GroupConstruction.Subgroup;
      isp.ParameterSet = sessionDB[sessionID].parameterSet;
      sessionDB[sessionID].group = isp.ParameterSet.Group;
      sessionDB[sessionID].groupElement = isp.ParameterSet.Gd;

      isp.UidH = hash;

      // pick a unique identifier for the issuer params
      isp.UidP = encoding.GetBytes(uniqueIdentifier);

      // set the encoding parameters for the attributes
      isp.E = attributeEncoding;

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

      // generate the serializable IssuerKeyAndParameters		
      IssuerKeyAndParameters ikap = isp.Generate(true);
      IssuerKeyAndParametersComposite ikpc = new IssuerKeyAndParametersComposite();
      ikpc.IssuerParameters = ConvertUtils.convertIssuerParameters(ikap.IssuerParameters);
      ikpc.PrivateKey = ikap.PrivateKey.ToByteArray();

      return ikpc;
    }
Esempio n. 4
0
    private static IssuerKeyAndParametersComposite UseCustomParameterSet(string uniqueIdentifier, byte[] attributeEncoding, string hash, string sessionID)
    {
      IssuerSetupParameters isp = new IssuerSetupParameters();

      
      isp.GroupConstruction = GroupConstruction.Subgroup;
      // pick a unique identifier for the issuer params
      isp.UidP = encoding.GetBytes(uniqueIdentifier);

      // set the encoding parameters for the attributes
      isp.E = attributeEncoding;

      isp.UseRecommendedParameterSet = false; // we don't use the recommended parameters

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

      // generate the serializable IssuerKeyAndParameters		
      IssuerKeyAndParameters ikap = isp.Generate(true);
      sessionDB[sessionID].group = ikap.IssuerParameters.Gq;
      sessionDB[sessionID].groupElement = ikap.IssuerParameters.Gd;
      IssuerKeyAndParametersComposite ikpc = new IssuerKeyAndParametersComposite();
      
      ikpc.IssuerParameters = ConvertUtils.convertIssuerParameters(ikap.IssuerParameters);
      ikpc.PrivateKey = ikap.PrivateKey.ToByteArray();

      return ikpc;
    }