Click here to Skip to main content
15,886,069 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Suppose my program codes a file into byte and save it. Could anyone see that file in anyway ...

What I have tried:

The idea came in my mind because it's the question of data security.
Posted
Updated 16-Jul-21 6:12am
v2
Comments
PIEBALDconsult 16-Jul-21 12:39pm    
Sure I can, unsure I can understand it, but I could read it.

The answer is opinion based only...

Yes and No.
Yes - if there's no encryption.
No - if an encryption is used (i.e.: AES).

Please, read this: Encrypting Data | Microsoft Docs[^]
 
Share this answer
 
Yes.
All files are stored by the system as a "stream" of bytes - text files, Excel files, EXE files, database files - they are all just streams of bytes at the most basic level. Applications add formatting to that data by interpreting what a particular byte value in a particular position in the file means.
For example, if the first two bytes of a file are "MZ" then it could be a DOS executable, and all EXE files that run under windows will include that two byte "signature" - and you can open any EXE file (including C# Windows apps) in a editor such as PSPad and see that signature and some of the text.

And every file has to be readable or your app can't open it either - so yes, anyone who has access to the machine for legitimate reasons can look at your file content. Generally speaking, it isn't difficult to work out file formats from the byte stream and extract whatever info you need from them.

What are you trying to do that you think you need this not to be possible?
 
Share this answer
 
Comments
Member 12712527 1-Mar-21 6:08am    
no sir it isn't possible for anyone to read my data
suppose there is a word of even numbered length and i divide the word by 2. converted into integer and added or subtracted it 2 to it and then transformed into byte code.
would it be possible for anyone to transform back to original data from outside the program ?
Chris Copeland 1-Mar-21 6:27am    
It sort of sounds like you want to protect data in a file, and what you might find is it's very difficult to do so. You can perform algorithms on the data, and even encrypt the data using an encryption algorithm (with a key used to decrypt), but you should be aware that it's relatively easy to open a DLL or EXE in a decompilation tool (like ILSpy) and see what that process is.

That process becomes a little more involved once you move down to C/C++ or ASM, but it's still something that can happen.
Member 12712527 1-Mar-21 6:32am    
data file by oracle or ms sql server can they be seen ?
Chris Copeland 1-Mar-21 6:52am    
Certainly, you can see the documentation to be informed of where the data files sit. If the files aren't encrypted (they likely will be, however) then you could easily look at them.

Remember that the likes of Oracle/MSSQL are written in lower-level languages, and will employ enterprise-level methods for protecting the files, making them much harder to decrypt.
OriginalGriff 1-Mar-21 6:30am    
Yes.
Remember, your code has to be able to do it - which means that it is possible. And since your code can do it, all I'd have to do is ... look at your code and I'll know how to do it as well!

What - exactly - are you trying to protect? There may be a better way to deal with the problem.
To summarise what's been discussed against your original question, it sounds like you're building your own database-style system in C# and want to know whether other people will be able to access the database data files and view/expose the data within.

If you're planning on building a database system similar to SQLite, which stores the database on the same machine as the client, then it's highly likely that those files would be exposed. Even if you employ encryption on the files to secure it, anyone with access to your assembly (EXE or DLL) could reverse-engineer it and work out how the files are formatted, and what encryption was used.

Traditionally, in a more corporate environment, the database would be sitting on a server somewhere within the infrastructure of the business. This would be handled by system administrators, and interacting with the database involves connecting to and authenticating with the database server, issuing SQL queries in order to interact with the data, thus protecting the data files. Only authorised system administrators would have access to the servers (in theory) and wouldn't be considered malicious actors.

As OriginalGriff mentioned, there's not much point in creating your own database system since there's lots of options already out there. If you're planning on making one anyway, perhaps as a personal project or some sort of learning opportunity, then by all means go ahead! But just be aware that locally stored databases aren't guaranteed to be secure.
 
Share this answer
 
Comments
Member 12712527 1-Mar-21 8:56am    
thanks for encouraging me. but it would take long time to complete first phase of the database as i am alone programmer
Quote:
suppose my program code a file into byte and save it . could anyone see that file in anyway ...

Yes the file is still visible.
Avery one will be able to see the bytes of the file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900