Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #4  
Antiguo 28-12-2016
shoulder shoulder is offline
Miembro
 
Registrado: abr 2008
Posts: 441
Poder: 19
shoulder Va por buen camino
secureblackbox

Gracias, pregunte en el foro de Secureblackbox no saben porque el delphi me esta reteniendo en algun lugar de memoria la clave de la tarjeta, aunque cierre el form de firmado y no cierre el prg principal, como dije anteriormente no me queda a lo que entiendo mucho que probar en cuanto al "close sin intervension del usuario" les paso resumido el ejemplo que trae secureblackbox que aplico y agregue algunas lineas de comando.

Código Delphi [-]
procedure TfrmMain.btnOKClick(Sender: TObject);
var
  TempPath : string;
  Success : boolean;
  F, CertF : TFileStream;
  Index : integer;
  Sig : TElPDFSignature;
  CertFormat : TSBCertFileFormat;
  Cert : TElX509Certificate;
  SimpleFont: TElPDFSimpleFont;
begin
  // creating a temporary file copy
  TempPath := GenerateTempFilename;
  if not CopyFile(PChar(editSource.Text), PChar(TempPath), false) then
  begin
    MessageDlg('Failed to create a temporary file', mtError, [mbOk], 0);
    Exit;
  end;
  // opening the temporary file
  Success := false;
  F := TFileStream.Create(TempPath, fmOpenReadWrite or fmShareDenyWrite);
  try
    try
      // opening the document
      Document.Open(F);
      try
        // checking if the document is already encrypted
        if Document.Encrypted then
        begin
          MessageDlg('Cannot sign the encrypted document', mtError, [mbOk], 0);
          Exit;
        end;
        // adding the signature and setting up property values
        Index := Document.AddSignature;
       Sig := Document.Signatures[Index];
       Sig.Handler := PublicKeyHandler;
       Sig.AuthorName := {$ifndef UNICODE}MultiByteToUTF8{$endif}(editAuthorName.Text);
       Sig.SigningTime := LocalTimeToUTCTime(Now);


       Sig.WidgetProps.HideDefaultText := true;
       Sig.WidgetProps.AutoPos:= false;
       Sig.WidgetProps.AutoSize:= false;
       Sig.WidgetProps.AutoFontSize := False;
       Sig.WidgetProps.OffsetX:= strtoint(edit1.Text);
       Sig.WidgetProps.OffsetY:= strtoint(edit2.Text);     
       Sig.WidgetProps.BackgroundStyle   := pbsCustom;
       Sig.WidgetProps.CustomText.Add('.......i.', 55, 41, 8);
       sig.Page := 1;
       sig.WidgetProps.Print := true;

            // retrieving signing certificate
        CertStorage.Clear;
        PublicKeyHandler.SignatureType := pstPKCS7SHA1;
        Cert := WinCertStorage.Certificates[comboCertificate.ItemIndex];
        CertStorage.Add(Cert);
          PublicKeyHandler.SignatureType := pstPKCS7SHA1;

        PublicKeyHandler.CertStorage := CertStorage;
        PublicKeyHandler.CustomName := 'Adobe.PPKMS';



        // allowing to save the document
        Success := true;
      finally
        // closing the document
        Document.Close(Success);
      end;
    finally
      FreeAndNil(F);
    end;
  except
    on E : Exception do
    begin
      MessageDlg('Error: ' + E.Message, mtError, [mbOk], 0);
      Success := false;
    end;
  end;
  // if signing process succeeded, moving the temporary file to the place
  // of destination file
  if Success then
  begin
    if not CopyFile(PChar(TempPath), PChar(editDest.Text), false) then
      MessageDlg('Failed to save temporary file', mtError, [mbOk], 0)
    else
      MessageDlg('Signing process successfully finished', mtInformation, [mbOk], 0);
  end
  (*
  else
    MessageDlg('Signing failed', mtError, [mbOk], 0)
  *);
  // deleting temporary file
  DeleteFile(TempPath);
  Close();
end;
Responder Con Cita
 



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
Cerrar ventana Showmodal Espartaco Varios 12 08-10-2007 13:13:05
Cerrar ventana rex HTML, Javascript y otros 2 29-05-2006 12:16:42
Problemas MDI cerrar ventana rafadrover Varios 3 28-01-2006 13:30:44
Cerrar ventana a los 10 min. de inactividad jamonete2 OOP 4 10-06-2005 18:18:53
Cerrar Ventana ronson OOP 2 17-12-2004 12:38:04


La franja horaria es GMT +2. Ahora son las 21:07:20.


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