Android agent 1.3.0
Actual behavior
After a fresh MDM enrollment, the Android agent immediately attempts certificate enrollment. The AMAPI policy grants the app CERT_INSTALL delegated scope, but this delegation is applied asynchronously and may not be available by the time the app runs. When the app calls DevicePolicyManager.installKeyPair(null, ...) before the delegation is active, Android throws:
java.lang.SecurityException: Calling identity is not authorized
To fix
-
Gate the entire enrollment flow on delegation availability.
-
Add a defensive delegation check in AndroidCertificateInstaller.
-
Improve failure messages.
Steps to reproduce
These steps:
- Set up a certificate template.
- Enroll a new Android device using manual enrollment.
- Wait for cert to be requested (you may see this error in the app)
- If not, try unenrolling, restarting device, and enrolling again. (Make sure your CA allows certs with the same CN. Maybe:
scepserver -depot depot -port 8088 -challenge=bozo --allowrenew 0
Android agent 1.3.0
Actual behavior
After a fresh MDM enrollment, the Android agent immediately attempts certificate enrollment. The AMAPI policy grants the app
CERT_INSTALLdelegated scope, but this delegation is applied asynchronously and may not be available by the time the app runs. When the app callsDevicePolicyManager.installKeyPair(null, ...)before the delegation is active, Android throws:To fix
Gate the entire enrollment flow on delegation availability.
Add a defensive delegation check in
AndroidCertificateInstaller.Improve failure messages.
Steps to reproduce
These steps:
scepserver -depot depot -port 8088 -challenge=bozo --allowrenew 0