[Lazarus] Send a ResultSet (encrypted) between 2 servers

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Send a ResultSet (encrypted) between 2 servers

Marcos Douglas
Hi,
If you had to send an encrypted ResultSet between 2 DBMS servers,
using port 80, what libs would you use?
It isn't necessary to use WebServices. Just two applications sending
encrypted packages...

Marcos Douglas

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Graeme Geldenhuys
Op 2011-02-10 01:28, Marcos Douglas het geskryf:
> If you had to send an encrypted ResultSet between 2 DBMS servers,
> using port 80, what libs would you use?

Blowfish comes to mind. There is an implementation included with FPC, or
you can use the more extensive DCPCrypt package. We use the latter for
our encryption needs.



Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Marcos Douglas
On Thu, Feb 10, 2011 at 3:32 AM, Graeme Geldenhuys
<[hidden email]> wrote:
> Op 2011-02-10 01:28, Marcos Douglas het geskryf:
>> If you had to send an encrypted ResultSet between 2 DBMS servers,
>> using port 80, what libs would you use?
>
> Blowfish comes to mind. There is an implementation included with FPC, or
> you can use the more extensive DCPCrypt package. We use the latter for
> our encryption needs.

Right... and about the way to send these ResultSet packages, what would you use?

My problem is:
A site, coded in (old) ASP, will use a ActiveX app to communicate with
an app in other server (my future app). This app will execute some
SELECTs in a DBMS. The result (ResultSet) will be encrypted,
compressed  and  sent to ActiveX app. This descompress, decrypts and
save the ResultSet in your own DBMS.


Marcos Douglas

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Joost van der Sluis
In reply to this post by Marcos Douglas
On Wed, 2011-02-09 at 21:28 -0200, Marcos Douglas wrote:
> Hi,
> If you had to send an encrypted ResultSet between 2 DBMS servers,
> using port 80, what libs would you use?
> It isn't necessary to use WebServices. Just two applications sending
> encrypted packages...

I also read your more recent message. But what do you think
'webservices' do? Sending data between two applications using port 80 is
exactly what webservices do. So you can not solve your problem without
using webservices by definition.

You can solve this the difficult way (I think this is what you mean)
using your own protocol and any tcp/ip-component. Like lNet, Indy or
Synapse. The protocol could be as simple as this: do a request to some
url, and get the dataset back, encrypted. In fact you have then build
your own webservice.

But the easier way is to use some pre-defined format (xml=soap, or json,
or whatever) so you can use some standard components. But I think that
this is not what you want, as you stated you don't want to use
'webservices'.

Joost.


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Graeme Geldenhuys
In reply to this post by Marcos Douglas
Op 2011-02-10 12:43, Marcos Douglas het geskryf:
>
> Right... and about the way to send these ResultSet packages, what would you use?

I don't know how others implement n-tier apps with FPC, but I would
probably us something as implemented in tiOPF [http://www.tiopf.com],
seeing that we already use tiOPF for all our object persistence. We
don't currently use n-tier apps at work, our encryption is inside a
client app reading encrypted content from a file and feeding it to a
Flash component.

It would be nice if somebody could post a wiki link, or create a short
wiki article if one doesn't exist yet - and showing how n-tier apps can
be implemented using FPC (and not with tiOPF). I have seen this question
asked numerous times over the years of using FPC. Is WebServices the
only option available to FPC developers, or is there something like
Delphi's Midas too?


Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Marcos Douglas
In reply to this post by Joost van der Sluis
On Thu, Feb 10, 2011 at 7:54 AM, Joost van der Sluis <[hidden email]> wrote:

> On Wed, 2011-02-09 at 21:28 -0200, Marcos Douglas wrote:
>> Hi,
>> If you had to send an encrypted ResultSet between 2 DBMS servers,
>> using port 80, what libs would you use?
>> It isn't necessary to use WebServices. Just two applications sending
>> encrypted packages...
>
> I also read your more recent message. But what do you think
> 'webservices' do? Sending data between two applications using port 80 is
> exactly what webservices do. So you can not solve your problem without
> using webservices by definition.
>
> You can solve this the difficult way (I think this is what you mean)
> using your own protocol and any tcp/ip-component. Like lNet, Indy or
> Synapse. The protocol could be as simple as this: do a request to some
> url, and get the dataset back, encrypted. In fact you have then build
> your own webservice.

I want simplify!
I said: "It isn't necessary to use WebServices. Just two applications
sending encrypted packages..."
Not _necessary_ because I think should exists solutions more simpler
than WebServices and yours XML files.

> But the easier way is to use some pre-defined format (xml=soap, or json,
> or whatever) so you can use some standard components. But I think that
> this is not what you want, as you stated you don't want to use
> 'webservices'.

I can use XML, SOAP, JSON, whatever... I asked "what libs would you
use?" for this problem.
I not want THE solution (well... I accept if you give me!), but if
somebody had the same problem, could tell: "use the 'lib X' to
communicate, 'lib Y' to convert a ResultSet to Stream and 'lib Z' to
encrypt all... see an example in the link 'XYZ.com'" or something like
that  =)


