[Microid] Encode URLs?
Peter Saint-Andre
stpeter at jabber.org
Mon Apr 16 17:03:05 EDT 2007
James Cridland wrote:
> On 4/16/07, *Peter Saint-Andre* <stpeter at jabber .org
> <mailto:stpeter at jabber.org>> wrote:
>
> James Cridland wrote:
> > Using this PHP code, I get a microid of
> > mailto+http:sha1:1268bb6d577107e328ccc6341e75da96f31277db
> >
> > Using the JavaScript code at http://microid.org/
> <http://microid.org/> and my email address, I get
> > mailto+http:sha1:05d7b7fe2c3a67fab3982b50c9a727c04c9aab9c
> >
> > Do I need to encode URLs or something? (It's not clear from the spec)
>
> AFAICS, URIs within MicroID need to conform to RFC 3986. Therefore
> percent-encoding (%hexhex) would be required for certain characters. For
> your web page address ...
>
> http://www.mediauk.com/discussions/profile.muk?mode=viewprofile&u=1
> <http://www.mediauk.com/discussions/profile.muk?mode=viewprofile&u=1>
>
> ... that would necessitate encoding the characters "&", "=", and "?" as
> "%26", "%3D", and "%3F" ...
>
> http://www.mediauk.com/discussions/profile.muk%3Fmode%3Dviewprofile%26u%3D1
>
> Or so it seems to me.
>
>
>
> Hmm. Still no dice.
>
> I'm now running
>
> sha1( sha1( 'mailto: james at cridland.net <mailto:james at cridland.net>' ) +
> sha1(
> 'http://www.mediauk.com/discussions/profile.muk%3Fmode%3Dviewprofile%26u%3D1
> <http://www.mediauk.com/discussions/profile.muk%3Fmode%3Dviewprofile%26u%3D1>'
> ) );
>
> ...as you suggest, and it's returning:
>
> mailto+http:sha1:ca62a2077ecb201a309102f3d60e9b059e8076f2
>
> Using the JavaScript code at http://microid.org/ <http://microid.org/>
> using the standard URL (as one would expect) and my email address, I get
> mailto+http:sha1:05d7b7fe2c3a67fab3982b50c9a727c04c9aab9c
>
> So, either the JavaScript code is incorrect and doesn't convert the
> standard URL, or my code is incorrect, but either way... bah.
>
> Any clues would be very much appreciated; it would be good to nail this
> one, but as it stands, I'm a little stuck as to what it should be doing.
The JavaScript code on microid.org does not perform any encoding:
function compute()
{
var f = document.forms['gen'];
var com_sha = hex_sha1(f.com.value);
var auth_sha = hex_sha1(f.auth.value);
f.microid.value = "mailto+http:sha1:" + hex_sha1(com_sha+auth_sha);
}
So I think the error is there.
Feel free to contribute corrected code. :)
Peter
--
Peter Saint-Andre
XMPP Standards Foundation
http://www.xmpp.org/xsf/people/stpeter.shtml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 7358 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.ibiblio.org/pipermail/microid/attachments/20070416/59577800/attachment-0001.bin
More information about the Microid
mailing list