public CfgEditorHubEventHandler(IMessageBroadcastClient messageBroadcastListener,
                                 IHubClientSettings hubClientSettings)
 {
     _key    = hubClientSettings.SharedKey;
     _listnr = messageBroadcastListener;
     _listnr.ConfigRewriteRequested += OnConfigRewriteRequested;
 }
        private static string GenerateAuthKey(IHubClientSettings cfg, string timestamp)
        {
            var sessJson = ComposeSessionJson(cfg);
            var saltdKey = $"{timestamp}{cfg.SharedKey}".SHA1ForUTF8();

            return(AESThenHMAC.SimpleEncryptWithPassword(sessJson, saltdKey));
        }
        public static void AddHmacCyphers(this IDictionary <string, string> headrs, IHubClientSettings cfg)
        {
            var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            var authKey   = GenerateAuthKey(cfg, timestamp);

            headrs.Add(AUTH_HEADER, authKey);
            headrs.Add(TIME_HEADER, timestamp);
        }
Exemple #4
0
 public ConfigEditorVM(IHubClientSettings hubClientSettings,
                       IHubSessionsClient hubSessionsClient)
 {
     _hub             = hubSessionsClient;
     _key             = hubClientSettings.SharedKey;
     EncryptCmd       = R2Command.Relay(EncryptUnsaved, _ => !IsEncrypted, "Encrypt");
     DecryptCmd       = R2Command.Relay(DecryptUnsaved, _ => IsEncrypted, "Decrypt");
     PrettifyCmd      = R2Command.Relay(PrettifyUnsaved, _ => !IsEncrypted, "Prettify");
     SaveCmd          = R2Command.Async(SaveUnsaved, CanSave, "Save");
     PropertyChanged += ConfigEditorVM_PropertyChanged;
 }
        private static string ComposeSessionJson(IHubClientSettings cfg)
        {
            var sess = new HubClientSession
            {
                UserAgent    = cfg.UserAgent,
                AgentVersion = CurrentExe.GetVersion(),
                ComputerName = Environment.MachineName,
                //JsonConfig   = JsonConvert.SerializeObject(cfg),
                JsonConfig = cfg.ReadSavedFile(),
            };

            return(JsonConvert.SerializeObject(sess));
        }
Exemple #6
0
 public MessageBroadcastHubProxy1(IHubClientSettings hubClientSettings, SharedLogListVM sharedLogListVM)
 {
     _cfg = hubClientSettings;
     _log = sharedLogListVM;
 }
 public ChangeReceiverClientProxy1(IHubClientSettings hubClientSettings)
 {
     _cfg = hubClientSettings;
 }
Exemple #8
0
 public AuthenticHubConnection1(IHubClientSettings cfg) : base(cfg.ServerURL)
 {
     this.Headers.AddHmacCyphers(cfg);
 }
 public ClientStatusHubProxy1(IHubClientSettings hubClientSettings,
                              SharedLogListVM sharedLogListVM)
 {
     _cfg = hubClientSettings;
     _log = sharedLogListVM;
 }
Exemple #10
0
 public VersionKeeperClientProxy1(IHubClientSettings hubClientSettings,
                                  IMessageBroadcastClient messageBroadcastClient)
 {
     _client2 = messageBroadcastClient;
     _cfg     = hubClientSettings;
 }