Thursday, September 25, 2008


Authentication -- Step by step process

--------------------------------------

1. Calculate HMAC of WBXML document.

2. Convert hash result to hex clear string (ascii).


3. Convert asciiMAC to decimal bytes


4. Convert decimalMAC to HEX


5. Get digest from PUSH headers.


6. Compare calculated digest with the digest extracted from push headers.


7. If both digests are comparable then AUTHENTICATION success.



In Detail :Example


1. HMAC of WBXML Document : 3ae41325f8f67ba7cffe73b52b3b6ab3c301016


2. 3ae4 ==> convert each digit to ASCII 33:3A :3E :34


3. 33:3A :3E :34 ==> If the ASCII is not a decimal number (0-9) convert to alphabet : Convert to alphanumeric


If ASCII > 0x39 its not a decimal number so convert to alphabet

a. 0x33 < 0x39 --> 0x33

b. 0x3A > 0x39 --> 0x61 (0x3A + 0x27 :: converting into lower case alphabet ,

Motorola documents shows they are converting to uppercase alphabet )

c. 0x3E > 0x39 --> 0x65

d. 0x34 < 0x39 --> 0x34


3ae4 ==> 0x33 : 0x61 : 0x65 : 0x34


4. Final hash is of 40 byte string.



Detailed example from SonyEricsson Guide : TESTED



Simple example


This example creates an Internet account with the name PROV_NAP with GPRS as bearer. The authentication username will be "foo" and the password will be "bar".


The PIN code for this document is "1111".



00//TransactionID


06//PDUType:Push


2F//HeadersLength


1F//ValueLength,LongLengthIndicator


2D//ValueLength,


B6//MediaType:application/vnd.wap.connectivity-wbxml(June2000)


91//SECParameter


81//Value:USERPIN(0x01),IsShortInteger(0x80)


92//MACParameter


33616534313332356638


66363762613763666665


37336235326233623661


62336333303130313637


//MACValue:"3ae41325f8f67ba7cffe73b52b3b6ab3c301016"


//AssociatedPINis"1111"


00//Endofstring


//Endofheaders,StartofWBXML


02//WBXMLVersion1.2


0B//DocumentPublicIdentifier:-//WAPFORUM//DTDPROV1.0//EN


6A//Charset:UTF-8


00//StringTableLength:00


45//<wap-provisioning>element,contentincluded


C6//<characteristic>element,attributesincluded,content//included


55//attribute,type="NAPDEF"


01//endoftag


87//<parm/>element,attributesincluded


11//attribute,name="NAPID"


06//attribute,value=


03//inlinestring


50524F565F4E4150 //"PROV_NAP"


00//endofstring


01//endoftagand<parm/>element


87//<parm/>element,attributesincluded


10//attribute,name="BEARER"


06//attribute,value=


AB//"GSM-GPRS"


01//endoftagand<parm/>element


87//<parm/>element,attributesincluded


07//attribute,name="NAME"


06//attribute,value=


03//inlinestring


50524F565F4E4150 //"PROV_NAP"


00//endofstring


01//endoftagand<parm/>element


C6//<characteristic>element,attributesincluded,content//included


5A//attribute,type="NAPAUTHINFO"


01//Endoftag


87//<parm/>element,attributesincluded


0C//attribute,name="AUTHTYPE"


06//attribute,value=


9A//"PAP"


01//endoftagand<parm/>element


87//<parm/>element,attributesincluded


0D//attribute,name="AUTHNAME"


06//attribute,value=


03//inlinestring


666F6F //"foo"


00//endofstring


01//endoftagand<parm/>element


87//<parm/>element,attributesincluded


0E//attribute,name="AUTHSECRET"


06//attribute,value=


03//inlinestring


626172 //"bar"


00//endofstring


01//endoftagand<parm/>element


01//</characteristic>tag,endofelement


01//</characteristic>tag,endofelement


01//</wap-provisioning>tag,endofelement

Labels:

test

fqej;vkgbl';vl
yrrrrrrrrrrrrrrrr
errrrrrrrrrr