Assinatura digital ??
Moderador: Moderadores
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Assinatura digital ??
Achei este documento, mas não guardei o link, de uma universidade.
No final tem um fonte em NET pra assinatura.
À primeira vista, usa o Adobe, igual costumamos usar o CreateObject( "Excel.Application" ), mas usando do Adobe.
Nota: é que fiz outras pesquisas em seguida, e acabei perdendo o link
No final tem um fonte em NET pra assinatura.
À primeira vista, usa o Adobe, igual costumamos usar o CreateObject( "Excel.Application" ), mas usando do Adobe.
Nota: é que fiz outras pesquisas em seguida, e acabei perdendo o link
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Assinatura digital ??
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
-
toninhofwi
- Usuário Nível 1

- Mensagens: 31
- Registrado em: 23 Set 2009 22:35
- Localização: Catanduva-SP
Assinatura digital ??
Marcelo, Free não tem mas o pagamento é único, é uma DLL activeX com toneladas de exemplos em foxPro que basicamente a única diferença é que no Fox se usa obj.method e no Harbour obj:method,
Exemplos de como assinar um PDF estão aqui:
https://www.example-code.com/foxpro/pdf_signatures.asp
Exemplos de como assinar um PDF estão aqui:
https://www.example-code.com/foxpro/pdf_signatures.asp
Assinatura digital ??
Obrigado, vou testar com o demo de 30 dias, ver ser consigo fazer rodar um exemplo. Se der certo o exemplo, posto o fonte aqui.
Marcelo A. L. Carli
Marília/SP
Capital Nacional do Alimento ®
https://malc-informatica.ueniweb.com
http://marcelo.lx.com.br
Email / Skype: malcarli@life.com.br
Att.toninhofwi escreveu:Marcelo, Free não tem mas o pagamento é único, é uma DLL activeX com toneladas de exemplos em foxPro que basicamente a única diferença é que no Fox se usa obj.method e no Harbour obj:method,
Exemplos de como assinar um PDF estão aqui:
https://www.example-code.com/foxpro/pdf_signatures.asp
Marcelo A. L. Carli
Marília/SP
Capital Nacional do Alimento ®
https://malc-informatica.ueniweb.com
http://marcelo.lx.com.br
Email / Skype: malcarli@life.com.br
Assinatura digital ??
O que meus clientes estão fazendo é exatamente isto, mas querem que eu automatize
Quanto a esta rotina, parece uma solução viável, o problema que não entendo nada de .Net, se conseguir uma "tradução" para harbour, daria para testar.
Att.
Marcelo A. L. Carli
Marília/SP
Capital Nacional do Alimento ®
https://malc-informatica.ueniweb.com
http://marcelo.lx.com.br
Email / Skype: malcarli@life.com.br
JoséQuintas escreveu:Ok tava no histórico do Edge.
http://www.sef.sc.gov.br/arquivos_porta ... em_PDF.pdf
Quanto a esta rotina, parece uma solução viável, o problema que não entendo nada de .Net, se conseguir uma "tradução" para harbour, daria para testar.
Att.
Marcelo A. L. Carli
Marília/SP
Capital Nacional do Alimento ®
https://malc-informatica.ueniweb.com
http://marcelo.lx.com.br
Email / Skype: malcarli@life.com.br
-
toninhofwi
- Usuário Nível 1

