From: jeffhowse on
I have scoured the Net and haven't had any luck finding what I need.
I've been asked to take a C# SSO web page and convert it to a
VBScript. The problem I'm having is that in the SSO web page, we're
taking a user name and appending it to a shared key, turning it into a
UTF8 byte array, MD5 hashing it, and then converting that to a Base64
string.

I've tried using the MD5 functions that I've found in several
different places but none return the string I expect without doing the
UTF8 byte array and the Base64 conversion. I've tried creating
objects through COM of the .NET dlls I use in the SSO web page
(System.Encryption.UTF8 and
System.Security.Cryptography.MD5CryptoServiceProvider) but I keep
getting errors when trying to call the correct functions and it says
they don't exist even though I can check certain properties to ensure
the object was created correctly.

Am I barking up the wrong tree by going about it this way? I could
easily create a DLL exposed to COM that I could use but at that point
I might as well create an executable app.

I could really use some help with this. I've never worked that much
with VBScript before so I'm playing in waters that aren't that
familiar to me. Can anyone give me some guidance on this? Any help
would be greatly appreciated.
From: Mark Pryor on
On Sun, 07 Sep 2008 13:28:04 -0700, jeffhowse wrote:

> I have scoured the Net and haven't had any luck finding what I need.
> I've been asked to take a C# SSO web page and convert it to a VBScript.
> The problem I'm having is that in the SSO web page, we're taking a user
> name and appending it to a shared key, turning it into a UTF8 byte
> array, MD5 hashing it, and then converting that to a Base64 string.
>

first, post a set of test vectors from the web page.

Its possible to quickly do what you want in VBScript with a combination
of Capicom and ADODB.Stream objects. If you can't use those objects then
you will struggle to do it all in pure VBScript.

--
Mark
From: ekkehard.horner on
jeffhowse(a)gmail.com schrieb:
> I have scoured the Net and haven't had any luck finding what I need.
> I've been asked to take a C# SSO web page and convert it to a
> VBScript. The problem I'm having is that in the SSO web page, we're
> taking a user name and appending it to a shared key, turning it into a
> UTF8 byte array, MD5 hashing it, and then converting that to a Base64
> string.
>
> I've tried using the MD5 functions that I've found in several
> different places but none return the string I expect without doing the
> UTF8 byte array and the Base64 conversion. I've tried creating
> objects through COM of the .NET dlls I use in the SSO web page
> (System.Encryption.UTF8 and
> System.Security.Cryptography.MD5CryptoServiceProvider) but I keep
> getting errors when trying to call the correct functions and it says
> they don't exist even though I can check certain properties to ensure
> the object was created correctly.
>

Did you add position numbers to the names of polymorph function as
described in
http://blog.opennetcf.org/afeinman/PermaLink,guid,aa53e23d-b8e5-4015-b00a-0c8ea9bc6dfe.aspx

? Sometimes parameters need special treatment (e.g. passing per value) too.

> Am I barking up the wrong tree by going about it this way? I could
> easily create a DLL exposed to COM that I could use but at that point
> I might as well create an executable app.
>
> I could really use some help with this. I've never worked that much
> with VBScript before so I'm playing in waters that aren't that
> familiar to me. Can anyone give me some guidance on this? Any help
> would be greatly appreciated.
From: jeffhowse on
On Sep 8, 2:06 am, "ekkehard.horner" <ekkehard.hor...(a)arcor.de> wrote:
> jeffho...(a)gmail.com schrieb:
>
>
>
>
>
> > I have scoured the Net and haven't had any luck finding what I need.
> > I've been asked to take a C# SSO web page and convert it to a
> > VBScript.  The problem I'm having is that in the SSO web page, we're
> > taking a user name and appending it to a shared key, turning it into a
> > UTF8 byte array, MD5 hashing it, and then converting that to a Base64
> > string.
>
> > I've tried using the MD5 functions that I've found in several
> > different places but none return the string I expect without doing the
> > UTF8 byte array and the Base64 conversion.  I've tried creating
> > objects through COM of the .NET dlls I use in the SSO web page
> > (System.Encryption.UTF8 and
> > System.Security.Cryptography.MD5CryptoServiceProvider) but I keep
> > getting errors when trying to call the correct functions and it says
> > they don't exist even though I can check certain properties to ensure
> > the object was created correctly.
>
> Did you add position numbers to the names of polymorph function as
> described in
>  http://blog.opennetcf.org/afeinman/PermaLink,guid,aa53e23d-b8e5-4015-....
>
> ? Sometimes parameters need special treatment (e.g. passing per value) too.
>
>
>
> > Am I barking up the wrong tree by going about it this way?  I could
> > easily create a DLL exposed to COM that I could use but at that point
> > I might as well create an executable app.
>
> > I could really use some help with this.  I've never worked that much
> > with VBScript before so I'm playing in waters that aren't that
> > familiar to me.  Can anyone give me some guidance on this?  Any help
> > would be greatly appreciated.- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

