Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: s E t H en 22 Abril 2009, 01:38 am



Título: dsa o similar?
Publicado por: s E t H en 22 Abril 2009, 01:38 am
quiero firmar un archivo (no hace falta que sea con vb, puede ser con gpg u otro mientras que funcione), que mi programa lo baje (esto ya lo hice) y que compruebe si la firma es válida

alguno tiene el código?

PD: si, ya googlee y no encontre nada para vb6


Título: Re: dsa o similar?
Publicado por: XcryptOR en 22 Abril 2009, 02:59 am
mira sEtH no se si esto te pueda ayudar hace uso del componente chilkatcrypt

puedes descargar el componente desde Aqui (http://www.example-code.com/vb/sigCrypt2.asp), segun lo que lei crea y verifica una firma digital

Código
  1. Dim crypt As New ChilkatCrypt2
  2.    crypt.UnlockComponent "test"
  3.  
  4.    ' Select a digital certificate for signing.
  5.    Dim StoreCreator As ChilkatCreateCS
  6.    Set StoreCreator = New ChilkatCreateCS
  7.  
  8.    ' Create a certificate store object representing the registry-based
  9.    ' current user certificate store.
  10.    Dim certStore As ChilkatCertStore
  11.    Set certStore = StoreCreator.OpenCurrentUserStore()
  12.  
  13.    ' Find a certificate matching an email address.
  14.    Dim cert As ChilkatCert
  15.    Set cert = certStore.FindCertBySubjectE("test@chilkatsoft.com")
  16.    If (cert Is Nothing) Then
  17.        MsgBox "Certificate not found!"
  18.        Exit Sub
  19.    End If
  20.  
  21.    ' Use this certificate.
  22.    crypt.SetSigningCert cert
  23.  
  24.    Dim fileData As Variant
  25.    Dim sigData As Variant
  26.  
  27.    fileData = crypt.ReadFile("sample.pdf")
  28.    If IsNull(fileData) Then
  29.        MsgBox crypt.LastErrorText
  30.        Exit Sub
  31.    End If
  32.  
  33.    sigData = crypt.SignBytes(fileData)
  34.    If IsNull(sigData) Then
  35.        MsgBox crypt.LastErrorText
  36.        Exit Sub
  37.    End If
  38.  
  39.    success = crypt.WriteFile("signature.dat", sigData)
  40.    If (success = 0) Then
  41.        MsgBox crypt.LastErrorText
  42.    End If
  43.  
  44.    MsgBox "OK!"
  45.  
  46.    ' Now verify it...
  47.    Dim sigData2 As Variant
  48.  
  49.    sigData2 = crypt.ReadFile("signature.dat")
  50.    If IsNull(sigData2) Then
  51.        MsgBox crypt.LastErrorText
  52.        Exit Sub
  53.    End If
  54.  
  55.    sigOK = crypt.VerifyBytes(fileData, sigData2)
  56.    If (sigOK = 1) Then
  57.        MsgBox "Signature is valid, the file is unchanged."
  58.    Else
  59.        MsgBox "Invalid signature, the file may have been altered."
  60.    End If



Título: Re: dsa o similar?
Publicado por: s E t H en 22 Abril 2009, 18:46 pm
ya lo habia visto, pero es un demo por 30 dias asi que no me sirve


Título: Re: dsa o similar?
Publicado por: byway en 23 Abril 2009, 21:11 pm
talvez esto sea loque buscas:
link (http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=71971&lngWId=1)