zorvek (Kevin Jones)
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(TimeSt amp)
objUTF8Encoder = New UTF8Encoding()
strSig_UTF8 = objUTF8Encoder.GetBytes(st rSig_Raw)
objHMACSHA1 = New HMACSHA1( _
objUTF8Encoder.GetBytes(m_ strSecretA ccessKey))
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
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(TimeSt
objUTF8Encoder = New UTF8Encoding()
strSig_UTF8 = objUTF8Encoder.GetBytes(st
objHMACSHA1 = New HMACSHA1( _
objUTF8Encoder.GetBytes(m_
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER