Storing items in a blob

"berzerker77it" <[email protected]> Sat, 09 Aug 2003 11:13:25 -0000
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <[email protected]>
Hi all, I have some trouble with blobs (ADO, Access)

I have succesfully used them in the past (for storing some jpgs), 
now what I need to do is to store some public Rsa keys. I have used 
the same routine and they seem to work, BUT here is what I get when 
I try to get back my keys:

Original Key: (Hex values)
00000000h: 30 48 02 41 00 DB BE 2F C4...

Retrived Key: (This is Hex too)
00000000h: 30 00 48 00 02 00 41 00...

There are 2 problems:
1) some sort of conversion to unicode (?? 32 bit instead of 16, 
padding with 00, like some conversion routine used by visual basic 
(widechar))

2) The retrived key is a lot shorter! I have pasted only a few byte, 
but the Original key is a lot longer, the retrived key ends a few 
byte after the ...

Here the routine I used, very basic, noting exotic in them:

Storing:
FriendsT.Edit;
BlobS :=TADOBlobStream.Create(TBlobField(FriendsT.FieldByName
('Key')), bmWrite);
BlobS.LoadFromFile(OpenDialog1.FileName);
FriendsT.UpdateRecord;
BlobS.Free;


Retriving:
BlobKey :=TADOBlobStream.Create(TBlobField
(dataM.mainADOQ2.FieldByName('Key')), bmRead);

BlobKey.SaveToFile('C:\x.k'); //used for debug, usually i need the 
SaveToStream


Ok, what is wrong?

Luca.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Low on Ink? Get 80% off inkjet cartridges & Free Shipping at 77Colors.com.
We have your brand: HP, Epson, Lexmark, Canon, Compaq and more!
http://www.c1tracking.com/l.asp?cid=5981
http://us.click.yahoo.com/DmnqpB/IyhGAA/ySSFAA/i7folB/TM
---------------------------------------------------------------------~->

CodeCoffer - new Delphi code protection Tool!
http://www.delphicollection.com/public/CodeCoffer.htm
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/