Link to home
Start Free TrialLog in
Avatar of zorvek (Kevin Jones)
zorvek (Kevin Jones)Flag for United States of America

asked on

Need CryptCreateHash version of the HMACSHA1.ComputeHash .net function.

Here is the VB.net sample I am working with:

   Public Function aws_GetSignature _
       (ByVal Operation As String, ByVal TimeStamp As _
       DateTime) As String
   
       Dim strSig_Raw As String
       Dim strSig_UTF8 As Byte()
       Dim strSignature As String
       Dim objUTF8Encoder As UTF8Encoding
       Dim objHMACSHA1 As HMACSHA1
   
       strSig_Raw = "AmazonS3" & Operation & _
          aws_GetISOTimestamp(TimeStamp)
   
       objUTF8Encoder = New UTF8Encoding()
       strSig_UTF8 = objUTF8Encoder.GetBytes(strSig_Raw)
   
       objHMACSHA1 = New HMACSHA1( _
          objUTF8Encoder.GetBytes(m_strSecretAccessKey))
       strSignature = Convert.ToBase64String _
          (objHMACSHA1.ComputeHash( _
          objUTF8Encoder.GetBytes( _
          strSig_Raw.ToCharArray())))
   
       Return strSignature
   
   End Function

I have the ISOTimestamp, UTF-8 encoding, and base 64 functions working but need help with the HMACSHA1.ComputeHash function. How can I implement the HMACSHA1 function in VB6 using the CryptCreateHash Windows SDK function?

Kevin
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zorvek (Kevin Jones)

ASKER

Dan, thanks for the response. It's a pretty tough problem with I never got working. But one of my coworkers found some code that appears to use the same API calls and successfully creates a hash. I just need to dissect it and figure out what they did that I did not do. Kevin