細(xì)節(jié)調(diào)研之Minimum Device Password Complex Characters

細(xì)節(jié)調(diào)研之Minimum Device Password Complex Characters

導(dǎo)讀

Minimum Device Password Complex Characters,測(cè)試同事稱之為最小字符集。遺憾的是,測(cè)試同事并不能對(duì)這個(gè)“最小字符集”的具體含義說出個(gè)所以然來,只是拿出測(cè)試用例來進(jìn)行測(cè)試。而在Exchange應(yīng)用的代碼實(shí)現(xiàn)中,Minimum Device Password Complex Characters是用來限制非字母字符的長(zhǎng)度。測(cè)試同事有時(shí)并不接受這個(gè)解釋,只是以測(cè)試用例為準(zhǔn),所以就有了這篇文檔。這篇文檔用來弄明白Minimum Device Password Complex Characters的具體含義是什么。

一、Android的Exchange應(yīng)用中的實(shí)現(xiàn)

在Android的Exchange實(shí)現(xiàn)中,MinDevicePasswordComplexCharacters是基于非字母字符的個(gè)數(shù)確定的?;谌缦路椒▽?shí)現(xiàn)。

DevicePolicyManager #setPasswordMinimumNonLetter()

Called by an application that is administering the device to set the minimum number of non-letter characters (numerical digits or symbols) required in the password.

其具體代碼類似如下:

// the user must have entered a password containing at least a letter, a numerical digit 
// and a special symbol, by default.
dpm.setPasswordQuality(mAdminName, DevicePolicyManager.PASSWORD_QUALITY_COMPLEX);

dpm.setPasswordMinimumSymbols(mAdminName, 0);
dpm.setPasswordMinimumNumeric(mAdminName, 0);
dpm.setPasswordMinimumNonLetter(mAdminName, policy.mPasswordComplexChars);

該段代碼的含義是,MinDevicePasswordComplexCharacters的值(policy.mPasswordComplexChars)等同于密碼中包含非字母字符的個(gè)數(shù)。而這個(gè)解釋對(duì)測(cè)試部給出的測(cè)試用例并不能全部通過。所以,很有必要搞清楚、搞明白MinDevicePasswordComplexCharacters的具體含義。

由于Minimum Device Password Complex Characters是微軟提出的,故在微軟的官網(wǎng)中找到了一下Minimum Device Password Complex Characters的解釋。

二、微軟的解釋

在微軟官網(wǎng)中找到了如下三種解釋,不幸的是,這幾種解釋并不一致。從這里也可以看出,測(cè)試同事說不出個(gè)所以然來也是正?,F(xiàn)象。作為該項(xiàng)概念的提出者來說,都沒有給出一個(gè)統(tǒng)一的解釋。

2.1 第一個(gè)解釋

在微軟的官網(wǎng)中Understanding Exchange ActiveSync Mailbox Policies[ 1 ]中給出了Minimum device password complex characters的解釋,如下

 Minimum device password complex characters

This setting specifies the minimum number of complex characters required in a mobile phone password. A complex character is any character that is not a letter.

這個(gè)解釋字面意思是,Minimum device password complex characters,該項(xiàng)用于設(shè)置手機(jī)密碼時(shí),指定的復(fù)雜字符的最小值。一個(gè)復(fù)雜字符是任意一個(gè)非字母字符。該解釋與與我們的Exchange代碼實(shí)現(xiàn)相同。

2.2 第二個(gè)解釋

這個(gè)是在一份微軟的Policy CSP[ 2 ]文檔中找到的,該解釋適用于Can be set using Exchange Active Sync (EAS)。

DeviceLock/MinDevicePasswordComplexCharacters

The number of complex element types (uppercase and lowercase letters, numbers, and punctuation) required for a strong PIN or password.

Note
This policy must be wrapped in an Atomic command.
Always use the Replace command instead of Add for this policy in Windows 10 for desktop editions.
PIN enforces the following behavior for desktop and mobile devices:

  • 1 - Digits only
  • 2 - Digits and lowercase letters are required
  • 3 - Digits, lowercase letters, and uppercase letters are required
  • 4 - Digits, lowercase letters, uppercase letters, and special characters are required

其中,字符集合說明:

