D
Daniel Godoy
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
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