Sign hash with public key

Discussion in 'ASP .Net Security' started by Daniel Godoy, Sep 20, 2006.

  1. Daniel Godoy

    Daniel Godoy Guest

    Hello all !

    I´ve developed a page to do a Asymmetric Cryptography with Digital
    Certificate, but something doesn´t work.

    I have a URL like that :
    "FIELD1=000000000000001&FIELD2=0000&FIELD3=AAAAA&SIGN=5705236f1f462afe65f6704d24c8e1359fead41e42c460d........"

    When I receive it, I have to get the Digital Signature of all field and
    after compare with the SIGN field. But I can´t cryptography the field using
    "SIGNHASH", because my Certificate File (CER) haven´t the Private Key, and
    the same time, I can´t use the VERIFYHASH, because I don´t know how convert
    the SIGN value to a array of bytes.

    The code :
    'TextBox1.text = ClearText

    'TextBox2.text = SIGN

    Dim ClearTextBytes As Byte() = Encoding.UTF8.GetBytes(TextBox1.Text)

    Dim AlgHash As HashAlgorithm = HashAlgorithm.Create("SHA1")

    Dim hash As Byte() = AlgHash.ComputeHash(ClearTextBytes)

    Dim Cert As X509Certificate =
    X509Certificate.CreateCertFromFile("C:\CertificateFile.cer")

    Dim sign As New RSACryptoServiceProvider

    sign.ImportParameters(Cert.PublicKey.ExportParameters(False))

    Dim b As Byte

    Dim resultHexString As String

    MsgBox(sign.VerifyHash(hash, CryptoConfig.MapNameToOID("SHA1"), "????I have
    to convert, but I don´t know how ????"))



    Thank you !!



    Daniel Godoy
     
    Daniel Godoy, Sep 20, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman
    Replies:
    1
    Views:
    1,405
    smith
    Dec 8, 2004
  2. SpamProof
    Replies:
    0
    Views:
    606
    SpamProof
    Oct 21, 2003
  3. rp
    Replies:
    1
    Views:
    557
    red floyd
    Nov 10, 2011
  4. Une bévue
    Replies:
    5
    Views:
    156
    Une bévue
    Aug 10, 2006
  5. Replies:
    0
    Views:
    124
Loading...

Share This Page