Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 28-06-2017
richihu richihu is offline
Registrado
NULL
 
Registrado: jun 2014
Posts: 5
Poder: 0
richihu Va por buen camino
Thumbs up SOS "Error en el soporte del canal seguro"

Hola a todos,

He revisado todos los posts y he probado a cargar un certificado válido con CAPICOM en el OnBeforePost del HTTPRIO pero me sige dando el error, por favro si alguien se le ocurre algo...Gracias!

procedure TfrmMain.HTTPReqResp1BeforePost(const HTTPReqResp: THTTPReqResp; Data: Pointer);
var
FCertificatesList: TInterfaceList;
i, j: Integer;
Store: ICertificates;
Certificate: ICertificate2;

ExtProperty: IExtendedProperty;

PCertContext : PCCERT_CONTEXT;
CertContext : ICertContext;
stAux: String;

CertsUtils: TUtilities;
begin
inherited;


FCertificatesList := TInterfaceList.Create();

//CAPICOM_LOCAL_MACHINE_STORE
Store1.Open(CAPICOM_CURRENT_USER_STORE, 'My', CAPICOM_STORE_OPEN_READ_ONLY); //CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED or CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED or CAPICOM_STORE_OPEN_EXISTING_ONLY

Store := Store1.Certificates;

try
CertsUtils := TUtilities.Create(Self);

for I := 1 to Store1.Certificates.Count do
begin
Certificate := IInterface(Store.Item[i]) as ICertificate2;

Certificate.GetInfo(CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME);
// dtcCerts.Values[i-1, 1] := Certificate.GetInfo(CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME);
// dtcCerts.Values[i-1, 2] := Certificate.ValidToDate;

stAux := '';
for j := 1 to Certificate.ExtendedProperties.Count do
begin
ExtProperty := IInterface(Certificate.ExtendedProperties.Item[j]) as IExtendedProperty;
if ExtProperty.PropID = CAPICOM_PROPID_FRIENDLY_NAME then
begin
stAux := CertsUtils.BinaryStringToByteArray(ExtProperty.Value[CAPICOM_ENCODE_BINARY]);
break;
end;
end;

stAux := Certificate.SerialNumber;

// Cargo certificado válido
if Certificate.SerialNumber = '2C2DBEE53ACFD8965809C4707F55FE28' then
begin
CertContext:= Certificate as ICertContext;
CertContext.Get_CertContext(Integer(PCertContext));

// Por aquí pasa y no devuelve error pero aún así...
if InternetSetOption(Data, INTERNET_OPTION_CLIENT_CERT_CONTEXT, PCertContext, Sizeof(CERT_CONTEXT))= False then
ShowMessage('Error en InternetSetOption');
end;

FCertificatesList.Add(Certificate);
end;

finally
// dtcCerts.EndUpdate();
CertsUtils.Free();
end;
Responder Con Cita
  #2  
Antiguo 28-06-2017
Avatar de newtron
[newtron] newtron is offline
Membrillo Premium
 
Registrado: abr 2007
Ubicación: Motril, Granada
Posts: 3.471
Poder: 21
newtron Va camino a la fama
Cita:
Empezado por richihu Ver Mensaje
Hola a todos,

He revisado todos los posts y he probado a cargar un certificado válido con CAPICOM en el OnBeforePost del HTTPRIO pero me sige dando el error, por favro si alguien se le ocurre algo...Gracias!

procedure TfrmMain.HTTPReqResp1BeforePost(const HTTPReqResp: THTTPReqResp; Data: Pointer);
var
FCertificatesList: TInterfaceList;
i, j: Integer;
Store: ICertificates;
Certificate: ICertificate2;

ExtProperty: IExtendedProperty;

PCertContext : PCCERT_CONTEXT;
CertContext : ICertContext;
stAux: String;

CertsUtils: TUtilities;
begin
inherited;


FCertificatesList := TInterfaceList.Create();

//CAPICOM_LOCAL_MACHINE_STORE
Store1.Open(CAPICOM_CURRENT_USER_STORE, 'My', CAPICOM_STORE_OPEN_READ_ONLY); //CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED or CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED or CAPICOM_STORE_OPEN_EXISTING_ONLY

Store := Store1.Certificates;

try
CertsUtils := TUtilities.Create(Self);

