Click here to Skip to main content
15,902,275 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Trying to understand the nature of inherited windows forms.... Pin
Eddy Vluggen7-Jan-15 5:56
professionalEddy Vluggen7-Jan-15 5:56 
AnswerRe: Trying to understand the nature of inherited windows forms.... Pin
bojammis7-Jan-15 15:15
professionalbojammis7-Jan-15 15:15 
GeneralRe: Trying to understand the nature of inherited windows forms.... Pin
Sam Marrocco8-Jan-15 2:54
Sam Marrocco8-Jan-15 2:54 
GeneralRe: Trying to understand the nature of inherited windows forms.... Pin
bojammis8-Jan-15 5:47
professionalbojammis8-Jan-15 5:47 
QuestionOutlook...vba to assign a UDF a value (attachment.filenames) Pin
Member 113499046-Jan-15 16:00
Member 113499046-Jan-15 16:00 
QuestionNew computer language creation using visual basic Pin
Member 113553585-Jan-15 22:50
Member 113553585-Jan-15 22:50 
QuestionHMAC Calculating for Request Header Pin
jkirkerx4-Jan-15 10:18
professionaljkirkerx4-Jan-15 10:18 
GeneralLost in translation? Pin
jkirkerx5-Jan-15 10:57
professionaljkirkerx5-Jan-15 10:57 
Well I back to basics here, and constructed the test code again in the simplist form.
So this is the first translation I made from c# to vb, using asp.net 4.0
So if I don't generate this right first, then the 2nd one will not be correct.
The error I get is invalid signature, and the hashed content does not match.
Works in c#, so I must of made a mistake in the translation.

Perhaps another set of eyes on this could help out.

Set One:
ASCIIEncoding encoder = new ASCIIEncoding();
byte[] xml_byte = encoder.GetBytes(xml_string);
SHA1CryptoServiceProvider sha1_crypto = new SHA1CryptoServiceProvider();
string hash = BitConverter.ToString(sha1_crypto.ComputeHash(xml_byte)).Replace("-", "");
string hashed_content = hash.ToLower();

Dim encoder As ASCIIEncoding = New ASCIIEncoding
Dim xml_bytes() As Byte = encoder.GetBytes(xml_string)
Dim sha1_crypto As SHA1CryptoServiceProvider = New SHA1CryptoServiceProvider
Dim hash As String = BitConverter.ToString(sha1_crypto.ComputeHash(xml_bytes)).Replace("-", "")
Dim hashed_content As String = hash.ToLower

Set Two:
//hmac sha1 hash with key + hash_data
HMAC hmac_sha1 = new HMACSHA1(Encoding.UTF8.GetBytes(key)); //key
byte[] hmac_data = hmac_sha1.ComputeHash(Encoding.UTF8.GetBytes(hash_data)); //data
//base64 encode on hmac_data
string base64_hash = Convert.ToBase64String(hmac_data);

'Compute the HMAC and convert to a base64 hash
Dim m_hmac_sha1 As New HMACSHA1(Encoding.UTF8.GetBytes(m_key))
Dim m_hmac_data() As Byte = m_hmac_sha1.ComputeHash(Encoding.UTF8.GetBytes(m_hashData))
Dim m_base64_hash As String = Convert.ToBase64String(m_hmac_data)

Answer[SOLVED] Pin
jkirkerx5-Jan-15 12:34
professionaljkirkerx5-Jan-15 12:34 
GeneralRe: [SOLVED] Pin
Member 149534685-Aug-21 5:50
Member 149534685-Aug-21 5:50 
GeneralRe: [SOLVED] Pin
jkirkerx5-Aug-21 6:22
professionaljkirkerx5-Aug-21 6:22 
QuestionHow to make a youtube downloader in vb.net Pin
Anupama Rhiyas1-Jan-15 21:41
Anupama Rhiyas1-Jan-15 21:41 
AnswerRe: How to make a youtube downloader in vb.net Pin
Richard MacCutchan1-Jan-15 22:30
mveRichard MacCutchan1-Jan-15 22:30 
AnswerRe: How to make a youtube downloader in vb.net Pin
Simon_Whale1-Jan-15 22:46
Simon_Whale1-Jan-15 22:46 
QuestionVB 2013 Community (Transparent Text Control) Pin
peskykid821-Jan-15 15:17
professionalpeskykid821-Jan-15 15:17 
GeneralRe: VB 2013 Community (Transparent Text Control) Pin
PIEBALDconsult1-Jan-15 15:48
mvePIEBALDconsult1-Jan-15 15:48 
AnswerRe: VB 2013 Community (Transparent Text Control) Pin
Eddy Vluggen5-Jan-15 7:17
professionalEddy Vluggen5-Jan-15 7:17 
Questionann Pin
Member 1134553331-Dec-14 8:32
Member 1134553331-Dec-14 8:32 
AnswerRe: ann Pin
Dave Kreskowiak31-Dec-14 15:46
mveDave Kreskowiak31-Dec-14 15:46 
Questionhow to extract a sample from template dpfp visual basic .net 4.0 Pin
Member 1118030631-Dec-14 5:32
Member 1118030631-Dec-14 5:32 
AnswerRe: how to extract a sample from template dpfp visual basic .net 4.0 Pin
Eddy Vluggen5-Jan-15 7:20
professionalEddy Vluggen5-Jan-15 7:20 
Questionfilter records from ms access 2010 by vba Pin
Virendra Singh Bhanu30-Dec-14 16:40
Virendra Singh Bhanu30-Dec-14 16:40 
AnswerRe: filter records from ms access 2010 by vba Pin
Eddy Vluggen5-Jan-15 7:23
professionalEddy Vluggen5-Jan-15 7:23 
QuestionUsing a wsdl with HMAC Pin
jkirkerx30-Dec-14 12:53
professionaljkirkerx30-Dec-14 12:53 
QuestionNon-Web Async and Await Questions Pin
Member 1134379530-Dec-14 6:07
Member 1134379530-Dec-14 6:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.