the rate of AES encryption
run cts -m CtsSecurityTestCases -t android.security.cts.EncryptionTest#testEncryption
在测试CTS CtsSecurityTestCases 项的时候,会检查手机data区是否加密,加密速度
应该有两种
ConsoleReporter: [0123456789ABCDEF] Starting armeabi-v7a CtsSecurityTestCases with 1 test //测试32位的库
ConsoleReporter: [0123456789ABCDEF] Starting arm64-v8a CtsSecurityTestCases with 1 test //测试64位的库
EncryptionTest::aesIsFast: 100 iterations in 93 ms (1075.3 MiB/s) (threshold 2000 ms) //32位测试结果
EncryptionTest::aesIsFast: 100 iterations in 92 ms (1087.0 MiB/s) (threshold 2000 ms) //64位测试结果
注意:如果手机默认加密了,在测试这样CTS的时候是不会打印上面的加密速度的。
CTS源码,cts/tests/tests/security/src/android/security/cts/EncryptionTest.java
public void testEncryption() throws Exception {
if (!isRequired() || deviceIsEncrypted()) {//如果请求过或者 设备已经加密了,直接返回,不会调用aesIsFast
return;
}
// Required if performance is sufficient
assertFalse("Device encryption is required", aesIsFast());
}
如果想测试加密过的手机,可以修改这部分源码,编译后,替换CTS测试中响应的apk,可以打印出来,但是CTS会测试失败
[arm64-v8a CtsSecurityTestCases 0123456789ABCDEF] android.security.cts.EncryptionTest#testEncryption fail: junit.framework.AssertionFailedError: Device encryption is required