Marcos Douglas

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Marcos Douglas
In reply to this post by Graeme Geldenhuys
On Thu, Feb 10, 2011 at 7:56 AM, Graeme Geldenhuys
<[hidden email]> wrote:

> Op 2011-02-10 12:43, Marcos Douglas het geskryf:
>>
>> Right... and about the way to send these ResultSet packages, what would you use?
>
> I don't know how others implement n-tier apps with FPC, but I would
> probably us something as implemented in tiOPF [http://www.tiopf.com],
> seeing that we already use tiOPF for all our object persistence. We
> don't currently use n-tier apps at work, our encryption is inside a
> client app reading encrypted content from a file and feeding it to a
> Flash component.
>
> It would be nice if somebody could post a wiki link, or create a short
> wiki article if one doesn't exist yet - and showing how n-tier apps can
> be implemented using FPC (and not with tiOPF). I have seen this question
> asked numerous times over the years of using FPC. Is WebServices the
> only option available to FPC developers, or is there something like
> Delphi's Midas too?

+1

See, Joost, not all are WebService. I forgot the Delphi Midas, simpler
than WebServices, not?

Marcos Douglas

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Graeme Geldenhuys
Op 2011-02-10 14:11, Marcos Douglas het geskryf:
>
> I forgot the Delphi Midas, simpler than WebServices, not?


I have never used WebServices in any project before, but the little bit
that I read about the topic (using FPC, Java or .NET) seems very
confusing - compared to Delphi's Midas solution.


Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Joost van der Sluis
In reply to this post by Marcos Douglas
On Thu, 2011-02-10 at 09:11 -0300, Marcos Douglas wrote:

> On Thu, Feb 10, 2011 at 7:56 AM, Graeme Geldenhuys
> <[hidden email]> wrote:
> > Op 2011-02-10 12:43, Marcos Douglas het geskryf:
> >>
> >> Right... and about the way to send these ResultSet packages, what would you use?
> >
> > I don't know how others implement n-tier apps with FPC, but I would
> > probably us something as implemented in tiOPF [http://www.tiopf.com],
> > seeing that we already use tiOPF for all our object persistence. We
> > don't currently use n-tier apps at work, our encryption is inside a
> > client app reading encrypted content from a file and feeding it to a
> > Flash component.
> >
> > It would be nice if somebody could post a wiki link, or create a short
> > wiki article if one doesn't exist yet - and showing how n-tier apps can
> > be implemented using FPC (and not with tiOPF). I have seen this question
> > asked numerous times over the years of using FPC. Is WebServices the
> > only option available to FPC developers, or is there something like
> > Delphi's Midas too?
>
> +1
>
> See, Joost, not all are WebService. I forgot the Delphi Midas, simpler
> than WebServices, not?

Midas is a web-service. (At least when is uses port 80)

But if you want to use something Midas-like, you can just build it
yourself, as I wrote before.

Load the data into a TBufDataset. Then write the data to a stream. (You
may choose the format: xml (midas-compatible) or binary)
Then encode that stream, and send it using tcp/ip.

If you want to know what packages you need for this:

Database: sqldb
Encoding: choose whatever you want, Graeme mentioned Blowfish
tcp/ip: choose whatever you want, I mentioned lNet, Synapse and Indy

Further it's easy:

You need a server, which listens to port 80 (use Indy, lNet, Synapse)
and when it retrieves data decrypt is, and load it into a TBufDataset
using a stream.

And you need a client, which loads the data from a TBufDataset, encrypt
it and opens a connection to the server on port 80 (use Indy, lNet,
Synapse) and sends the data.

This is what Midas does for you. If you don't want to use an existing
WebService, you have to code this yourself.

Joost



--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Marcos Douglas
In reply to this post by Graeme Geldenhuys
On Thu, Feb 10, 2011 at 9:43 AM, Graeme Geldenhuys
<[hidden email]> wrote:
> Op 2011-02-10 14:11, Marcos Douglas het geskryf:
>>
>> I forgot the Delphi Midas, simpler than WebServices, not?
>
>
> I have never used WebServices in any project before, but the little bit
> that I read about the topic (using FPC, Java or .NET) seems very
> confusing - compared to Delphi's Midas solution.

That's I'm talking about.
I used WebServers a long time ago (people said: "this is the future",
"everbody will use", blablabla) and I still thinking is very
confusing.
I don't like XML, first at all. I used Delphi 7. Some clients (coded
in others languages) haven't got the WS's returns very well... problem
with arrays of objetcts, e.g.

Using Midas, I did not have these problems. Is very simple: implements
a new method in the server and use it in the client.


Marcos Douglas

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Marcos Douglas
In reply to this post by Joost van der Sluis
On Thu, Feb 10, 2011 at 9:57 AM, Joost van der Sluis <[hidden email]> wrote:

>
> Midas is a web-service. (At least when is uses port 80)
>
> But if you want to use something Midas-like, you can just build it
> yourself, as I wrote before.
>
> Load the data into a TBufDataset. Then write the data to a stream. (You
> may choose the format: xml (midas-compatible) or binary)
> Then encode that stream, and send it using tcp/ip.
>
> If you want to know what packages you need for this:
>
> Database: sqldb
> Encoding: choose whatever you want, Graeme mentioned Blowfish
> tcp/ip: choose whatever you want, I mentioned lNet, Synapse and Indy

Many tips, thanks.

> Further it's easy:
>
> You need a server, which listens to port 80 (use Indy, lNet, Synapse)
> and when it retrieves data decrypt is, and load it into a TBufDataset
> using a stream.
>
> And you need a client, which loads the data from a TBufDataset, encrypt
> it and opens a connection to the server on port 80 (use Indy, lNet,
> Synapse) and sends the data.
>
> This is what Midas does for you. If you don't want to use an existing
> WebService, you have to code this yourself.

You think I shouLd use WebService. How is this implementation in FPC,
stable or is better do this in Delphi 7? (if I will use WebService).

Marcos Douglas

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Joost van der Sluis
On Thu, 2011-02-10 at 10:09 -0300, Marcos Douglas wrote:

> On Thu, Feb 10, 2011 at 9:57 AM, Joost van der Sluis <[hidden email]> wrote:
> >
> > Midas is a web-service. (At least when is uses port 80)
> >
> > But if you want to use something Midas-like, you can just build it
> > yourself, as I wrote before.
> >
> > Load the data into a TBufDataset. Then write the data to a stream. (You
> > may choose the format: xml (midas-compatible) or binary)
> > Then encode that stream, and send it using tcp/ip.
> >
> > If you want to know what packages you need for this:
> >
> > Database: sqldb
> > Encoding: choose whatever you want, Graeme mentioned Blowfish
> > tcp/ip: choose whatever you want, I mentioned lNet, Synapse and Indy
>
> Many tips, thanks.
>
> > Further it's easy:
> >
> > You need a server, which listens to port 80 (use Indy, lNet, Synapse)
> > and when it retrieves data decrypt is, and load it into a TBufDataset
> > using a stream.
> >
> > And you need a client, which loads the data from a TBufDataset, encrypt
> > it and opens a connection to the server on port 80 (use Indy, lNet,
> > Synapse) and sends the data.
> >
> > This is what Midas does for you. If you don't want to use an existing
> > WebService, you have to code this yourself.
>
> You think I shouLd use WebService. How is this implementation in FPC,
> stable or is better do this in Delphi 7? (if I will use WebService).

You have to use a webservice by definition. You could use wst, but
that's overkill. But to be honest: in your case I think it's indeed
better to use something home-made.

I know that others also had problems like these. Adding something like
Midas is on my todo-list for a long time.

We can try to build the basic blocks you need so that it works for you.
Thereafter we can (maybe that MvC can help) design a structure to make
it more general.

First step is to export the data from a TBufDataset to a stream. See if
you can do that and report back. Do you already use sqldb to obtain your
data?

Joost.


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Paulo Costa
In reply to this post by Marcos Douglas
On 10/02/2011 10:43, Marcos Douglas wrote:

> My problem is:
> A site, coded in (old) ASP, will use a ActiveX app to communicate with
> an app in other server (my future app). This app will execute some
> SELECTs in a DBMS. The result (ResultSet) will be encrypted,
> compressed  and  sent to ActiveX app. This descompress, decrypts and
> save the ResultSet in your own DBMS.

Just a side note:
You should compress first and then encrypt. The encrypted data is hard
to compress so it is better to do the compression first, over the data
that is more amenable to be compressed.

Paulo Costa

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Alexsander Rosa
In reply to this post by Marcos Douglas
I would suggest to do the encryption/decryption in the peers, using plain text (after some plain-text encoding like base64) for the communication. Then you could do a simple SELECT to move the resultset around.

2011/2/9 Marcos Douglas <[hidden email]>
Hi,
If you had to send an encrypted ResultSet between 2 DBMS servers,
using port 80, what libs would you use?
It isn't necessary to use WebServices. Just two applications sending
encrypted packages...

Marcos Douglas

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



--
Atenciosamente,
Alexsander da Rosa
http://rednaxel.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Marcos Douglas
In reply to this post by Joost van der Sluis
On Thu, Feb 10, 2011 at 10:34 AM, Joost van der Sluis <[hidden email]> wrote:
>
> You have to use a webservice by definition. You could use wst, but
> that's overkill. But to be honest: in your case I think it's indeed
> better to use something home-made.

Uau! There is a loooong WST wiki page:
http://wiki.freepascal.org/Web_Service_Toolkit
if you think that's overkill, I following your advice!

> I know that others also had problems like these. Adding something like
> Midas is on my todo-list for a long time.

Very good!

> We can try to build the basic blocks you need so that it works for you.
> Thereafter we can (maybe that MvC can help) design a structure to make
> it more general.

OK. I will work on that in the next week, when the project will be
approved (I wait).

> First step is to export the data from a TBufDataset to a stream. See if
> you can do that and report back. Do you already use sqldb to obtain your
> data?

I have not begun the project.
Sincerely I was thinking to use Delphi 7, because this project have
ActiveX objects. I don't know how is this implementation in the FPC
so... but I wanted do all in FPC, if is possible.

Maybe not be need to use TBufDataset... this project will be coded
with another person, a DBA. I think is better the SP's result return
the SQL instructions (insert table blblabla) to use directly in the
receptor. The app not need to know about these tables.


Marcos Douglas

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

michael.vancanneyt
In reply to this post by Joost van der Sluis


On Thu, 10 Feb 2011, Joost van der Sluis wrote:

>>
>> You think I shouLd use WebService. How is this implementation in FPC,
>> stable or is better do this in Delphi 7? (if I will use WebService).
>
> You have to use a webservice by definition. You could use wst, but
> that's overkill. But to be honest: in your case I think it's indeed
> better to use something home-made.

Well, WST is very easy to use, and is meanwhile fully integratable with fpWeb,
so that should be a real breeze...

> I know that others also had problems like these. Adding something like
> Midas is on my todo-list for a long time.
>
> We can try to build the basic blocks you need so that it works for you.
> Thereafter we can (maybe that MvC can help) design a structure to make
> it more general.

Well, you need a resolver object which basically does what SQLDb already
does. Then you can wrap that object in a webservice (using WST or not).

Michael.

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Send a ResultSet (encrypted) between 2 servers

Michael Schnell
In reply to this post by Paulo Costa
On 02/10/2011 02:50 PM, Paulo Costa wrote:
>
>  The encrypted data is hard to compress
.. and the compressed data is harder  to hack out of the encryption ...

-Michael



--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus