EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Store files via Delphi

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
Posted: 08/26/2007 13:41:53
by Anthoni Gardner (Basic support level)
Joined: 07/24/2007
Posts: 29

Hello there,

I've created a storage and set the encryption password for this storage and mounted it. I know I can access this drive via its UNC, but because its encrypted I also have to supply the password.

My program downloads files from a private network onto a users computer, files that they are not allowed to tamper with (hence why using a SolFS). Normally as the file is downloading, I open the file append the downloaded section to the file and then close it. I then repeat this as long as the file is being downloaded.

Now because of the encryption, I am presuming (untested) that I can not use normal methods to write to the SolFS, after reading some of the posts here.

So, what do I use? Do I create a SolFS Stream and use that ? If so, can the SolFS Stream be written in partial, then opened and appened to, repeatedly?

Also, once the file is written to storage, is it wise to call the CompactAndRepair function, or do I just call this intermittently.

Hope I've explained myself well enough.

Posted: 08/27/2007 02:09:55
by Alexander Plas (EldoS Corp.)

You can use two different encryption modes - whole storage encryption or per file encryption.

With whole storage encryption all data in the storage will be encrypted includes directories structure, file names etc. To use this encryption mode you should supply password for storage mounting and then you can work with storage using native operating system file operations.

With per file encryption only file data will be encrypted, directories structure and file names can be obtained without password. To use per file encryption you should use SolFSStream class for files operations like creation, opening, reading and writing. You can write partially your file with SolFSStream then close it and reopen for additional writing or reading.
Posted: 08/27/2007 02:23:20
by Anthoni Gardner (Basic support level)
Joined: 07/24/2007
Posts: 29

Hi Plas,

Thank you for your answer. Here is my current Delphi code

NewStorage := TSolFSStorage.Create(Nil);
NewStorage.FileName := Browser.Drive;
NewStorage.PageSize := 4096;
NewStorage.Logo := 'FS';
NewStorage.AutoCompact := 25;
NewStorage.StorageType := stVirtualDisk;
NewStorage.SetEncryption(ecAES256_HMAC256, '', 'myPassword');

I copied this directly from the simple storage program and I presume doing SetEncryption method encrypts the whole storage yes, like you said in first scenario?

If so, I should be able to use normal Delphi File API to save and delete the files inside the storage, as long as I put the full UNC. Is this correct ? If so what UNC do I use, is it ./MyDisk/MyFile.ext ?

Also how you mean "supply password for storage mounting", I can not find a property or method to suply the password for the storage. Here is my code

If Not FileExists(Browser.Drive) Then

SolStorage.FileName := Browser.Drive;

fDiskPath := '\\myDisk\';

I presume this does not set the password, cos there is no parameter for it. So how do I supply it so I can use normal methods for reading / writing files using Delphi API ?

Posted: 08/27/2007 02:39:38
by Alexander Plas (EldoS Corp.)

To obtain file names applicable for normal files API you can use function
function ConvertFileNameToSystem(StorageFileName: WideString): WideString;
where StorageFileName should be in format '\dir1\dir2\filename.ext'. As a result you will receive fully qualified file name with prefix like \\?\SolFS_Volume1

To supply password for whole storage encryption you should use property StoragePassword before storage mounting or function SetPassword after storage mounting but before any storage operations.
Posted: 08/27/2007 04:02:20
by Anthoni Gardner (Basic support level)
Joined: 07/24/2007
Posts: 29

Hi Plas,

That is excellent about the password. I will do that now.

With the ConvertFilenameToSystem that allows me to get a fully qualified path of the file INSIDE the structure that I then pass to other programs to use. Can they still read the file even if password is set to whole storage?

Also, like I noted, my files are downloaded piece by piece and not stored anywhere on the users hard drive. What I want to do is as soon as a piece comes down, append it into the storage. So given this I presume I would be best using a SolFS Stream wouldn't I?

Thank you for your help thus far.

Posted: 08/27/2007 04:16:57
by Alexander Plas (EldoS Corp.)

Other processes can work with files in SolFS storage in usual way when the storage is mounted and valid password supplied. You can restrict usage of the storage by other processes using property ProcessRestrictionsEnabled and set of functions AddGrantedProcess, DeleteGrantedProcess etc. Please refer to SolFS documentation and our SimpleMounter example.

To store your downloaded information you may use normal files API. SolFSStream class also using normal files API. Only with per file encryption SolFSStream should be used for files creating and opening.
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.



Topic viewed 4358 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!