private object SetKeys(PrivacyRoomModel model) { PermissionContext.DemandPermissions(new UserSecurityProvider(AuthContext.CurrentAccount.ID), Constants.Action_EditUser); if (!PrivacyRoomSettings.GetEnabled(SettingsManager)) { throw new System.Security.SecurityException(); } var keyPair = EncryptionKeyPairHelper.GetKeyPair(); if (keyPair != null) { if (!string.IsNullOrEmpty(keyPair.PublicKey)) { return(new { isset = true }); } Log.InfoFormat("User {0} updates address", AuthContext.CurrentAccount.ID); } EncryptionKeyPairHelper.SetKeyPair(model.PublicKey, model.PrivateKeyEnc); return(new { isset = true }); }
public IEnumerable <EncryptionKeyPair> GetPublicKeysWithAccess(int fileId) { if (!PrivacyRoomSettings.GetEnabled(SettingsManager)) { throw new System.Security.SecurityException(); } return(EncryptionKeyPairHelper.GetKeyPair(fileId, FileStorageServiceInt)); }
public EncryptionKeyPair GetKeys() { PermissionContext.DemandPermissions(new UserSecurityProvider(AuthContext.CurrentAccount.ID), Constants.Action_EditUser); if (!PrivacyRoomSettings.GetEnabled(SettingsManager)) { throw new System.Security.SecurityException(); } return(EncryptionKeyPairHelper.GetKeyPair()); }
public bool PrivacyRoom() { PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings); return(PrivacyRoomSettings.GetEnabled(SettingsManager)); }
public Configuration <T> OpenEdit(T fileId, int version, string doc, bool view) { DocumentServiceHelper.GetParams(fileId, version, doc, true, !view, true, out var configuration); configuration.EditorType = EditorType.External; if (configuration.EditorConfig.ModeWrite) { configuration.EditorConfig.CallbackUrl = DocumentServiceTracker.GetCallbackUrl(configuration.Document.Info.GetFile().ID.ToString()); } if (configuration.Document.Info.GetFile().RootFolderType == FolderType.Privacy && PrivacyRoomSettings.GetEnabled(SettingsManager)) { var keyPair = EncryptionKeyPairHelper.GetKeyPair(); if (keyPair != null) { configuration.EditorConfig.EncryptionKeys = new EncryptionKeysConfig { PrivateKeyEnc = keyPair.PrivateKeyEnc, PublicKey = keyPair.PublicKey, }; } } if (!configuration.Document.Info.GetFile().Encrypted&& !configuration.Document.Info.GetFile().ProviderEntry) { EntryManager.MarkAsRecent(configuration.Document.Info.GetFile()); } configuration.Token = DocumentServiceHelper.GetSignature(configuration); return(configuration); }
public Configuration <T> OpenEdit(T fileId, int version, string doc) { DocumentServiceHelper.GetParams(fileId, version, doc, true, true, true, out var configuration); configuration.EditorType = EditorType.External; configuration.EditorConfig.CallbackUrl = DocumentServiceTracker.GetCallbackUrl(configuration.Document.Info.File.ID.ToString()); if (configuration.Document.Info.File.RootFolderType == FolderType.Privacy && PrivacyRoomSettings.GetEnabled(SettingsManager)) { var keyPair = EncryptionKeyPairHelper.GetKeyPair(); if (keyPair != null) { configuration.EditorConfig.EncryptionKeys = new EncryptionKeysConfig { PrivateKeyEnc = keyPair.PrivateKeyEnc, PublicKey = keyPair.PublicKey, }; } } configuration.Token = DocumentServiceHelper.GetSignature(configuration); return(configuration); }