for I := 1 to Store1.Certificates.Count do
begin
Certificate := IInterface(Store.Item[i]) as ICertificate2;

Certificate.GetInfo(CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME);
// dtcCerts.Values[i-1, 1] := Certificate.GetInfo(CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME);
// dtcCerts.Values[i-1, 2] := Certificate.ValidToDate;

stAux := '';
for j := 1 to Certificate.ExtendedProperties.Count do
begin
ExtProperty := IInterface(Certificate.ExtendedProperties.Item[j]) as IExtendedProperty;
if ExtProperty.PropID = CAPICOM_PROPID_FRIENDLY_NAME then
begin
stAux := CertsUtils.BinaryStringToByteArray(ExtProperty.Value[CAPICOM_ENCODE_BINARY]);
break;
end;
end;

stAux := Certificate.SerialNumber;

// Cargo certificado válido
if Certificate.SerialNumber = '2C2DBEE53ACFD8965809C4707F55FE28' then
begin
CertContext:= Certificate as ICertContext;
CertContext.Get_CertContext(Integer(PCertContext));

// Por aquí pasa y no devuelve error pero aún así...
if InternetSetOption(Data, INTERNET_OPTION_CLIENT_CERT_CONTEXT, PCertContext, Sizeof(CERT_CONTEXT))= False then
ShowMessage('Error en InternetSetOption');
end;

FCertificatesList.Add(Certificate);
end;

finally
// dtcCerts.EndUpdate();
CertsUtils.Free();
end;
Mira en el post que hay justo anterior al tuyo.
__________________
Be water my friend.
Responder Con Cita
  #3  
Antiguo 28-06-2017
richihu richihu is offline
Registrado
NULL
 
Registrado: jun 2014
Posts: 5
Poder: 0
richihu Va por buen camino
Revisado pero...me sigue dando el mismo error

Hola, lo primero muchísimas gracias por la respuesta. No obstante, me tiene bastante mosqueado, he probado a cambiar números de serie y el error que devuelve es que hace falta un certificado válido, es decir, el context y el número de serie se informan bien (depurando está todo correctamente informado) pero por lo que sea sigue dando el mismo error, los certificados con los que he probado son de la FNMT y están operativos porque los uso en real, son los que uso para firma de Facturae...Estoy usando XE7 con Windows 8.1 ¿alguna idea?

Gracias de antemano.
Responder Con Cita
  #4  
Antiguo 28-06-2017
richihu richihu is offline
Registrado
NULL
 
Registrado: jun 2014
Posts: 5
Poder: 0
richihu Va por buen camino
Revisado pero...me sigue dando el mismo error

Cita:
Empezado por newtron Ver Mensaje
Mira en el post que hay justo anterior al tuyo.
Hola, lo primero muchísimas gracias por la respuesta. No obstante, me tiene bastante mosqueado, he probado a cambiar números de serie y el error que devuelve es que hace falta un certificado válido, es decir, el context y el número de serie se informan bien (depurando está todo correctamente informado) pero por lo que sea sigue dando el mismo error, los certificados con los que he probado son de la FNMT y están operativos porque los uso en real, son los que uso para firma de Facturae...Estoy usando XE7 con Windows 8.1 ¿alguna idea?

Gracias de antemano.
Responder Con Cita
  #5  
Antiguo 03-07-2017
josecarrillo josecarrillo is offline
Miembro
 
Registrado: may 2014
Posts: 13
Poder: 0
josecarrillo Va por buen camino
Yo ademas de capicom tube que instalar el configurador de hacienda(Configurador_FNMT_RCM.exe)
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
TICKET BAI (TicketBAI); Nuevo sistema de la Agencia Tributaria del Pais Vasco keys Internet 4170 Hace 1 Semana 17:29:05
AEAT envio de datos vía Webservice problemas con WSDL CelsoO Internet 11 09-10-2019 20:03:41
webService Soap de la Administración Digital Española notific@ apicito Internet 3 31-01-2017 11:25:28
Error en Webservice funcion envio de sms webmasterplc Delphi para la web 5 25-07-2013 20:10:29
Problemas con envío de XML a un WebService davidvamo Internet 1 13-02-2007 15:49:20


La franja horaria es GMT +2. Ahora son las 03:30:03.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi