public void saveSessionData(SecureSession session, byte[] masterPassword, byte[] sessionKey)
        {
            var textGenerator = new RandomPlaceholderTextGenerator();
            var fakePwd       = textGenerator.RandomString(16);

            session.Data.SaveToFile(
                masterPassword,
                ref fakePwd,
                textGenerator,
                sessionKey
                );
        }
        public SecureSession CreateSession(IPAddress clientIp)
        {
            var sess = new SecureSession(clientIp);

            // At some point Sessions was a List
            //Sessions.Add(sess);

            // We could, in theory, have a collision of sessions.
            // I'm going to take that risk.
            // We need to hash(hashed_sequence + session_id)
            // Both of these are byte arrays, so we need to build a bigger byte array.
            // Then clear that byte array once we no longer need it.
            byte[] hashedId = HashUtils.HashBytes(HashUtils.ConcatByteArrays(_sequence, sess.SessionId));
            Sessions.TryAdd(HashUtils.ByteArrayToHexString(hashedId), sess);
            HashUtils.ClearByteArray(hashedId);
            return(sess);
        }
 private byte[] generateSessionKey(SecureSession session)
 {
     return(HashUtils.ConcatByteArrays(_sequence, session.SessionId));
 }