Test Foro de elhacker.net SMF 2.1

Programación => .NET (C#, VB.NET, ASP) => Programación General => 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 (vb) [Seleccionar]
Dim crypt As New ChilkatCrypt2
    crypt.UnlockComponent "test"

    ' Select a digital certificate for signing.
    Dim StoreCreator As ChilkatCreateCS
    Set StoreCreator = New ChilkatCreateCS
   
    ' Create a certificate store object representing the registry-based
    ' current user certificate store.
    Dim certStore As ChilkatCertStore
    Set certStore = StoreCreator.OpenCurrentUserStore()
   
    ' Find a certificate matching an email address.
    Dim cert As ChilkatCert
    Set cert = certStore.FindCertBySubjectE("test@chilkatsoft.com")
    If (cert Is Nothing) Then
        MsgBox "Certificate not found!"
        Exit Sub
    End If
       
    ' Use this certificate.
    crypt.SetSigningCert cert
   
    Dim fileData As Variant
    Dim sigData As Variant
   
    fileData = crypt.ReadFile("sample.pdf")
    If IsNull(fileData) Then
        MsgBox crypt.LastErrorText
        Exit Sub
    End If
   
    sigData = crypt.SignBytes(fileData)
    If IsNull(sigData) Then
        MsgBox crypt.LastErrorText
        Exit Sub
    End If
   
    success = crypt.WriteFile("signature.dat", sigData)
    If (success = 0) Then
        MsgBox crypt.LastErrorText
    End If
   
    MsgBox "OK!"
   
    ' Now verify it...
    Dim sigData2 As Variant
   
    sigData2 = crypt.ReadFile("signature.dat")
    If IsNull(sigData2) Then
        MsgBox crypt.LastErrorText
        Exit Sub
    End If
   
    sigOK = crypt.VerifyBytes(fileData, sigData2)
    If (sigOK = 1) Then
        MsgBox "Signature is valid, the file is unchanged."
    Else
        MsgBox "Invalid signature, the file may have been altered."
    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)