* English uppercase characters (A through Z)
* English lowercase characters (a through z)
* Base 10 digits (0 through 9)
* Special characters (!, $, #, %, etc.)

這個(gè)解釋字面意思是,Minimum device password complex characters是復(fù)雜元素類型(大寫字母、小寫字母、數(shù)字、標(biāo)點(diǎn)符號(hào))的數(shù)量。該項(xiàng)符合邏輯,也與Exchange服務(wù)器中Minimum device password complex characters的取值是[1, 4]相匹配。

不考慮其它,我傾向于使用這種解釋來說明Minimum device password complex characters。

2.3 第三個(gè)解釋

這個(gè)是在EAS協(xié)議的Exchange ActiveSync: Provisioning Protocol[ 3 ]的2.2.2.36 MinDevicePasswordComplexCharacters給出了解釋。當(dāng)然,對(duì)于Exchange來說,這是最權(quán)威的一種。

Valid values for MinDevicePasswordComplexCharacters are 1 to 4. The value specifies the number of character groups that are required to be present in the password. The character groups are defined as:

  • Lower case alphabetical characters
  • Upper case alphabetical characters
  • Numbers
  • Non-alphanumeric characters

For example, if the value of MinDevicePasswordComplexCharacters is 2, a password with both upper case and lower case alphabetical characters would be sufficient, as would a password with lower case alphabetical characters and numbers.

這個(gè)解釋字面意思是,Minimum device password complex characters是在密碼中需要被使用的字符集的數(shù)量。和第二種解釋類似,但也是有區(qū)別的。如果Minimum device password complex characters的值為2,在這種解釋中,只包含大小寫字母也是滿足的,而在第二種解釋是密碼中必須包含數(shù)字和小寫字母。

這種解釋是最規(guī)范最合理的,但在當(dāng)前的Android框架中,并不支持該種方式的實(shí)現(xiàn)。要完成這種方式,需要修改Android框架層代碼。

三、測(cè)試部相關(guān)的測(cè)試用例

  1. the value of MinDevicePasswordComplexCharacters is 1

當(dāng)the value of MinDevicePasswordComplexCharacters is 1,有下面一條測(cè)試用例,不符合實(shí)現(xiàn)。

將Exchange服務(wù)器中賬戶對(duì)應(yīng)的密碼策略中設(shè)置“最小字符集”1, 2、手機(jī)上建立Exchange郵件賬戶,設(shè)置手機(jī)鎖屏密碼 (1):1abc、12ab、12AB、1@Aa、1@#A(至少包含1個(gè)數(shù)字和一個(gè)字母) (2):1111、aces、adgdD、AETD、#@%@、231@、#adfa、%ADFG;3、登陸賬戶后,按電源鍵休眠喚醒輸入設(shè)置的鎖屏密碼
期待 (1)可以設(shè)置成功 (2)設(shè)置不成功。 3、能夠正常解鎖。

實(shí)際情況是,“#adfa”和“%ADFG”可以設(shè)置成功。這兩個(gè)密碼序列的非字母的個(gè)數(shù)均為1,滿足微軟的第一種解釋[ 1 ],也滿足Exchange代碼實(shí)現(xiàn),可以設(shè)置成功是正常現(xiàn)象。

  1. the value of MinDevicePasswordComplexCharacters is 2

當(dāng)the value of MinDevicePasswordComplexCharacters is 2,有下面一條測(cè)試用例,不符合實(shí)現(xiàn)。

設(shè)置手機(jī)鎖屏密碼:#adfa、%ADFG、1abc、1@#A,設(shè)置不成功

實(shí)際情況是,“1@#A”可以設(shè)置成功。因?yàn)槠浞亲帜傅膫€(gè)數(shù)為3,滿足Exchange的代碼實(shí)現(xiàn)。也滿足微軟的第一種解釋[ 1 ]。

四、結(jié)論

MinDevicePasswordComplexCharacters只是一種安全策略,其值是密碼安全等級(jí)。故,只需要依據(jù)其值對(duì)密碼的安全進(jìn)行分級(jí)保護(hù)即可,沒有必要全盤依據(jù)官方解釋來實(shí)現(xiàn)。再說,微軟官方也沒用給出一個(gè)統(tǒng)一的解釋。故,建議遵循現(xiàn)有的代碼實(shí)現(xiàn)。如果在以后,局方對(duì)這種實(shí)現(xiàn)有異議,可以使用微軟第一種解釋[ 1 ]來解釋當(dāng)前的實(shí)現(xiàn)。如果局方堅(jiān)決不認(rèn)同這種解釋,可以嘗試使用第二種解釋[ 2 ]來修改代碼。對(duì)于第三種解釋[ 3 ],當(dāng)前的Android框架并不支持,需要對(duì)框架層代碼進(jìn)行擴(kuò)展,工作量太大,不建議做。

參考目錄

  1. https://technet.microsoft.com/en-us/library/bb123484(v=exchg.141).aspx "Understanding Exchange ActiveSync Mailbox Policies"
  2. https://msdn.microsoft.com/en-us/library/windows/hardware/dn904962(v=vs.85).aspx "Policy CSP"
  3. https://msdn.microsoft.com/en-us/library/ee201726(v=exchg.80).aspx "Exchange ActiveSync: Provisioning Protocol"
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,511評(píng)論 19 139
  • 背景 一年多以前我在知乎上答了有關(guān)LeetCode的問題, 分享了一些自己做題目的經(jīng)驗(yàn)。 張土汪:刷leetcod...
    土汪閱讀 12,891評(píng)論 0 33
  • 春風(fēng)吹呀吹,吹進(jìn)我的胸膛,讓生命的歌,歌頌美好的家鄉(xiāng).風(fēng)起花落的時(shí)候,總是回憶你的面龐,現(xiàn)在的你是否過得比我好。就...
    2016文藝閱讀 306評(píng)論 0 1
  • 一碗米粥,一抹心情。一份早餐,一縷人生。 早上六點(diǎn),天色微明。站在客廳的飄窗前眺望遠(yuǎn)山,青色氤氳,一片蜿蜒。拿起噴...
    湯河水閱讀 1,305評(píng)論 22 22
  • 毛姆說,閱讀是一所隨身攜帶的小型避難所。其實(shí),畫畫也是。 重拾畫筆很偶然。 以前我是畫工筆畫的,那很需要時(shí)間,需要...
    唐糖醬閱讀 1,193評(píng)論 10 9

友情鏈接更多精彩內(nèi)容