IMSI国际移动用户识别码(International Mobile Subscriber Identification Number)是区别移动用户的标志,储存在SIM卡中,可用于区别移动用户的有效信息。
IMSI是15位的十进制数,其结构为:MCC+MNC+MSIN
MCC(Mobile Country Code,移动国家码)MCC的资源由国际电联(ITU)统一分配和管理,唯一识别移动用户所属的国家,共3位
在SIM卡中MCC就是IMSI的前三位,位于6F07文件下面
卡1:460040181839878
=>0x00 0xa4 0x00 0x04 0x02
<=0xa4
=>0x6f 0x07
<=0x61 0x19
=>0x00 0xC0 0x00 0x00 0x19
<=0xC0 0x62 0x17 0x82 0x02 0x41 0x21 0x83 0x02 0x6F 0x07 0x8A 0x01 0x05 0x8B 0x03 0x6F 0x06 0x03 0x80 0x02 0x00 0x09 0x88 0x01 0x38 0x90 0x00
=>0x00 0xb0 0x00 0x00 0x09
<=0xB0 0x08 0x49 0x06 0x11 0x11 0x41 0x21 0x88 0x46 0x90 0x00
卡2:310410890453511
=>0x00 0xa4 0x00 0x04 0x02
<=0xa4
=>0x6f 0x07
<=0x61 0x1e
=>0x00 0xc0 0x00 0x00 0x1e
<=0xc0 0x62 0x1c 0x82 0x02 0x41 0x21 0x83 0x02 0x6f 0x07 0xa5 0x03 0x80 0x01 0x71 0x8a 0x01 0x05 0x8b 0x03 0x6f 0x06 0x04 0x80 0x02 0x00 0x09 0x88 0x01 0x38 0x90 0x00
=>0x00 0xb0 0x00 0x00 0x09
<=0xb0 0x08 0x39 0x01 0x14 0x80 0x09 0x54 0x53 0x11 0x90 0x00
byte1为长度,byte2的低位为校验位,后面的几个byte都是高低位先反的,所以拼接的时候要注意。
或者可以使用AT命令进行读:
AT+CIMI
460040181839878
OK
下面列出各国家的MCC:
MCC | 国家 | MCC | 国家 |
---|---|---|---|
202 | “Greece”, “GR”, “希腊” | 204 | “Netherlands, The”, “NL”, “荷兰” |
206 | “Belgium”, “BE”, “比利时” | 208 | “France”, “FR”, “法国” |
213 | “Andorra”, “AD”, “安道尔共和国” | 214 | “Spain”, “ES”, “西班牙” |
216 | “Hungary”, “HU”, “匈牙利” | 218 | “Bosnia and Herzegovina”, “BA”, “” |
219 | “Croatia”, “HR”, “克罗地亚” | 220 | “Serbia and Montenegro”, “CS”, “塞尔维亚和黑山” |
222 | “Italy”, “IT”, “意大利” | 226 | “Romania”, “RO”, “罗马尼亚” |
228 | “Switzerland”, “CH”, “瑞士” | 230 | “Czech Republic”, “CZ”, “捷克” |
231 | “Slovakia”, “SK”, “斯洛伐克” | 232 | “Austria”, “AT”, “奥地利” |
234 | “United Kingdom”, “GB”, “英国” | 238 | “Denmark”, “DK”, “丹麦” |
240 | “Sweden”, “SE”, “瑞典” | 242 | “Norway”, “NO”, “挪威” |
244 | “Finland”, “FI”, “芬兰” | 246 | “Lithuania”, “LT”, “立陶宛” |
247 | “Latvia”, “LV”, “拉脱维亚” | 248 | “Estonia”, “EE”, “爱沙尼亚” |
250 | “Russia”, “RU”, “俄罗斯” | 255 | “Ukraine”, “UA”, “乌克兰” |
257 | “Belarus”, “BY”, “” | 259 | “Moldova”, “MD”, “” |
260 | “Poland”, “PL”, “波兰” | 262 | “Germany”, “DE”, “德国” |
266 | “Gibraltar”, “GI”, “直布罗陀” | 268 | “Portugal”, “PT”, “葡萄牙” |
270 | “Luxembourg”, “LU”, “卢森堡” | 272 | “Ireland”, “IE”, “爱尔兰” |
274 | “Iceland”, “IS”, “冰岛” | 276 | “Albania”, “AL”, “阿尔巴尼亚” |
278 | “Malta”, “MT”, “马耳他” | 280 | “Cyprus”, “CY”, “塞浦路斯” |
282 | “Georgia”, “GE”, “乔治亚州” | 283 | “Armenia”, “AM”, “亚美尼亚” |
284 | “Bulgaria”, “BG”, “保加利亚” | 286 | “Turkey”, “TR”, “土耳其” |
288 | “Faroe Islands”, “FO”, “” | 290 | “Greenland”, “GL”, “格陵兰岛” |
293 | “Slovenia”, “SI”, “斯洛文尼亚” | 294 | “Macedonia, Former Yugoslav Republic of”,“MK”, “” |
295 | “Liechtenstein”, “LI”, “” | 302 | “Canada”, “CA”, “加拿大” |
310 | “United States”, “US”, “美国” | 334 | “Mexico”, “MX”, “墨西哥” |
338 | “Jamaica”, “JM”, “牙买加” | 340 | “French West Indies”, “FW”, “” |
342 | “Barbados”, “BB”, “” | 344 | “Antigua and Barbuda”, “AG”, “” |
346 | “Cayman Islands”, “KY”, “” | 350 | “Bermuda”, “BM”, “百慕大” |
352 | “Grenada”, “GD”, “” | 362 | “Netherlands Antillies”, “AN”, “” |
363 | “Aruba”, “AW”, “” | 368 | “Cuba”, “CU”, “古巴” |
370 | “Dominican Republic”, “DO”, “” | 374 | “Trinidad and Tobago”, “TT”, “” |
400 | “Azerbaijan”, “AZ”, “” | 401 | “Kazakhstan”, “KZ”, “哈萨克” |
402 | “Bhutan”, “BT”, “不丹” | 404 | “India”, “IN”, “印度” |
410 | “Pakistan”, “PK”, “巴基斯坦” | 412 | “Afghanistan”, “AF”, “阿富汗” |
413 | “Sri Lanka”, “LK”, “” | 414 | “Myanmar”, “MM”, “缅甸” |
415 | “Lebanon”, “LB”, “黎巴嫩” | 416 | “Jordan”, “JO”, “约旦” |
417 | “Syria”, “SY”, “叙利亚” | 418 | “Iraq”, “IQ”, “伊拉克” |
419 | “Kuwait”, “KW”, “科威特” | 420 | “Saudi Arabia”, “SA”, “” |
421 | “Yemen”, “YE”, “也门” | 422 | “Oman”, “OM”, “阿曼” |
424 | “United Arab Emirates”,“UAE”, “阿拉伯联合酋长国” | 425 | “Israel”, “IL”, “以色列” |
426 | “Bahrain”, “BH”, “巴林岛” | 427 | “Qatar”, “QA”, “卡塔尔” |
428 | “Mongolia”, “MN”, “蒙古” | 429 | “Nepal”, “NP”, “尼泊尔” |
432 | “Iran”, “IR”, “伊朗” | 434 | “Uzbekistan”, “UZ”, “乌兹别克斯坦” |
437 | “Kyrgyzstan”, “KG”, “” | 438 | “Turkmenistan”,“TM”, “土库曼斯坦” |
440 | “Japan”,“JP”,日本 | 452 | “Vietnam”, “VN”, “越南” |
454 | “Hong Kong”, “HK”, “香港” | 456 | “Cambodia”, “KH”, “柬埔寨” |
457 | “Laos”, “LA”, “老挝” | 460 | “China”, “CN”, “中国” |
466 | “Taiwan”, “TW”, “台湾” | 467 | “North Korea”, “KP”, “南韩” |
470 | “Bangladesh”, “BD”, “孟加拉国” | 472 | “Maldives”, “MV”, “马尔代夫” |
502 | “Malaysia”, “MY”, “马来西亚” | 505 | “Australia”, “AU”, “澳大利亚” |
510 | “Indonesia”, “ID”, “印尼” | 515 | “Philippines”, “PH”, “菲律宾” |
520 | “Thailand”, “TH”, “泰国” | 525 | “Singapore”, “SG”, “新加坡” |
528 | “Brunei”, “BN”, “汶莱” | 530 | “New Zealand”, “NZ”, “” |
539 | “Tonga”, “TO”, “东加” | 541 | “Vanuatu”, “VU”, “” |
542 | “Fiji Islands”,“FJ”, “” | 544 | “American Samoa”, “AS”, “萨摩亚” |
546 | “New Caledonia”,“NC”, “” | 547 | “French Polynesia”,“PF”, “波利尼西亚” |
550 | “Micronesia”, “FM”, “” | 602 | “Egypt”, “EG”, “埃及” |
603 | “Algeria”, “DZ”, “阿尔及利亚” | 604 | “Morocco”, “MA”, “摩洛哥” |
605 | “Tunisia”, “TN”, “突尼斯” | 607 | “Gambia, The”, “GM”, “冈比亚” |
608 | “Senegal”, “SN”, “塞内加尔” | 609 | “Mauritania”, “MR”, “” |
610 | “Mali”, “ML”, “马里” | 611 | “Guinea”, “GN”, “几内亚” |
612 | “C?te d’Ivoire”, “CI”, “” | 613 | “Burkina Faso”, “BF”, “” |
614 | “Niger”, “NE”, “” | 615 | “Togo”, “TG”, “多哥” |
616 | “Benin”, “BJ”, “贝南” | 617 | “Mauritius”, “MU”, “毛里求斯” |
618 | “Liberia”, “LR”, “利比里亚” | 620 | “Ghana”, “GH”, “加纳” |
621 | “Nigeria”, “NG”, “尼日利亚” | 622 | “Chad”, “TD”, “乍得” |
623 | “Central African Republic”,“CF”, “中非” | 624 | “Cameroon”, “CM”, “喀麦隆” |
625 | “Cape Verde”, “CV”, “” | 626 | “S?o Tomé and Príncipe”, “ST”, “” |
627 | “Equatorial Guinea”, “GQ”, “” | 628 | “Gabon”, “GA”, “加蓬” |
629 | “Congo”, “CG”, “刚果” | 630 | “Congo (DRC)”, “CD”, “刚果” |
631 | “Angola”, “AO”, “安哥拉” | 633 | “Seychelles”, “SC”, “” |
634 | “Mozambique”, “MZ”, “莫桑比克” | 634 | “Sudan”, “SD”, “苏丹” |
635 | “Rwanda”, “RW”, “卢安达” | 636 | “Ethiopia”, “ET”, “埃塞俄比亚” |
637 | “Somalia”, “SO”, “索马里” | 639 | “Kenya”, “KE”, “肯尼亚” |
640 | “Tanzania”, “TZ”, “坦桑尼亚” | 641 | “Uganda”, “UG”, “乌干达” |
642 | “Burundi”, “BI”, “布隆迪” | 646 | “Madagascar”, “MG”, “马达加斯加” |
647 | “Reunion”, “RE”, “” | 648 | “Zimbabwe”, “ZW”, “津巴布韦” |
649 | “Namibia”, “NA”, “纳米比亚” | 650 | “Malawi”, “MW”, “马拉维” |
651 | “Lesotho”, “LS”, “” | 652 | “Botswana”, “BW”, “” |
653 | “Swaziland”, “SZ”, “” | 654 | “Zambia”, “ZM”, “赞比亚” |
655 | “South Africa”,“ZA”, “南非” | 702 | “Belize”, “BZ”, “” |
706 | “El Salvador”, “SV”, “” | 710 | “Nicaragua”, “NI”, “尼加拉瓜” |
712 | “Costa Rica”, “CR”, “” | 716 | “Peru”, “PE”, “秘鲁” |
722 | “Argentina”, “AR”, “阿根廷” | 724 | “Brazil”, “BR”, “巴西” |
730 | “Chile”, “CL”, “智利” | 734 | “Venezuela”, “VE”, “委内瑞拉” |
736 | “Bolivia”, “BO”, “玻利维亚” | 744 | “Paraguay”, “PY”, “巴拉圭” |
746 | “Suriname”, “SR”, “” |
Mobile Network Code,移动网络码,2/3位。如:中国移动TD系统使用00,中国联通GSM系统使用01,中国移动GSM系统使用02,中国电信CDMA系统使用03。
由于MNC的位数是不一定的,虽然国内固定是2位,但是有些运营商的MNC为3位,如加拿大的ROGERS:302720,ATT:310410。那我们以什么为依据判断是几位呢?
在EF文件里的6FAD(Administrative Data) 可以判断:
可以看到第4个byte表示MNC的长度。
卡1:460040181839878
=>0x00 0xa4 0x00 0x04 0x02
<=0xa4
=>0x6f 0xad
<=0x61 0x1e
=>0x00 0xc0 0x00 0x00 0x1e
<=0xc0 0x62 0x1c 0x82 0x02 0x41 0x21 0x83 0x02 0x6f 0xad 0xa5 0x03 0x80 0x01 0x71 0x8a 0x01 0x05 0x8b 0x03 0x6f 0x06 0x09 0x80 0x02 0x00 0x04 0x88 0x01 0x18 0x90 0x00
=>0x00 0xb0 0x00 0x00 0x04
<=0xb0 0x00 0x00 0x00 0x02 0x90 0x00 //2位MNC
卡2:310410890453511
=>0x00 0xa4 0x00 0x04 0x02
<=0xa4
=>0x6f 0xad
<=0x61 0x1e
=>0x00 0xc0 0x00 0x00 0x1e
<=0xc0 0x62 0x1c 0x82 0x02 0x41 0x21 0x83 0x02 0x6f 0xad 0xa5 0x03 0x80 0x01 0x71 0x8a 0x01 0x05 0x8b 0x03 0x6f 0x06 0x09 0x80 0x02 0x00 0x04 0x88 0x01 0x18 0x90 0x00
=>0x00 0xb0 0x00 0x00 0x04
<=0xb0 0x00 0x00 0x00 0x03 0x90 0x00 //3位MNC
MSIN(Mobile Subscriber Identification Number,移动用户识别号码):用以识别某一移动通信网中的移动用户。
共有9/10位,其结构如下:EF+M0M1M2M3+ABCD;
其中,EF由运营商分配,如MNC为3为时者没有EF数据;
M0M1M2M3和MDN(Mobile Directory Number,移动用户号码簿号码)中的H0H1H2H3可存在对应关系;
ABCD:四位,自由分配。
参考文献:3GPP,ISO7816,百度百科等