Estan disponibles en la página:
http://www.aduanas.gob.mx/aduana_mex...144_10186.html
Viene documentado el uso de la .dll, pero falta ver si es lo mismo, aunque al ser un formato de archivo diferente puede que no funcione.
Si decides probarlo el código para usar la .dll es el siguiente:
Código:
// hay que declarar al principio de tu unidad
type
PCURP = ^TCURP;
TCURP = record
curp: array[0..18] of char;
archivoKey: array[0..255] of char;
archivoCer: array[0..255] of char;
password: array[0..18] of char
end;
// Declaras las funciones
{$R *.DFM}
function BuscaCurpsG(const archivoOrig:pchar; const tipo:Integer; struct_curps_g:PCURP):Integer; stdcall;
external 'sgenc32.dll' name '_BuscaCurpsG_std@12';
function GeneraFirmaDigitalG(const archivoOrig:pchar; const tipo:Integer; struct_curps_g:PCURP):Integer; stdcall;
external 'sgenc32.dll' name '_GeneraFirmaDigitalG_std@12';
// Este es el boton que ejecuta la firma
procedure TFrmConfig.btnFirmarClick(Sender: TObject);
var
archivo: array [0..250] of Char;
PReg: PCURP;
Arch, Er:Integer;
begin
StrPCopy(archivo,FieldByName('Ruta').AsString+'\'+'m'+Patente+StrZero(Arch,3)+'.'+StrZero(DayOfTheYear(Date),3));
GetMem(PReg, SizeOf(TCURP) * 10);
Er:=BuscaCurpsG(archivo, 0, PReg);
StrPCopy(PReg.archivoKey,ArchivoKey);
StrPCopy(PReg.archivoCer,ArchivoCer);
StrPCopy(Preg.password,Clave);
Er:=GeneraFirmaDigitalG(archivo, 0, PReg);
if Er=0 then
Mensaje('Se ha firmado correctamente el archivo: '+archivo,'Firma exitosa',mb_Ok)
else
MensajeError('Error al procesar la Firma: '+IntToStr(Er),'Error');
end;
Las variables usadas son:
archivo ruta y nombre del archivo a firmar
ArchivoKey Ruta y nombre del archivo con extensión .key
ArchivoCer Ruta y nombre del archivo con extensión .cer
Clave Password para la firma