1. Database with Images?

Gday all, I haven't done any programming in EU for about 3 years, but I'm sure it will come back to me (I Hope).

Anyway I want to write a database with around 800 records. Each record will contain around 15 text fields no bigy so far. There will be one table of images. Probably around 3 or four images per record in the main table. Each image at the moment is around 1mb.

I want the images in the database as they are of a high security nature and I must restrict who can view them.

Any Suggestions? Should I even be using EU?

new topic     » topic index » view message » categorize

2. Re: Database with Images?

Putting them in the database won't inprove security much. Better solution is to put it in a restricted access folder and encrypt them. If you are working on windows xp or vista you can encrypt the whole folder (and subfolders) as windows offer folder encryption natively. Anyway if you really want to put them in database, you have to 2 choices:
1 - encrypt images before putting them in database.
2 - encrypt the database.

Jacques

lockiedownunder said...

Gday all, I haven't done any programming in EU for about 3 years, but I'm sure it will come back to me (I Hope).

Anyway I want to write a database with around 800 records. Each record will contain around 15 text fields no bigy so far. There will be one table of images. Probably around 3 or four images per record in the main table. Each image at the moment is around 1mb.

I want the images in the database as they are of a high security nature and I must restrict who can view them.

Any Suggestions? Should I even be using EU?

new topic     » goto parent     » topic index » view message » categorize

3. Re: Database with Images?

jacques_desch said...

Putting them in the database won't inprove security much. Better solution is to put it in a restricted access folder and encrypt them. If you are working on windows xp or vista you can encrypt the whole folder (and subfolders) as windows offer folder encryption natively. Anyway if you really want to put them in database, you have to 2 choices:
1 - encrypt images before putting them in database.
2 - encrypt the database.

Jacques

Encrypted folders only exist in XP Pro & Vista Ultimate(or something). I have XP Home and Vista Home Premuim. Neither have folder encryption that I am aware of.

Also I would like to distribute this program and database.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Database with Images?

lockiedownunder said...

Gday all, I haven't done any programming in EU for about 3 years, but I'm sure it will come back to me (I Hope).

Anyway I want to write a database with around 800 records. Each record will contain around 15 text fields no bigy so far. There will be one table of images. Probably around 3 or four images per record in the main table. Each image at the moment is around 1mb.

I want the images in the database as they are of a high security nature and I must restrict who can view them.

Any Suggestions? Should I even be using EU?

Using Euphoria is fine for this.

I assume that it would be possible that the same image can be associated with more than one record. That is, you haven't got 800 * 4 = 3200 unique 1mb images.

How do you see the user accessing the images? For example, will a user select a record, enter the password for that record and then be shown the images? Or will there be one password for the entire database? Or is it one password for a user and that gives them accss to only a subset of images. So in summary, is a password linked to the database, the user or the image?

I think it would be better to have the images (encrypted) in a folder and have the database records just contain a link to the image on disk.

There is encryption/decryption code in Euphoria available so that's not a real issue. I assume that the decrypted data must only reside in RAM and never on disk. Depending on how important it is that the decrypted image be protected, you might even want to consider a novel encoding format for the image so that commonly availble tools can't even display the decrypted image anyway.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Database with Images?

What I would do is create a separate table for the images. First, run an md5 hash on the image. This will be the image key. Then, run Blowfish encryption on the image data and store that in the database with the key. Now, when you create the records, you can reference the hash key in the record instead of the whole image. This will keep the records smaller (which will load faster) and avoid duplication of data. You could even go so far as to make a simple browser utility to enumerate the image keys, decrypt the data, then display the image with the key.

-Greg

new topic     » goto parent     » topic index » view message » categorize

6. Re: Database with Images?

Thanks for your reply's I think simply one password at the start of the program would do. Each image will only be related to one record. In other words one record would link to 2 to 4 images.

Perhaps a little more background: I am a locksmith, this database will hold internal pictures, dimensions and information on how to break into safes and vaults, so you can see the need to protect these images. I have never tried to encrypt a file using EU before. Decrypting in memory would be preferable but maybe not essential.

I can write the database using EU's database system. I have used it before but I need assistance encrypting and decrypting jpg images as it looks like this is the way to go.

Run this code and you will see a simple screen layout.

--  code generated by Win32Lib IDE v1.0.4 Build July-06-2008 
 
constant TheProgramType="exw"  
  
include Win32Lib.ew 
without warning 
 
-------------------------------------------------------------------------------- 
--  Window MainWin 
constant MainWin = createEx( Window, "SafesDB", 0, Default, Default, 953, 615, 0, 0 ) 
constant LText2 = createEx( LText, "Brand", MainWin, 612, 8, 60, 20, 0, 0 ) 
constant ComboBrands = createEx( Combo, "", MainWin, 676, 8, 148, 20*6, 0, 0 ) 
constant SafeGroup = createEx( Group, "Safe", MainWin, 12, 32, 916, 500, 0, 0 ) 
constant TXTInsurance = createEx( EditText, "", SafeGroup, 116, 84, 148, 20, 0, 0 ) 
constant ComboType = createEx( Combo, "", SafeGroup, 116, 56, 130, 20*6, 0, 0 ) 
constant GroupDimensions = createEx( Group, "Dimensions", SafeGroup, 276, 12, 160, 132, 0, 0 ) 
constant TXTFire = createEx( EditText, "", SafeGroup, 116, 112, 148, 20, 0, 0 ) 
constant GroupImage = createEx( Group, "Images", SafeGroup, 452, 12, 456, 480, 0, 0 ) 
constant LText13 = createEx( LText, "Internal", GroupDimensions, 104, 28, 50, 20, 0, 0 ) 
constant LText12 = createEx( LText, "Exteral", GroupDimensions, 48, 28, 50, 20, 0, 0 ) 
constant GroupImageRecControl = createEx( Group, "", GroupImage, 152, 440, 156, 36, 0, 0 ) 
constant LblModel = createEx( LText, "Model", SafeGroup, 8, 32, 100, 20, 0, 0 ) 
constant BtnImageFirst = createEx( PushButton, "|<", GroupImageRecControl, 8, 8, 20, 20, 0, 0 ) 
constant LText14 = createEx( LText, "Height", GroupDimensions, 4, 52, 40, 20, 0, 0 ) 
constant BtnImagePrevious = createEx( PushButton, "<", GroupImageRecControl, 28, 8, 20, 20, 0, 0 ) 
constant LblType = createEx( LText, "Type", SafeGroup, 8, 60, 100, 20, 0, 0 ) 
constant TXTImageRecCount = createEx( EditText, "", GroupImageRecControl, 48, 8, 60, 20, 0, 0 ) 
constant LText15 = createEx( LText, "Width", GroupDimensions, 4, 76, 40, 20, 0, 0 ) 
constant BtnImageNext = createEx( PushButton, ">", GroupImageRecControl, 108, 8, 20, 20, 0, 0 ) 
constant LblInsurance = createEx( LText, "Insurance Rating", SafeGroup, 8, 88, 100, 20, 0, 0 ) 
constant BtnImageLast = createEx( PushButton, ">|", GroupImageRecControl, 128, 8, 20, 20, 0, 0 ) 
constant LText16 = createEx( LText, "Depth", GroupDimensions, 4, 100, 40, 20, 0, 0 ) 
constant MleTextNotes = createEx( MleText, "", SafeGroup, 8, 148, 436, 300, w32or_all({ES_AUTOVSCROLL,WS_VSCROLL}), 0 ) 
constant LblFire = createEx( LText, "Fire Rating", SafeGroup, 8, 116, 100, 20, 0, 0 ) 
constant BtnAddType = createEx( PushButton, "+", SafeGroup, 248, 56, 20, 20, 0, 0 ) 
constant TXTExtH = createEx( EditText, "", GroupDimensions, 48, 52, 48, 20, 0, 0 ) 
constant BitmapImage = createEx( Bitmap, "Image", GroupImage, 8, 16, 440, 420, 0, 0 ) 
constant TXTExtW = createEx( EditText, "", GroupDimensions, 48, 76, 48, 20, 0, 0 ) 
constant TXTExtD = createEx( EditText, "", GroupDimensions, 48, 100, 48, 20, 0, 0 ) 
constant TXTIntH = createEx( EditText, "", GroupDimensions, 104, 52, 48, 20, 0, 0 ) 
constant TXTIntW = createEx( EditText, "", GroupDimensions, 104, 76, 48, 20, 0, 0 ) 
constant TXTIntD = createEx( EditText, "", GroupDimensions, 104, 100, 48, 20, 0, 0 ) 
constant MainRecordControl = createEx( Group, "", MainWin, 352, 536, 156, 36, 0, 0 ) 
constant BtnMainFirst = createEx( PushButton, "|<", MainRecordControl, 8, 8, 20, 20, 0, 0 ) 
constant BtnMainPrevious = createEx( PushButton, "<", MainRecordControl, 28, 8, 20, 20, 0, 0 ) 
constant TXTMainRecCount = createEx( EditText, "", MainRecordControl, 48, 8, 60, 20, 0, 0 ) 
constant BtnMainNext = createEx( PushButton, ">", MainRecordControl, 108, 8, 20, 20, 0, 0 ) 
constant BtnMainLast = createEx( PushButton, ">|", MainRecordControl, 128, 8, 20, 20, 0, 0 ) 
constant TXTModel = createEx( EditText, "", SafeGroup, 116, 32, 148, 20, 0, 0 ) 
setHint( BtnAddType,"Add Safe Type") 
setHint( BtnMainFirst,"First") 
setHint( BtnMainPrevious,"Previous") 
setHint( BtnMainNext,"Next") 
setHint( BtnMainLast,"Last") 
--------------------------------------------------------- 
--------------------------------------------------------- 
 
 
WinMain( MainWin,Normal ) 
new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu