当前位置: 首页>>代码示例>>C#>>正文


C# SimiasWebService.StorePassPhrase方法代码示例

本文整理汇总了C#中SimiasWebService.StorePassPhrase方法的典型用法代码示例。如果您正苦于以下问题:C# SimiasWebService.StorePassPhrase方法的具体用法?C# SimiasWebService.StorePassPhrase怎么用?C# SimiasWebService.StorePassPhrase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimiasWebService的用法示例。


在下文中一共展示了SimiasWebService.StorePassPhrase方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowVerifyDialog

 public static bool ShowVerifyDialog(string DomainID, SimiasWebService simws)
 {
     bool status = false;
        int result;
        Status passPhraseStatus= null;
        VerifyPassPhraseDialog vpd = new VerifyPassPhraseDialog();
        if (!Util.RegisterModalWindow(vpd))
        {
     vpd.Destroy();
     vpd = null;
     return false;
        }
        try
        {
        do
        {
     result = vpd.Run();
     vpd.Hide();
     if( result == (int)ResponseType.Ok)
      passPhraseStatus = simws.ValidatePassPhrase(DomainID, vpd.PassPhrase);
     if( passPhraseStatus != null)
     {
      if( passPhraseStatus.statusCode == StatusCodes.PassPhraseInvalid)
      {
       Debug.PrintLine("Invalid Passphrase");
       iFolderMsgDialog dialog = new iFolderMsgDialog(
        null,
        iFolderMsgDialog.DialogType.Error,
        iFolderMsgDialog.ButtonSet.None,
        Util.GS("Invalid Passphrase"),
        Util.GS("The Passphrase entered is invalid"),
        Util.GS("Please enter the passphrase again"));
        dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        dialog = null;
       passPhraseStatus = null;
      }
      else if(passPhraseStatus.statusCode == StatusCodes.Success)
       break;
     }
        }while( result != (int)ResponseType.Cancel && result !=(int)ResponseType.DeleteEvent);
        if( result == (int)ResponseType.Cancel || result == (int)ResponseType.DeleteEvent)
        {
     try
     {
      simws.StorePassPhrase(DomainID, "", CredentialType.None, false);
      status = false;
     }
     catch(Exception)
     {
      return false;
     }
        }
        else if( passPhraseStatus != null && passPhraseStatus.statusCode == StatusCodes.Success)
        {
     try
     {
      simws.StorePassPhrase( DomainID, vpd.PassPhrase, CredentialType.Basic, vpd.ShouldSavePassPhrase);
      status = true;
     }
     catch(Exception)
     {
      return false;
     }
        }
        }
        catch(Exception)
        {
     return false;
        }
        return status;
 }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:73,代码来源:iFolderWindow.cs

示例2: PassphraseHelper

 private static bool PassphraseHelper( EnterPassPhraseDialog epd, string DomainID, SimiasWebService simws)
 {
     bool status = false;
       int result;
     do
     {
       result = epd.Run();
      if(result == (int)ResponseType.Cancel || result == (int) ResponseType.DeleteEvent)
      {
         epd.Hide();
       return false;
     }
       if( epd.PassPhrase != epd.RetypedPassPhrase )
       {
        iFolderMsgDialog dialog = new iFolderMsgDialog(
     null,
     iFolderMsgDialog.DialogType.Error,
     iFolderMsgDialog.ButtonSet.None,
     Util.GS("passphrase mismatch"),
     Util.GS("The passphrase and retyped passphrase are not same"),
        Util.GS("Please enter the passphrase again"));
        dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        dialog = null;
       }
     else
     {
         break;
     }
     }while( result != (int)ResponseType.Cancel );
       if( result != (int)ResponseType.Cancel || result != (int) ResponseType.DeleteEvent)
       {
        string publicKey = null;
        if( epd.RecoveryAgent != null && epd.RecoveryAgent != "Server_Default")
        {
     byte [] RACertificateObj = DomainController.GetDomainController().GetRACertificate(DomainID, epd.RecoveryAgent);
     if( RACertificateObj != null && RACertificateObj.Length != 0)
     {
      System.Security.Cryptography.X509Certificates.X509Certificate Cert = new System.Security.Cryptography.X509Certificates.X509Certificate(RACertificateObj);
      CertificateDialog dlg = new CertificateDialog(Cert.ToString(true));
      if (!Util.RegisterModalWindow(dlg))
      {
       dlg.Destroy();
       dlg = null;
       return false;
      }
      int res = dlg.Run();
      dlg.Hide();
      dlg.Destroy();
      dlg = null;
      if( res == (int)ResponseType.Ok)
      {
       publicKey = Convert.ToBase64String(Cert.GetPublicKey());
      }
      else
      {
                 status = false;
           simws.StorePassPhrase(DomainID, "", CredentialType.None, false);
       return ShowEnterPassPhraseDialog(DomainID, simws);
      }
     }
         status = SetPassPhrase( epd, DomainID, publicKey, simws );
         epd.Hide();
         return status;
        }
       else
       {
      DomainInformation domainInfo = (DomainInformation)simws.GetDomainInformation(DomainID);
                 string memberID = domainInfo.MemberUserID;
       iFolderWebService ifWebService = DomainController.GetiFolderService();
      publicKey = ifWebService.GetDefaultServerPublicKey(DomainID,memberID);
                 status = SetPassPhrase(epd,DomainID,publicKey,simws);
                 epd.Hide();
                 return status;
       }
       }
     else
     {
     epd.Hide();
     }
     return true;
 }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:83,代码来源:iFolderWindow.cs

