[URGENT] help extracting FoxPro DBF Encrypted fields

Hi everyone.

I'm working with a Foxpro DBF database, but I'm not using Visual Foxpro to read the data. I'm doing this from C#.Net.

In fact .. I've never really used Foxpro before.

My problem is as follows:

In C# and Crystal Reports .. a lot of the string fields simply return blank strings (i.e. "")

When I view the table in FoxPro, they are fixed-width character fields, and browsing the table shows that they contain a bunch of special ASCII characters.
A
#
E

I know that the data is there, because when I run the FoxPro application which came with the database files I can see the actually data (actually numerical decimal values).

So .. my question is thus:

Having FoxPro installed .. how would I go about decrypting these files

Secondly ... how could I then read these values through an ODBC or DSN data source

All help appreciated .. this is quite urgent.

thankyou

Martiankeeper



Answer this question

[URGENT] help extracting FoxPro DBF Encrypted fields

  • qrz

    Thankyou for the swift reply

    I'm assuming that there is no standard "encrypt" / "decrypt" methods, functions or tools in Foxpro

    The problem is that the vendor is not interested and refuses to co-operate
    (he can't be bothered to do the work himself, but at the same time doesn't want someone else access to the system that he wrote).

    Which, as I'm sure you can imagine, is very frustrating.

    (any encryption cracking tools or services out there )


  • Waldis

    It sounds like the VFP app is decrypting the data on the fly.

    I think you will need the vendors help.

    Dave M.



  • Rob Redbeard

    Is it really encrypted data or are you looking at it wrong

    You say they're numerical decimal values and getting string fields instead In foxpro numerical values are stored in different ways and some of them if not casted to right type looks like special ASCII chars (memory representation of an integer or real for example).

    Would you show your C# code (1.1 or 2.0 ).

    PS: Instead of ODBC use OLEDB. VFP has VFPOLEDB driver downloadable from MS VFP site.


  • AmitInnani

    Oooops ...

    hehe ... I did copy and paste, but trimmed out loads of other stuff (which doesn't affect this problem .. and is sensitive information).

    so .. apart from my previous typos ...
    any ideas


  • cmyster

    Actually FoxPro dose have one, but encryption requires an encryption key used for Encrypting and decrypting.

     

    If this is the method he used. Perhaps you can persuade (ie bride) your vendor for the encryption key. Than handle the rest yourself.

     

    See:

    http://www.code-magazine.com/article.aspx quickid=0203041&page=3

     

    also

     

    http://doc.advisor.com/Articles.nsf/nl/12579

     

    Dave M.



  • julio666

    "vendor is not interested and refuses to co-operate" - they never do.

    You are facing a formidable task. It is called binary file analysis/parsing. I may be in your shoes a month from now. It is actually the end goal of a long series of projects of mine. I did some preliminary search and the results are not encouraging so far.

    I can leave here a few links some of them barely relevant but still may be useful. If you get anywhere, share your experience. The last website contains all sorts of codes. They also welcome any new discoveries.

    http://sweetscape.fileburst.com/010edrefmanual.pdf
    http://www.byronref.com/rmb/pxspecs.htm
    http://www.clicketyclick.dk/databases/xbase/format/dbf.html#DBF_STRUCT
    http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm
    http://www.packetsnifferanalyzers.com/ OVRAW=packet%20sniffer%20&OVKEY=packet%20sniffer&OVMTC=standard
    http://www.the-oasis.net/
    http://www.wotsit.org/

    Thanks.



  • Erathus

    What typos


  • LeszekG

    C# Code I am using.


    // Initialize database connection.
    OleDbConnection _connection = new OleDbConnection(
    @"Provider=vfpoledb.1;" +
    @"Data Source=C:\MyDataTable\;" +
    @"Collating Sequence=general");

    try
    {
    // SQL select statement
    string strSelect = "SELECT * FROM MyTable";

    OleDbDataAdapter _dataAdapter = new OleDbDataAdapter(strSelect, _connection);

    OleDbCommandBuilder _commandBuilder = new OleDbCommandBuilder(_dataAdapter);

    DataSet _dataset = new DataSet();
    _dataset.Clear();

    _dataAdapter.FillSchema(_dataset, SchemaType.Source);
    _dataAdapter.Fill(_dataset);
    }
    foreach(DataRow _datarow in _dataset.Tables[0].Rows)
    {
    Console.Writeline (  _datarow["myField"] );
    }
    finally
    {
    _connection.Close();
    }



    When I ask for the _datarow values .. it doesn't even return a data type ... it's just "" (blank string).

    If I try and cast it to a numerical data type it returns an error (saying that blank strings cannot be cast to integers).

    So .. not much luck there methinks.

    Martin






  • Buffy6

    Theoretical using a decompiler, one may be able to get the encryption key and Decrypt his\her's data files.

    I’m not sure I doing do is legal or ethical if one was only tying to get there own data.

    Dave M.



  • jcarranza

    try block is missing closing braces and Writeline.


  • Fredrik G

    OK to me it looks like this code has typos and wouldn't even compile. Considering you have the right version it might be encrypted data (and you should have already tried to preview data in VS IDE).
  • [URGENT] help extracting FoxPro DBF Encrypted fields