[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Help with Sha + Base64 for WSSE encoding.

Gregg Pollack

2/23/2006 7:03:00 PM

Hello there.

I've got a numbers puzzle for someone out there.

I'm currently trying to implement X-WSSE authentication, which
basically means you follow these steps to create a PasswordDigest:

1. Create a random Nonce(or string)
2. create the token by doing Base64(sha(nonce + timestamp + password)

Use this string to autenticate. Basically. Now here's my problem.

I have an example to work from:

Nonce =
MjAwNi0wMi0yM1QxODo1NjozMVogNDdjYzM5NTVlZmY1NzljZGIwMzVkNTljZjI4ZWU3NzE3Y2Y4NmM5Zg==
Timestamp = 2006-02-23T18:56:31Z
password = test

I know the result is supposed to be:
267V1V5JW5xqct0bOAoFEaSDL7Y= (since this works)

But when I use ruby for this:

nonce =
"MjAwNi0wMi0yM1QxODo1NjozMVogNDdjYzM5NTVlZmY1NzljZGIwMzVkNTljZjI4ZWU3NzE3Y2Y4NmM5Zg=="
time = "2006-02-23T18:56:31Z"
password = "test"
puts Base64.encode64(Digest::SHA1.hexdigest(nonce + time +
password)).strip

I get:
MzI2OTQ4YzY4OWQ3MGMxYzMzYTEwZWI2Yzg5MzZiYzMzZGE2ZTJhMg==


Can anyone see the step I'm missing?

Thanks,

Gregg Pollack
Patched Software
www.PatchedSoftware.com

--
Posted via http://www.ruby-....


2 Answers

Tom Copeland

2/23/2006 7:11:00 PM

0

> 1. Create a random Nonce(or string)
> 2. create the token by doing Base64(sha(nonce + timestamp + password)

Cool.

> puts Base64.encode64(Digest::SHA1.hexdigest(nonce + time +
> password)).strip

Hm, do you want to be calling SHA1.hexdigest() here? Or just
SHA1.digest()?

Yours,

Tom



Anthony DeRobertis

2/23/2006 8:51:00 PM

0