A painful SyncML synchronization protocol error

Source: Internet
Author: User
Tags md5 digest

This morning, I have been turning over the SyncML 1.1 protocol of OMA, Which is stuck in the user verification area. The expected results cannot be calculated based on the Protocol example.

Based on the Protocol text, the MD5 verification algorithm is very simple. It is represented by Pseudo Code as follows:

Result = base64 (MD5 (base64 (MD5 (username + ":" + password) + ":" + nonce ));

Written in PHP:

Function computehash ($ username, $ password, $ nonce ){
Return base64_encode (pack ('H * ', MD5 (base64_encode (pack ('H *', MD5 ("$ username: $ password "))). ": $ nonce ")));
}

However, use the parameters specified in the Protocol:

Username = "bruce1", password = "ohbehave", Nonce = "nonce"

In any case, the value "zz6eivr3yeaaencrn6lpaq =" is not included in the Protocol, but "+ meikfrf8qdou2b1h2ymxw ="

I wrote one with. net, and the results are the same.

Code
/// <Summary>
/// Generate MD5 Digest for SyncML Authentication
/// </Summary>
/// <Param name = "user"> </param>
/// <Param name = "password"> </param>
/// <Param name = "nonce"> </param>
/// <Returns> </returns>
Public static string generatesyncmlmd5 (string user, string password, string nonce)
{
System. Security. cryptography. MD5 MD5 = system. Security. cryptography. md5.create ();

Md5.computehash (encoding. ASCII. getbytes (User + ":" + password ));

String S = convert. tobase64string (md5.hash) + ":" + nonce;

Md5.computehash (encoding. ASCII. getbytes (s ));
Return convert. tobase64string (md5.hash );
}

After searching by multiple parties, I finally found the cause: the Protocol was written incorrectly. The correct parameters should be:

Username = "bruce2", password = "ohbehave", Nonce = "nonce"

I faint...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.