- Mensagens: 31
- Registrado em: 23 Set 2009 22:35
- Localização: Catanduva-SP
Assinatura digital ??
Segue um teste simples para ler algumas TAGs da NFe, para ajudar a compreeender o jeito de trabalho da DLL porque tudo nela segue esta regra:
---cut---
---cut---
---cut---
Código: Selecionar todos
static procedure testChilkat()
local oGlobal := win_OleGetActiveObject( "Chilkat_9_5_0.Global.1" )
local oXml
if !hb_IsObject( oGlobal )
oGlobal = win_OleCreateObject( "Chilkat_9_5_0.Global.1" )
endif
if hb_IsObject( oGlobal )
if oGlobal:UnlockBundle( "Start my 30-day Trial" ) == 1
oXml = win_OleGetActiveObject( "Chilkat_9_5_0.Xml" )
if !hb_IsObject( oXml )
oXml = win_OleCreateObject( "Chilkat_9_5_0.Xml" )
endif
if hb_IsObject( oXml )
oXml:LoadXmlFile( "d:\xml\n1.xml" )
? oXml:GetChildContent( "protNFe|infProt|chNFe" )
? oXml:GetChildContent( "NFe|infNFe|infAdic|infCpl" )
endif
endif
endif
returnAssinatura digital ??
Bom dia, neste exemplo abaixo onde está oXml = win_OleGetActiveObject( "Chilkat_9_5_0.Xml" ), substituiria pela extensão pdf?
toninhofwi escreveu:Segue um teste simples para ler algumas TAGs da NFe, para ajudar a compreeender o jeito de trabalho da DLL porque tudo nela segue esta regra:
---cut---
---cut---Código: Selecionar todos
static procedure testChilkat() local oGlobal := win_OleGetActiveObject( "Chilkat_9_5_0.Global.1" ) local oXml if !hb_IsObject( oGlobal ) oGlobal = win_OleCreateObject( "Chilkat_9_5_0.Global.1" ) endif if hb_IsObject( oGlobal ) if oGlobal:UnlockBundle( "Start my 30-day Trial" ) == 1 oXml = win_OleGetActiveObject( "Chilkat_9_5_0.Xml" ) if !hb_IsObject( oXml ) oXml = win_OleCreateObject( "Chilkat_9_5_0.Xml" ) endif if hb_IsObject( oXml ) oXml:LoadXmlFile( "d:\xml\n1.xml" ) ? oXml:GetChildContent( "protNFe|infProt|chNFe" ) ? oXml:GetChildContent( "NFe|infNFe|infAdic|infCpl" ) endif endif endif return
-
toninhofwi
- Usuário Nível 1

