internal void OnSerializing(StreamingContext context)
 {
     _c   = c.ToBase64String();
     _rXb = rXb.ToBase64String();
     _rR  = rR.ToBase64String();
     _rOb = rOb.ToBase64String();
 }
        /// <summary>
        ///  This setup method initializes the issuer, do it once and save the IssuerParameters they were used for verifying the issuer later (Verifier / Prover)
        ///  and are used for initiate the issuer at another time
        /// </summary>
        /// <param name="UIDP">issuer identifier</param>
        /// <param name="appSpecification">description for the issuer</param>
        /// <param name="maxNumberOfAttributes">number of attributes which should be supported in a token -> max allowed attributes are 25</param>
        /// <param name="groupType">ECC or Subgroup</param>
        /// <param name="supportDevice">ture, if the issuer allows to protect a token with a hard tokens</param>
        public IssuingIssuer(string UIDP, string appSpecification, int maxNumberOfAttributes,
                             GroupType groupType = GroupType.ECC, bool supportDevice = false)
        {
            isDeviceProtected = supportDevice;
            try
            {
                // max allowed are 50 attributes
                if (maxNumberOfAttributes > 50)
                {
                    throw new Exception("General supported are max 25 attributes");
                }

                IssuerSetupParameters isp = new IssuerSetupParameters(maxNumberOfAttributes);
                isp.UidP = encoding.GetBytes(UIDP);
                isp.S    = encoding.GetBytes(appSpecification);
                isp.GroupConstruction          = groupType;
                isp.UseRecommendedParameterSet = true;

                ikap = isp.Generate(isDeviceProtected);

                privateKey = ikap.PrivateKey;
                string pk     = privateKey.ToBase64String();
                string ipJSON = ikap.IssuerParameters.Serialize();
                LogService.Log(LogService.LogType.Info, "IssuingIssuer - successfully set up. IssuerParameters are: '" + ipJSON + "'");
            }
            catch (Exception e)
            {
                LogService.Log(LogService.LogType.FatalError, "IssuingIssuer - Error during issuer setup.", e);
                throw new CommunicationException("IssuingIssuer - Error during issuer setup", e);
            }
        }
 internal void OnSerializing(StreamingContext context)
 {
     _x = x.ToBase64String();
 }
예제 #4
0
 public static string Serialize(FieldZqElement value)
 {
     return(value.ToBase64String());
 }