#1 2014-08-29 12:59:12

sjerinic
Member
Registered: 2013-02-11
Posts: 51

Questions about CrossPlatform

Hello AB!

1. Is it possible to use Interface functions on Client CrossPlatform side (CodeTyphon)? For example, on the server side I defined the interface with functions:

  IRemoteServerStandard = interface(IInvokable)
    ['{FFFF753E-F6BB-4F60-B54D-9D3CA3961B87}']
    function GetLoginData(username: RawUTF8; password: RawUTF8): RawJSON;
    function SetAgencyInfo( id: int64; ipAddress: RawUTF8): boolean;
   ....

How can I call this function on the client side?

2. Is it possible to encrypt the connection as in Win version?

      FClientStandard := TSQLHttpClient.Create(AnsiString(FIniData.WebAddress), AnsiString(IntToStr(FIniData.Port)), FModelStandard);
      FClientStandard.Compression := [hcSynShaAes];
      SynCrypto.CompressShaAesSetKey(RawByteString(c_CrKey));

Offline

#2 2014-08-29 13:34:30

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Questions about CrossPlatform

1. Yes, you can, using a generated wrapper unit on FPC - in fact, we used CodeTyphon for our FPC tests.
See http://blog.synopse.info/post/2014/08/1 … FreePascal

2. Our proprietary hcSynShaAes encryption is not part of the SynCrossPlatform units yet.
You would have to use https instead.

Offline

#3 2014-08-30 17:07:03

sjerinic
Member
Registered: 2013-02-11
Posts: 51

Re: Questions about CrossPlatform

Thanks for information. Generated wrapper works very well.

When you said: "Our proprietary hcSynShaAes encryption is not part of the SynCrossPlatform units yet" are you talking about days, weeks, months or ...?

Offline

#4 2014-08-30 17:13:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Questions about CrossPlatform

It is not planned...
Worth a feature request ticket.

Could make sense definitively with a FPC or Delphi client.
Perhaps less with SMS clients - implementing SynLZ and AES in SMS would be more work, due to missing support of pointers.
Which kind of clients are you using?

Offline

#5 2014-08-30 17:55:44

sjerinic
Member
Registered: 2013-02-11
Posts: 51

Re: Questions about CrossPlatform

Now I need to make one app in version on Fedora 11 and I have chosen FPC (CodeTypeon or Lazarus). Server and Windows clients use your encryption and I am very pleased with how it all works. It would be best if I could use the existing server.

Offline

#6 2014-08-30 19:00:26

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Questions about CrossPlatform

You can use the existing server as is.
In fact, hcSynShaAes encryption is optional: both ends have to support it.
If the client does not support it, the server won't ask for hcSynShaAes encryption, and use plain (or deflated) transmission instead.
The same server is able to server unencrypted FPC clients under Linux, and encrypted Delphi clients under Windows, at the same time.

Offline

#7 2014-08-30 19:41:20

sjerinic
Member
Registered: 2013-02-11
Posts: 51

Re: Questions about CrossPlatform

That's great, but I think that encryption will be also great for FPC and Delphi clients.

Offline

#8 2014-08-30 19:58:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Questions about CrossPlatform

OK, it does make sense!

Could you please create a feature request ticket?

Offline

#9 2014-08-30 20:22:17

sjerinic
Member
Registered: 2013-02-11
Posts: 51

Re: Questions about CrossPlatform

Thanks, I will!

Also, with mORMotClient.pas for FPC made from wrapper I get an error in function GetClient: mormotclient.pas(137,27) Error: Identifier not found "TSQLRestServerAuthenticationSSPI",
and for every service function which return RawJSON data type from server side in mORMotClient.pas I have error: mormotclient.pas(41,76) Error: Identifier not found "dynamic".

Offline

#10 2014-08-30 20:34:09

sjerinic
Member
Registered: 2013-02-11
Posts: 51

Re: Questions about CrossPlatform

Ticket UUID: 464bed6e1ccdb006e1415737740806e77bbd0aa4
Ticket Title: Encryption in the SynCrossPlatform units

Thank you, again.

Offline