That was it! Thanks! Had to use GetBytes_4 and ComputeHash_2.
You've saved me a ton of time. Now I'm struggling with using the
equivalent of Convert.ToBase64String. Any help here would be greatly
appreciated as well. Thanks in advance!
From: Anthony Jones on


<jeffhowse(a)gmail.com> wrote in message
news:bd45badb-7e60-452a-90c2-527b9b5ef0ac(a)y38g2000hsy.googlegroups.com...
On Sep 8, 2:06 am, "ekkehard.horner" <ekkehard.hor...(a)arcor.de> wrote:
> jeffho...(a)gmail.com schrieb:
>
>
>
>
>
> > I have scoured the Net and haven't had any luck finding what I need.
> > I've been asked to take a C# SSO web page and convert it to a
> > VBScript. The problem I'm having is that in the SSO web page, we're
> > taking a user name and appending it to a shared key, turning it into a
> > UTF8 byte array, MD5 hashing it, and then converting that to a Base64
> > string.
>
> > I've tried using the MD5 functions that I've found in several
> > different places but none return the string I expect without doing the
> > UTF8 byte array and the Base64 conversion. I've tried creating
> > objects through COM of the .NET dlls I use in the SSO web page
> > (System.Encryption.UTF8 and
> > System.Security.Cryptography.MD5CryptoServiceProvider) but I keep
> > getting errors when trying to call the correct functions and it says
> > they don't exist even though I can check certain properties to ensure
> > the object was created correctly.
>
> Did you add position numbers to the names of polymorph function as
> described in
> http://blog.opennetcf.org/afeinman/PermaLink,guid,aa53e23d-b8e5-4015-...
>
> ? Sometimes parameters need special treatment (e.g. passing per value)
> too.
>
>
>
> > Am I barking up the wrong tree by going about it this way? I could
> > easily create a DLL exposed to COM that I could use but at that point
> > I might as well create an executable app.
>
> > I could really use some help with this. I've never worked that much
> > with VBScript before so I'm playing in waters that aren't that
> > familiar to me. Can anyone give me some guidance on this? Any help
> > would be greatly appreciated.- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

That was it! Thanks! Had to use GetBytes_4 and ComputeHash_2.
You've saved me a ton of time. Now I'm struggling with using the
equivalent of Convert.ToBase64String. Any help here would be greatly
appreciated as well. Thanks in advance!
>>>>

Out of curiosity I was playing around with this as well. However not with
much success:-

Option Explicit

Dim oBase64 : Set oBase64 =
CreateObject("System.Security.Cryptography.ToBase64Transform")
Dim oUTF8 : Set oUTF8 = CreateObject("System.Text.UTF8Encoding")
Dim oMD5 : set oMD5 =
CreateObject("System.Security.Cryptography.MD5CryptoServiceProvider")

Dim abyt : abyt = oUTF8.GetBytes_4("Hello World")

oMD5.Initialize()

abyt = oMD5.ComputeHash_2(abyt)

MsgBox oBase64.TransformFinalBlock(abyt, 0, Len(abyt))

I get an Invalid procedure call or argument on ComputeHash_2.


--
Anthony Jones - MVP ASP/ASP.NET