- Mensagens: 31
- Registrado em: 23 Set 2009 22:35
- Localização: Catanduva-SP
Assinatura digital ??
Boa tarde,Bom dia, neste exemplo abaixo onde está oXml = win_OleGetActiveObject( "Chilkat_9_5_0.Xml" ), substituiria pela extensão pdf?
Não, eu só dei o exemplo de como se utiliza a chilkat, criei um exemplo onde eu leio algumas tags da NFe.
Para assinar PDF você terá que estudar os exemplos em FOX pro que tem no site da chilkat e adaptar o código.
Abraço.
Assinatura digital ??
Usando os exemplos da página do ChilKat, para fox pro, adaptei para me extended com harbour, mas está dando erro de método não exportado na linha:
lnSuccess:= loPdf:LoadFile([E:\tools\newpcmso\chilkat\teste.pdf])
obs: existe o arquivo nesta pasta
lnSuccess:= loPdf:LoadFile([E:\tools\newpcmso\chilkat\teste.pdf])
obs: existe o arquivo nesta pasta
Código: Selecionar todos
/*****************************************************************************
* SISTEMA : ROTINA EVENTUAL *
* PROGRAMA : DEMO.PRG *
* OBJETIVO : Assinar Digitalmente um Pdf *
* AUTOR : Marcelo Antonio Lázzaro Carli *
* DATA : 22.04.2021 *
* ULT. ALT.: 22.04.2021 *
*****************************************************************************/
#include <minigui.ch>
Function Main()
REQUEST HB_LANG_PT
HB_LangSelect([PT])
REQUEST HB_CODEPAGE_PT850 &&& PARA INDEXAR CAMPOS ACENTUADOS
HB_SETCODEPAGE([PT850]) &&& PARA INDEXAR CAMPOS ACENTUADOS
Set wrap on
Set talk off
Set date briti &&& data no formato dd/mm/aaaa
Set dele on &&& ignora registros marcados por deleção
Set score off
Set exact on
Set ToolTip on
Setcancel(.F.) &&& evitar cancelar sistema c/ ALT + C
Set cent on &&& ano com 4 dígitos
Set epoch to 2000 &&& ano a partir de 2000
Set excl off &&& abre arquivos em modo compartilhado
Set navigation extended &&& enter no lugar do tab
Set language to portuguese &&& mensagens em português
Set multiple off warning &&& abrir 1 cópia somente
Set tooltipstyle balloon &&& para mensagem dos campos em forma de balão
Set menustyle extended &&& padrão é standard, extended estilo office 2007
Set programmaticchange off &&& introduzida na build 1.9.94
Define window main at 0, 0 width getDesktopWidth() height getDesktopHeight() ICON "dw.ico" NOTIFYICON "dw.ico" MAIN title [Atualizador] NOSIZE
@ 030,090 BUTTON btn_P1 caption [&Assinar] action {|| (fAssinar(), main.Release())} WIDTH 120 TOOLTIP [Selecione]
on key escape action {|| Thiswindow.Release()}
end window
main.Center
main.maximize
main.Activate
Return (Nil)
Static Procedure fAssinar()
Local loPdf, lnSuccess, loJson, loCert
Destravar()
* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* loPdf = CreateObject('Chilkat_9_5_0.Pdf')
loPdf:= win_OleGetActiveObject([Chilkat_9_5_0.Pdf])
* Load a PDF to be signed.
* The "hello.pdf" is available at https://chilkatsoft.com/hello.pdf
lnSuccess:= loPdf:LoadFile([E:\tools\newpcmso\chilkat\teste.pdf])
If lnSuccess == 0
MsgInfo(loPdf:LastErrorText, [este])
RELEASE loPdf
CANCEL
Endif
loJson:= win_OleCreateObject([Chilkat_9_5_0.JsonObject])
* Put the signature on page 1, top left
loJson:UpdateInt([page],1)
loJson:UpdateString([appearance.y],[top])
loJson:UpdateString([appearance.x],[left])
* Use a font scale of 10.0
loJson:UpdateString([appearance.fontScale],[10.0])
* In this example, the appearance of the digital signature will contain three lines:
* 1) The signing certificate's common name
* 2) The current date/time
* 3) Some arbitrary text.
* The keyword "cert_cn" is replaced with the Certificate's Subject Common Name.
* The keyword "current_dt" is replaced with the current date/time.
* Any number of appearance text lines can be added.
loJson:UpdateString('appearance.text[0]',[Digitally signed by: cert_cn])
loJson:UpdateString('appearance.text[1]',[current_dt])
loJson:UpdateString('appearance.text[2]',[The crazy brown fox jumps over the lazy dog.])
* Load the signing certificate. (Use your own certificate.)
loCert:= win_OleCreateObject([Chilkat_9_5_0.Cert])
lnSuccess:= loCert:LoadPfxFile("qa_data/pfx/myPdfSigningCert.pfx],[secret])
If lnSuccess == 0
MsgInfo(loCert:LastErrorText, [este 1])
RELEASE loPdf
RELEASE loJson
RELEASE loCert
CANCEL
Endif
* Tell the pdf object to use the certificate for signing.
lnSuccess:= loPdf:SetSigningCert(loCert)
If lnSuccess == 0
MsgInfo(loPdf:LastErrorText, [este 2])
RELEASE loPdf
RELEASE loJson
RELEASE loCert
CANCEL
Endif
lnSuccess:= loPdf:SignPdf(loJson,[hello_signed.pdf])
If lnSuccess == 0
MsgInfo(loPdf:LastErrorText, [este 3])
RELEASE loPdf
RELEASE loJson
RELEASE loCert
CANCEL
Endif
MsgInfo([The PDF has been successfully cryptographically signed.], [Finalmente])
Return (Nil)
Static Function Destravar()
Local loGlob:= win_OleCreateObject([Chilkat_9_5_0.Global]), lnSuccess, lnStatus
lnSuccess:= loGlob:UnlockBundle([Start my 30-day Trial])
If lnSuccess <> 1
MsgInfo(loGlob:LastErrorText, [aqui])
RELEASE loGlob
CANCEL
Endif
lnStatus:= loGlob:UnlockStatus
If lnStatus == 2
MsgInfo([Desbloqueado. Usando o código de desbloqueio comprado.], [aqui 1])
Else
MsgInfo([Desbloqueado no modo de teste.], [aqui 2])
Endif
* The LastErrorText can be examined in the success case to see if it was unlocked in trial more, or with a purchased unlock code.
* MsgInfo(loGlob:LastErrorText, [aqui 3])
RELEASE loGlob
Return (Nil)
Assinatura digital ??
Boa tarde, testando a versão 9.5.0.86 da Chilkat, funcionou perfeitamente a assinatura do pdf. Nas versões anteriores não existe o comando loadfile, por isso do erro de método não exportado. Fiz teste usando a chave de versão trial.
Agora convencer clientes a pagar pela biblioteca, ou continuar buscando uma solução free.
Agora convencer clientes a pagar pela biblioteca, ou continuar buscando uma solução free.
- Itamar M. Lins Jr.
- Administrador

- Mensagens: 7928
- Registrado em: 30 Mai 2007 11:31
- Localização: Ilheus Bahia
- Curtiu: 1 vez
Assinatura digital ??
Olá!
Saudações,
Itamar M. Lins Jr.
Achei pertinente ao assunto.JsignPdf is an excellent tool for Signing PDF documents. In windows , it can be used with WINDOWS-MY key store or other key stores.
1.Create PDF using hbhpdf contrib
2. Sign using JsignPdf in Java JAR (wapi_shellexecute () in silent mode with bundles of JsignPdf parameters)
(can be done from within your Harbour application , JsignPdf is a compact & free java program from Josef Cacek)
Shaji Thomas
Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Itamar M. Lins Jr.
- Mario Mesquita
- Usuário Nível 4

- Mensagens: 613
- Registrado em: 08 Dez 2009 13:47
- Localização: Rio de Janeiro
Assinatura digital ??
Boa noite a todos.
Itamar, dá pra usar com Harbour? Não entendi bem, são rotinas em Java? Se pode embarcar no Harbour, onde se pode obter mais detalhes?
Sds,
Mario.
Itamar, dá pra usar com Harbour? Não entendi bem, são rotinas em Java? Se pode embarcar no Harbour, onde se pode obter mais detalhes?
Sds,
Mario.
- Itamar M. Lins Jr.
- Administrador

- Mensagens: 7928
- Registrado em: 30 Mai 2007 11:31
- Localização: Ilheus Bahia
- Curtiu: 1 vez
Assinatura digital ??
Olá!
Pelo que ele escreveu ai, não deve ser complicado.
Com uma rápida procura pelo google, achei isso!
https://arwsd.com.br/download/manuais/M ... ignPDF.pdf
Saudações,
Itamar M. Lins Jr.
O autor disse que usa com o Harbour, mas não colocou os comandos.dá pra usar com Harbour?
Pelo que ele escreveu ai, não deve ser complicado.
Com uma rápida procura pelo google, achei isso!
https://arwsd.com.br/download/manuais/M ... ignPDF.pdf
Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Itamar M. Lins Jr.
- Itamar M. Lins Jr.
- Administrador

- Mensagens: 7928
- Registrado em: 30 Mai 2007 11:31
- Localização: Ilheus Bahia
- Curtiu: 1 vez
Assinatura digital ??
Olá!
Estou no Linux, depois que baixar o aquivo jSignpdf.jar teste ai:
Saudações,
Itamar M. Lins Jr.
Estou no Linux, depois que baixar o aquivo jSignpdf.jar teste ai:
Código: Selecionar todos
java -jar JSignPdf.jar -kst PKCS12 -ksf my_certificate.pfx -ksp myPrivateKeystorePassword -d C:\output C:\Documents\*.pdf
Used options:
-kst keystore type
-ksf path to a keystore
-ksp password
-d output folder
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Itamar M. Lins Jr.
- clodoaldomonteiro
- Usuário Nível 4

- Mensagens: 821
- Registrado em: 30 Dez 2006 13:17
- Localização: Teresina-PI
- Contato:
Assinatura digital ??
Boa tarde,
Reacendendo este Post, vcs conseguiram assinar com A3, onde temos que plugar o PenDriver ou Card, e ainda digitar a senha do responsável?
Desde já, agradeço.
Reacendendo este Post, vcs conseguiram assinar com A3, onde temos que plugar o PenDriver ou Card, e ainda digitar a senha do responsável?
Desde já, agradeço.
At. Clodoaldo Monteiro
Linguagens: Clipper / Harbour
Área de Atuação: Sistemas de gestão para Prefeituras Municipais
Fones: (86)3223-0653, 98859-0236
www.simplesinformatica.com.br
Linguagens: Clipper / Harbour
Área de Atuação: Sistemas de gestão para Prefeituras Municipais
Fones: (86)3223-0653, 98859-0236
www.simplesinformatica.com.br
