Activada la encriptación DES entre cliente y servidor.
git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@310 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
parent
15e2d8030f
commit
781f67ad43
@ -60,27 +60,27 @@
|
||||
<DelphiCompile Include="ApplicationBase.dpk">
|
||||
<MainSource>MainSource</MainSource>
|
||||
</DelphiCompile>
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\Base.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\dbrtl.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\dclIndyCore.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\designide.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\GUIBase.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\IndyCore.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\IndyProtocols.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\IndySystem.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\JvJansD11R.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\pckMD5.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\pckUCDataConnector.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\pckUserControl_RT.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\PLuginSDK_D10R.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\rtl.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\vcl.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\vclactnband.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\vcldb.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\vcljpg.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\VclSmp.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\vclx.dcp" />
|
||||
<DCCReference Include="..\Modulos\Contactos\Model\xmlrtl.dcp" />
|
||||
<DCCReference Include="..\Base.dcp" />
|
||||
<DCCReference Include="..\dbrtl.dcp" />
|
||||
<DCCReference Include="..\dclIndyCore.dcp" />
|
||||
<DCCReference Include="..\designide.dcp" />
|
||||
<DCCReference Include="..\GUIBase.dcp" />
|
||||
<DCCReference Include="..\IndyCore.dcp" />
|
||||
<DCCReference Include="..\IndyProtocols.dcp" />
|
||||
<DCCReference Include="..\IndySystem.dcp" />
|
||||
<DCCReference Include="..\JvJansD11R.dcp" />
|
||||
<DCCReference Include="..\pckMD5.dcp" />
|
||||
<DCCReference Include="..\pckUCDataConnector.dcp" />
|
||||
<DCCReference Include="..\pckUserControl_RT.dcp" />
|
||||
<DCCReference Include="..\PLuginSDK_D10R.dcp" />
|
||||
<DCCReference Include="..\rtl.dcp" />
|
||||
<DCCReference Include="..\vcl.dcp" />
|
||||
<DCCReference Include="..\vclactnband.dcp" />
|
||||
<DCCReference Include="..\vcldb.dcp" />
|
||||
<DCCReference Include="..\vcljpg.dcp" />
|
||||
<DCCReference Include="..\VclSmp.dcp" />
|
||||
<DCCReference Include="..\vclx.dcp" />
|
||||
<DCCReference Include="..\xmlrtl.dcp" />
|
||||
<DCCReference Include="Empresas\Controller\uDatosBancariosEmpresaController.pas" />
|
||||
<DCCReference Include="Empresas\Controller\uEmpresasController.pas" />
|
||||
<DCCReference Include="Empresas\Controller\View\uIEditorDatosBancarioEmpresa.pas" />
|
||||
|
||||
Binary file not shown.
@ -14,7 +14,6 @@ object fConfigurarConexion: TfConfigurarConexion
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
Scaled = False
|
||||
OnCreate = FormCreate
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object bProbar: TButton
|
||||
@ -90,23 +89,4 @@ object fConfigurarConexion: TfConfigurarConexion
|
||||
ModalResult = 2
|
||||
TabOrder = 3
|
||||
end
|
||||
object HTTPChannel: TROWinInetHTTPChannel
|
||||
UserAgent = 'AdminPV'
|
||||
TargetURL = 'http://localhost:8099/BIN'
|
||||
ServerLocators = <>
|
||||
DispatchOptions = []
|
||||
Left = 120
|
||||
Top = 112
|
||||
end
|
||||
object ROBinMessage: TROBinMessage
|
||||
Left = 152
|
||||
Top = 112
|
||||
end
|
||||
object CoService: TRORemoteService
|
||||
Message = ROBinMessage
|
||||
Channel = HTTPChannel
|
||||
ServiceName = 'srvLogin'
|
||||
Left = 184
|
||||
Top = 112
|
||||
end
|
||||
end
|
||||
|
||||
@ -17,11 +17,7 @@ type
|
||||
edtPort: TEdit;
|
||||
bAceptar: TButton;
|
||||
bCancelar: TButton;
|
||||
HTTPChannel: TROWinInetHTTPChannel;
|
||||
ROBinMessage: TROBinMessage;
|
||||
CoService: TRORemoteService;
|
||||
procedure bProbarClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
function GetTargetURL: String;
|
||||
procedure SetTargetURL(const Value: String);
|
||||
@ -68,9 +64,4 @@ begin
|
||||
ShowErrorMessage('Error de conexión', 'No se ha podido establecer la conexión con el servidor.')
|
||||
end;
|
||||
|
||||
procedure TfConfigurarConexion.FormCreate(Sender: TObject);
|
||||
begin
|
||||
HTTPChannel.OnFailure := dmConexion.ROChannelFailure;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
@ -1,23 +1,28 @@
|
||||
object dmConexion: TdmConexion
|
||||
OldCreateOrder = False
|
||||
OnCreate = DataModuleCreate
|
||||
OnDestroy = DataModuleDestroy
|
||||
Height = 177
|
||||
Width = 121
|
||||
object ROChannel: TROWinInetHTTPChannel
|
||||
OnFailure = ROChannelFailure
|
||||
OnException = ROChannelFailure
|
||||
UserAgent = 'RemObjects SDK'
|
||||
TargetURL = 'http://localhost:8099/bin'
|
||||
Login.Username = 'Tecsitel'
|
||||
Login.Password = '1'
|
||||
KeepConnection = True
|
||||
ServerLocators = <>
|
||||
DispatchOptions = []
|
||||
Left = 42
|
||||
Top = 16
|
||||
end
|
||||
Width = 265
|
||||
object ROMessage: TROBinMessage
|
||||
Left = 42
|
||||
Top = 88
|
||||
end
|
||||
object ROChannel: TROIndyHTTPChannel
|
||||
OnFailure = ROChannelFailure
|
||||
OnException = ROChannelFailure
|
||||
ServerLocators = <>
|
||||
DispatchOptions = []
|
||||
IndyClient.AllowCookies = True
|
||||
IndyClient.ProxyParams.BasicAuthentication = False
|
||||
IndyClient.ProxyParams.ProxyPort = 0
|
||||
IndyClient.Request.ContentLength = -1
|
||||
IndyClient.Request.Accept = 'text/html, */*'
|
||||
IndyClient.Request.BasicAuthentication = False
|
||||
IndyClient.Request.UserAgent = 'RemObjects SDK'
|
||||
IndyClient.HTTPOptions = [hoForceEncodeParams]
|
||||
TargetURL = 'http://localhost:8099/bin'
|
||||
Left = 40
|
||||
Top = 16
|
||||
end
|
||||
end
|
||||
|
||||
@ -4,30 +4,32 @@ interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, uRORemoteService, uDADataTable,
|
||||
uDABINAdapter, uROClient, uROBinMessage, uROWinInetHttpChannel,
|
||||
uDADataStreamer;
|
||||
uDABINAdapter, uROClient, uROBinMessage,
|
||||
uDADataStreamer, uROIndyTCPChannel, uROIndyHTTPChannel;
|
||||
|
||||
const
|
||||
SERVER_URL = 'http://localhost:8099/bin'; // Dirección por defecto del servidor
|
||||
|
||||
|
||||
type
|
||||
TdmConexion = class(TDataModule)
|
||||
ROChannel: TROWinInetHTTPChannel;
|
||||
ROMessage: TROBinMessage;
|
||||
procedure ROChannelFailure(Sender: TROTransportChannel;
|
||||
anException: Exception; var Retry: Boolean);
|
||||
ROChannel: TROIndyHTTPChannel;
|
||||
procedure DataModuleDestroy(Sender: TObject);
|
||||
procedure ROChannelFailure(Sender: TROTransportChannel;
|
||||
anException: Exception; var aRetry: Boolean);
|
||||
procedure DataModuleCreate(Sender: TObject);
|
||||
private
|
||||
function GetChannel: TROWinInetHTTPChannel;
|
||||
function GetChannel: TROTransportChannel;
|
||||
function GetMessage: TROBinMessage;
|
||||
function GetTargetURL: String;
|
||||
procedure SetTargetURL(const Value: String);
|
||||
procedure ConfigurarEncriptacionConexion;
|
||||
public
|
||||
function HayConexion : Boolean;
|
||||
function ProbarConexion(const ATargetURL : String): Boolean;
|
||||
procedure ConfigurarConexion;
|
||||
property TargetURL : String read GetTargetURL write SetTargetURL;
|
||||
property Channel: TROWinInetHTTPChannel read GetChannel;
|
||||
property Channel: TROTransportChannel read GetChannel;
|
||||
property Message: TROBinMessage read GetMessage;
|
||||
end;
|
||||
|
||||
@ -39,15 +41,16 @@ implementation
|
||||
{$R *.dfm}
|
||||
|
||||
uses
|
||||
Windows, WinInet, cxControls, uConfigurarConexion, Dialogs, Controls,
|
||||
uROEncryption, Windows, WinInet, cxControls, uConfigurarConexion, Dialogs, Controls,
|
||||
uDMBase, FactuGES_Intf;
|
||||
|
||||
const
|
||||
IE_OFFLINE_ERROR = 'Unexpected error in WinInet HTTP Channel (2)';
|
||||
|
||||
|
||||
function TdmConexion.HayConexion: Boolean;
|
||||
begin
|
||||
Result := ROChannel.Connected;
|
||||
Result := ROChannel.IndyClient.Connected;
|
||||
end;
|
||||
|
||||
procedure TdmConexion.ConfigurarConexion;
|
||||
@ -58,8 +61,8 @@ begin
|
||||
if ShowModal = mrOk then
|
||||
begin
|
||||
ROChannel.TargetURL := TargetURL;
|
||||
ROChannel.Connected := False;
|
||||
ROChannel.Connected := True;
|
||||
ROChannel.IndyClient.Disconnect;
|
||||
ROChannel.IndyClient.Connect;
|
||||
dmBase.SalvarConfiguracion;
|
||||
end;
|
||||
finally
|
||||
@ -67,12 +70,28 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TdmConexion.DataModuleDestroy(Sender: TObject);
|
||||
procedure TdmConexion.ConfigurarEncriptacionConexion;
|
||||
begin
|
||||
ROChannel.Connected := False;
|
||||
with ROChannel.Encryption do
|
||||
begin
|
||||
EncryptionMethod := tetDES;
|
||||
EncryptionSendKey := '127C1A6A4D85F5EFE0A54E104BF7F695CD6C989C1808A57667EF1218E8ED93FC6CDC531631EB9750';
|
||||
EncryptionRecvKey := 'C793F1A04FFC8DF91FF9522951F6B6DF921C70B42D74166C6DF0B697797AAA6A243BEC35A9423A51';
|
||||
UseCompression := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TdmConexion.GetChannel: TROWinInetHTTPChannel;
|
||||
procedure TdmConexion.DataModuleCreate(Sender: TObject);
|
||||
begin
|
||||
ConfigurarEncriptacionConexion;
|
||||
end;
|
||||
|
||||
procedure TdmConexion.DataModuleDestroy(Sender: TObject);
|
||||
begin
|
||||
ROChannel.IndyClient.Disconnect;
|
||||
end;
|
||||
|
||||
function TdmConexion.GetChannel: TROTransportChannel;
|
||||
begin
|
||||
Result := ROChannel;
|
||||
end;
|
||||
@ -89,45 +108,45 @@ end;
|
||||
|
||||
function TdmConexion.ProbarConexion(const ATargetURL: String): Boolean;
|
||||
var
|
||||
AHTTPChannel: TROWinInetHTTPChannel;
|
||||
AHTTPChannel: TROIndyHTTPChannel;
|
||||
AROBinMessage: TROBinMessage;
|
||||
ACoService: TRORemoteService;
|
||||
begin
|
||||
if ATargetURL = '' then
|
||||
raise Exception.Create('No se ha indicado la URL del servidor (HayConexion)');
|
||||
|
||||
AHTTPChannel := TROWinInetHTTPChannel.Create(Self);
|
||||
AHTTPChannel := TROIndyHTTPChannel.Create(Self);
|
||||
AROBinMessage := TROBinMessage.Create(Self);
|
||||
ACoService := TRORemoteService.Create(Self);
|
||||
|
||||
ShowHourglassCursor;
|
||||
try
|
||||
AROBinMessage.Assign(ROMessage);
|
||||
|
||||
AHTTPChannel.Assign(ROChannel);
|
||||
with AHTTPChannel do
|
||||
begin
|
||||
Name := 'HTTPChannel';
|
||||
|
||||
if Length(ATargetURL) > 0 then
|
||||
TargetURL := ATargetURL
|
||||
else
|
||||
TargetURL := ROChannel.TargetURL;
|
||||
end;
|
||||
if AHTTPChannel.Encryption.EncryptionMethod <> tetNone then
|
||||
ShowMessage('funcionando');
|
||||
|
||||
with ACoService do
|
||||
begin
|
||||
ServiceName := 'srvLogin';
|
||||
ACoService.Message := AROBinMessage;
|
||||
Channel := AHTTPChannel;
|
||||
end;
|
||||
ACoService.ServiceName := 'srvLogin';
|
||||
ACoService.Message := AROBinMessage;
|
||||
ACoService.Channel := AHTTPChannel;
|
||||
|
||||
try
|
||||
AHTTPChannel.Connected := True;
|
||||
(ACoService as IsrvLogin).Ping;
|
||||
AHTTPChannel.Connected := False;
|
||||
Result := True;
|
||||
except
|
||||
Result := False;
|
||||
end;
|
||||
finally
|
||||
AHTTPChannel.Connected := False;
|
||||
FreeAndNil(AHTTPChannel);
|
||||
FreeAndNil(ACoService);
|
||||
FreeAndNil(AROBinMessage);
|
||||
@ -136,13 +155,13 @@ begin
|
||||
end;
|
||||
|
||||
procedure TdmConexion.ROChannelFailure(Sender: TROTransportChannel;
|
||||
anException: Exception; var Retry: Boolean);
|
||||
anException: Exception; var aRetry: Boolean);
|
||||
begin
|
||||
if (Pos(anException.Message, IE_OFFLINE_ERROR) > 0) then
|
||||
begin
|
||||
// Preguntar al usuario si se quiere conectar
|
||||
if InternetGoOnline(PAnsiChar(ROChannel.TargetURL), GetDesktopWindow(), 0) then
|
||||
Retry := True // Si el usuario pulsa en 'Conectar' reintentar la operación
|
||||
aRetry := True // Si el usuario pulsa en 'Conectar' reintentar la operación
|
||||
else
|
||||
Abort; // Si el usuario pulsa en 'Seguir desconectado' parar todo
|
||||
end
|
||||
|
||||
@ -1,27 +1,10 @@
|
||||
object dmConfiguracion: TdmConfiguracion
|
||||
OldCreateOrder = False
|
||||
Height = 160
|
||||
Width = 220
|
||||
object ROChannel: TROWinInetHTTPChannel
|
||||
UserAgent = 'RemObjects SDK'
|
||||
TargetURL = 'http://localhost:8099/bin'
|
||||
Login.Username = '123456'
|
||||
Login.Password = 'sa'
|
||||
KeepConnection = True
|
||||
ServerLocators = <>
|
||||
DispatchOptions = []
|
||||
Left = 42
|
||||
Top = 16
|
||||
end
|
||||
object ROMessage: TROBinMessage
|
||||
Left = 42
|
||||
Top = 88
|
||||
end
|
||||
Width = 100
|
||||
object RORemoteService: TRORemoteService
|
||||
Message = ROMessage
|
||||
Channel = ROChannel
|
||||
ServiceName = 'srvConfiguracion'
|
||||
Left = 136
|
||||
Left = 24
|
||||
Top = 16
|
||||
end
|
||||
end
|
||||
|
||||
@ -4,7 +4,7 @@ interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, uRORemoteService, uDADataTable,
|
||||
uDABINAdapter, uROClient, uROBinMessage, uROWinInetHttpChannel, IniFiles,
|
||||
uDABINAdapter, uROClient, IniFiles,
|
||||
uDADataStreamer;
|
||||
|
||||
const
|
||||
@ -12,8 +12,6 @@ const
|
||||
|
||||
type
|
||||
TdmConfiguracion = class(TDataModule)
|
||||
ROChannel: TROWinInetHTTPChannel;
|
||||
ROMessage: TROBinMessage;
|
||||
RORemoteService: TRORemoteService;
|
||||
private
|
||||
FIniFile : TIniFile;
|
||||
@ -46,6 +44,8 @@ end;
|
||||
|
||||
function TdmConfiguracion.DarValor(const CODIGO: String): Variant;
|
||||
begin
|
||||
RORemoteService.Channel := dmConexion.ROChannel;
|
||||
RORemoteService.Message := dmConexion.ROMessage;
|
||||
Result := (RORemoteService as IsrvConfiguracion).DarValor(CODIGO);
|
||||
end;
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ object dmServer: TdmServer
|
||||
Height = 307
|
||||
Width = 382
|
||||
object HTTPServer: TROIndyHTTPServer
|
||||
Encryption.EncryptionMethod = tetBlowfish
|
||||
Encryption.UseCompression = True
|
||||
Dispatchers = <
|
||||
item
|
||||
@ -73,7 +74,7 @@ object dmServer: TdmServer
|
||||
Top = 144
|
||||
end
|
||||
object DAIBXDriver: TDAIBXDriver
|
||||
Left = 232
|
||||
Left = 224
|
||||
Top = 80
|
||||
end
|
||||
end
|
||||
|
||||
@ -72,7 +72,7 @@ implementation
|
||||
{$R *.dfm}
|
||||
|
||||
uses
|
||||
DateUtils, JclFileUtils, ActiveX, Forms, Registry, Windows, Dialogs,
|
||||
uROEncryption, DateUtils, JclFileUtils, ActiveX, Forms, Registry, Windows, Dialogs,
|
||||
ExtCtrls, uSesionesUtils, uServerAppUtils;
|
||||
|
||||
function DarRutaInformes : String;
|
||||
@ -292,6 +292,13 @@ end;
|
||||
procedure TdmServer.HTTPServerBeforeServerActivate(Sender: TObject);
|
||||
begin
|
||||
HTTPServer.Port := StrToInt(FServerPort);
|
||||
with HTTPServer.Encryption do
|
||||
begin
|
||||
EncryptionMethod := tetDES;
|
||||
EncryptionSendKey := 'C793F1A04FFC8DF91FF9522951F6B6DF921C70B42D74166C6DF0B697797AAA6A243BEC35A9423A51';
|
||||
EncryptionRecvKey := '127C1A6A4D85F5EFE0A54E104BF7F695CD6C989C1808A57667EF1218E8ED93FC6CDC531631EB9750';
|
||||
UseCompression := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user