#11 2014-08-30 21:01:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Questions about CrossPlatform

TSQLRestServerAuthenticationSSPI is not implemented for SynCrossPlatform: this is a Windows specific feature.

Offline

#12 2014-08-30 21:27:52

sjerinic
Member
Registered: 2013-02-11
Posts: 51

Re: Questions about CrossPlatform

Well, then it's a bug in the FPC Wrapper?

Look, how looks a function:

function GetClient(const aServerAddress, aUserName,aPassword: string;
  aServerPort: integer): TSQLRestClientHTTP;
begin
  result := TSQLRestClientHTTP.Create(aServerAddress,aServerPort,GetModel,true); // aOwnModel=true
  try
    if (not result.Connect) or (result.ServerTimeStamp=0) then
      raise ERestException.CreateFmt('Impossible to connect to %s:%d server',
        [aServerAddress,aServerPort]);
    if not result.SetUser(TSQLRestServerAuthenticationSSPI,aUserName,aPassword) then 
      raise ERestException.CreateFmt('%s:%d server rejected "%s" credentials',
        [aServerAddress,aServerPort,aUserName]);
  except
    result.Free;
    raise;
  end;
end;

It is minor bug because user can delete that function and connect manual.

What is with the error regarding "dynamic"?

Offline

#13 2014-08-31 07:56:55

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Questions about CrossPlatform

By default, it will use the first registered scheme available in TSQLRestServer.AuthenticationSchemes[].
So I guess that in your particular case, TSQLRestServerAuthenticationSSPI is the first registered authentication class.

I've modified mORMotWrapper so that it would include the first of the only supported types (i.e. TSQLRestServerAuthenticationDefault / TSQLRestServerAuthenticationNone) for the cross-platform clients.
See http://synopse.info/fossil/info/e6c4ac70d7

Offline

#14 2014-08-31 22:29:28

sjerinic
Member
Registered: 2013-02-11
Posts: 51

Re: Questions about CrossPlatform

Thanks, I'll check after solve another compilation problem.

For example, on server function definition is:
    function GetLoginData(username: RawUTF8; password: RawUTF8): RawJSON;

For FPC the Wrapper makes:
    function GetLoginData(const username: string; const password: string): dynamic;

and CodeTypon compiler says:
    mormotclient.pas(41,76) Error: Identifier not found "dynamic"

Offline

#15 2014-09-01 07:24:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Questions about CrossPlatform

I've fixed unexpected "dynamic" parameter type for cross-plaform code generation of "RawJSON" original type: replaced by "variant".
See http://synopse.info/fossil/info/d229bce602
In fact, this was a typo: "dynamic" was for C# wrappers, not pascal wrappers.

But RawJSON has not been fully tested for cross-plaform.
Please report here any issue.
Under FPC/CrossPlatformDelphi, the "variant" type will be a TJSONVariant instance - use function JSONVariantDataSafe() if you want to access directly the internal fields, e.g. arrays items.

Offline

#16 2014-09-01 20:11:17

sjerinic
Member
Registered: 2013-02-11
Posts: 51

Re: Questions about CrossPlatform

Thank you, again!

I'd be glad to help. I have to make FPC client that works with around thirty service functions, and I hope it will be a good test.

Offline

#17 2014-11-29 14:17:54

sjerinic
Member
Registered: 2013-02-11
Posts: 51

Re: Questions about CrossPlatform

Hello AB!

Do you have idea/plan when the encryption for FPC to be available?

Offline

#18 2014-11-29 15:10:36

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Questions about CrossPlatform

At which level?
Our proprietary SQLite3 database file encryption works on FPC + Windows/Linux, if you use our statically compiled .o files.

Or are you speaking about transmission encryption for clients?

Offline

#19 2014-11-30 18:32:54

sjerinic
Member
Registered: 2013-02-11
Posts: 51

Re: Questions about CrossPlatform

Yes, in transmission encryption between client and server.
Something like in Windows version: "FClientStandard.Compression := [hcSynShaAes];"

Ticket UUID: 464bed6e1ccdb006e1415737740806e77bbd0aa4

Offline

Board footer

Powered by FluxBB