本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}