示例3: SetPassPhrase

 private static bool SetPassPhrase( EnterPassPhraseDialog epd, string DomainID, string publicKey, SimiasWebService simws )
 {
     bool status;
     Status passPhraseStatus = null;
       if(epd.RecoveryAgent != null && epd.RecoveryAgent != Util.GS("Server_Default"))
      passPhraseStatus = simws.SetPassPhrase( DomainID, epd.PassPhrase, epd.RecoveryAgent, publicKey);
      else
        passPhraseStatus = simws.SetPassPhrase( DomainID, epd.PassPhrase, "DEFAULT", publicKey);
     if(passPhraseStatus.statusCode == StatusCodes.Success)
     {
     status = true;
     simws.StorePassPhrase( DomainID, epd.PassPhrase, CredentialType.Basic, epd.ShouldSavePassPhrase);
     }
     else
     {
     status = false;
     iFolderMsgDialog dialog = new iFolderMsgDialog(
         null,
         iFolderMsgDialog.DialogType.Error,
         iFolderMsgDialog.ButtonSet.None,
         Util.GS("Error setting the PassPhrase"),
         Util.GS("Unable to set the passphrase"),
         Util.GS("Please try again"));
     dialog.Run();
     dialog.Hide();
     dialog.Destroy();
     dialog = null;
     }
     return status;
 }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:30,代码来源:iFolderWindow.cs

示例4: PassphraseHelper

 private static bool PassphraseHelper( EnterPassPhraseDialog epd, string DomainID, SimiasWebService simws)
 {
     bool status = false;
       int result;
     do
     {
       result = epd.Run();
      if(result == (int)ResponseType.Cancel || result == (int) ResponseType.DeleteEvent)
      {
         epd.Hide();
       return false;
     }
       if( epd.PassPhrase != epd.RetypedPassPhrase )
       {
        iFolderMsgDialog dialog = new iFolderMsgDialog(
     null,
     iFolderMsgDialog.DialogType.Error,
     iFolderMsgDialog.ButtonSet.None,
     Util.GS("passphrase mismatch"),
     Util.GS("The passphrase and retyped passphrase are not same"),
        Util.GS("Please enter the passphrase again"));
        dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        dialog = null;
       }
     else
     {
         break;
     }
     }while( result != (int)ResponseType.Cancel );
       if( result != (int)ResponseType.Cancel || result != (int) ResponseType.DeleteEvent)
       {
        string publicKey = null;
        if( epd.RecoveryAgent != null)
        {
     byte [] RACertificateObj = DomainController.GetDomainController().GetRACertificate(DomainID, epd.RecoveryAgent);
     if( RACertificateObj != null && RACertificateObj.Length != 0)
     {
      System.Security.Cryptography.X509Certificates.X509Certificate Cert = new System.Security.Cryptography.X509Certificates.X509Certificate(RACertificateObj);
      CertificateDialog dlg = new CertificateDialog(Cert.ToString(true));
      if (!Util.RegisterModalWindow(dlg))
      {
       dlg.Destroy();
       dlg = null;
       return false;
      }
      int res = dlg.Run();
      dlg.Hide();
      dlg.Destroy();
      dlg = null;
      if( res == (int)ResponseType.Ok)
      {
       publicKey = Convert.ToBase64String(Cert.GetPublicKey());
      }
      else
      {
                 status = false;
           simws.StorePassPhrase(DomainID, "", CredentialType.None, false);
       return ShowEnterPassPhraseDialog(DomainID, simws);
      }
     }
         status = SetPassPhrase( epd, DomainID, publicKey, simws );
         epd.Hide();
         return status;
        }
     else
     {
         iFolderMsgDialog dg = new iFolderMsgDialog(
             epd,
             iFolderMsgDialog.DialogType.Warning,
             iFolderMsgDialog.ButtonSet.YesNo,
             "No Recovery Agent",
             Util.GS("Recovery Agent Not Selected"),
             Util.GS("There is no Recovery Agent selected. Encrypted data cannot be recovered later, if passphrase is lost. Do you want to continue?"));
       int rc = dg.Run();
        dg.Hide();
      dg.Destroy();
         if( (ResponseType)rc == ResponseType.Yes )
         {
             status = SetPassPhrase( epd, DomainID, publicKey, simws );
             epd.Hide();
             return status;
         }
         else
         {
             epd.Hide();
             PassphraseHelper( epd, DomainID, simws );
         }
     }
       }
     else
     {
     epd.Hide();
     }
     return true;
 }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:97,代码来源:iFolderWindow.cs


注:本文中的SimiasWebService.StorePassPhrase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。