Esempio n. 1
0
 /// <summary>
 /// Initialize DApp information
 /// </summary>
 /// <param name="a"></param>
 public static void Init(AppSetting a)
 {
     try
     {
         var res = GetAppInfo(a);
         // call to gateway Success
         if (res.Item1)
         {
             a.appInfo.AppType       = res.Item3.appType;
             a.appInfo.CAType        = EmCAType.From(res.Item3.caType);
             a.appInfo.AlgorithmType = EmAlgorithmType.From(res.Item3.algorithmType);
             a.appInfo.ChannelId     = res.Item3.channelId;
             a.appInfo.MspId         = res.Item3.mspId;
             a.appInfo.Version       = res.Item3.version;
         }
         else//the call to gateway failed to return
         {
             System.Console.WriteLine("failed to retrieve app info");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
        public Crypto SetAlgorithm(EmAlgorithmType algorithmType, string puk, string pri)
        {
            switch (algorithmType.Value)
            {
            case 1:
                var handle = new SM2Handle(pri, puk);
                return(new BsnCrypto(handle));

            case 2:
            case 3:
                var handleEcdsa = new ECDSAHandle(pri, puk);
                return(new BsnCrypto(handleEcdsa));

            default:
                return(null);
            }
        }