[Sony Xperia XZ1 Compact Questions & Answers] j4nn:
attest key check with unlocked xz1c

With unlocked xz1c having untouched persist partition (and therefore Android Attest Key provisioned) we can get following results with the above Auditor-v7-mod-debug.apk (there was no secd-ignore patch and TA was not restored from locked backup yet):

certificates chain (that includes TEE info block, though not parsed here) is fully verified even when device was unlocked and it's device master key was erased

Certificate[0] { Certificate:
Data:
Version: 3 (0x2)
Serial Number: 1 (0x1)
Signature Algorithm: ecdsa-with-SHA256
Issuer: serialNumber=8be790f5ac9dd9a0
Validity
Not Before: Nov 22 08:23:51 2017 GMT
Not After : Feb 7 06:28:15 2106 GMT
Subject: CN=Android Keystore Key
Subject Public Key Info:
Public Key Algorithm: id-ecPublicKey
Public-Key: (256 bit)
<...>
X509v3 extensions:
X509v3 Key Usage: critical
Digital Signature
1.3.6.1.4.1.11129.2.1.17:
<...>
Signature Algorithm: ecdsa-with-SHA256
<...>
} verified
with public key[1] { Public-Key: (256 bit)
00000000 04 8a 10 2e 77 62 2a 88 fa f9 9d 61 d6 8b 2e 16 |....wb*....a....|
00000010 bd 6c c9 b2 b8 87 0d 61 b7 c6 5e 2a 72 3a 87 1d |.l.....a..^*r:..|
00000020 ca 8d 76 de 11 64 13 3d 00 f6 f1 b9 32 ca fb a0 |..v..d.=....2...|
00000030 30 a5 97 21 66 67 49 22 f9 c6 5d 40 62 2f ef 32 |0..!fgI"..]@b/.2|
00000040 f6 |.|
}
Certificate[1] { Certificate:
Data:
Version: 3 (0x2)
Serial Number:
02:37:74:34:17:90:46:20:07:20
Signature Algorithm: ecdsa-with-SHA256
Issuer: serialNumber=5b0359cca8879cb5
Validity
Not Before: May 26 16:44:33 2016 GMT
Not After : May 24 16:44:33 2026 GMT
Subject: serialNumber=8be790f5ac9dd9a0
Subject Public Key Info:
Public Key Algorithm: id-ecPublicKey
Public-Key: (256 bit)
00000000 04 8a 10 2e 77 62 2a 88 fa f9 9d 61 d6 8b 2e 16 |....wb*....a....|
00000010 bd 6c c9 b2 b8 87 0d 61 b7 c6 5e 2a 72 3a 87 1d |.l.....a..^*r:..|
00000020 ca 8d 76 de 11 64 13 3d 00 f6 f1 b9 32 ca fb a0 |..v..d.=....2...|
00000030 30 a5 97 21 66 67 49 22 f9 c6 5d 40 62 2f ef 32 |0..!fgI"..]@b/.2|
00000040 f6 |.|
X509v3 extensions:
X509v3 Subject Key Identifier:
E3:E5:46:6F:E6:38:D3:70:79:25:2A:AE:41:E2:36:EE:8F:57:80:1B
X509v3 Authority Key Identifier:
keyid:06:DD:EE:0A:92:1D:9B:71:E1:C6:89:41:44:EF:39:39:70:26:00:35

X509v3 Basic Constraints: critical
CA:FALSE
X509v3 Key Usage: critical
Digital Signature
X509v3 Name Constraints:
Permitted:
DNS:invalid;email:invalid

X509v3 CRL Distribution Points:

Full Name:
URI:https://android.googleapis.com/attestation/crl/02377434179046200720

Signature Algorithm: ecdsa-with-SHA256
30:66:02:31:00:fb:a4:67:9d:dc:42:a1:a6:ec:dc:2c:20:69:
37:a6:d8:a9:94:fd:78:e1:52:98:02:ba:ff:a5:22:b5:6b:e6:
78:8f:2e:3a:f1:a2:1d:3f:ee:8c:bf:24:23:36:6c:65:cb:02:
31:00:cd:bf:c4:15:1a:74:c3:a7:aa:70:c5:1f:26:40:d8:3a:
16:57:30:c4:e5:88:f5:5a:b9:be:5d:d8:a0:97:e9:86:ad:bf:
eb:e1:ca:31:5d:e2:d6:3c:51:c7:f9:2e:55:cf
} verified
with public key[2] { Public-Key: (384 bit)
00000000 04 77 f8 15 42 93 66 2b c3 bb 07 72 55 b5 f2 3c |.w..B.f+...rU..<|
00000010 5d 76 21 1b 83 cd 92 aa eb 53 1b aa 8a 04 df f8 |]v!......S......|
00000020 31 f6 02 12 f6 91 52 e0 d6 60 19 39 e3 48 c9 ba |1.....R..`.9.H..|
00000030 96 d6 2b 0a fd ec 0f 3b 8f 42 5b 3e 57 e0 4b 3d |..+....;.B[>W.K=|
00000040 08 0d 7d 11 da be 63 fd 7a e9 5c d6 e4 77 18 d8 |..}...c.z.\..w..|
00000050 02 9c aa b1 07 6a 34 41 c4 d0 18 f0 31 24 0f 35 |.....j4A....1$.5|
00000060 73 |s|
}
Certificate[2] { Certificate:
Data:
Version: 3 (0x2)
Serial Number:
03:88:26:67:60:65:89:96:85:73
Signature Algorithm: sha256WithRSAEncryption
Issuer: serialNumber=f92009e853b6b045
Validity
Not Before: May 26 16:41:29 2016 GMT
Not After : May 24 16:41:29 2026 GMT
Subject: serialNumber=5b0359cca8879cb5
Subject Public Key Info:
Public Key Algorithm: id-ecPublicKey
Public-Key: (384 bit)
00000000 04 77 f8 15 42 93 66 2b c3 bb 07 72 55 b5 f2 3c |.w..B.f+...rU..<|
00000010 5d 76 21 1b 83 cd 92 aa eb 53 1b aa 8a 04 df f8 |]v!......S......|
00000020 31 f6 02 12 f6 91 52 e0 d6 60 19 39 e3 48 c9 ba |1.....R..`.9.H..|
00000030 96 d6 2b 0a fd ec 0f 3b 8f 42 5b 3e 57 e0 4b 3d |..+....;.B[>W.K=|
00000040 08 0d 7d 11 da be 63 fd 7a e9 5c d6 e4 77 18 d8 |..}...c.z.\..w..|
00000050 02 9c aa b1 07 6a 34 41 c4 d0 18 f0 31 24 0f 35 |.....j4A....1$.5|
00000060 73 |s|
X509v3 extensions:
X509v3 Subject Key Identifier:
06:DD:EE:0A:92:1D:9B:71:E1:C6:89:41:44:EF:39:39:70:26:00:35
X509v3 Authority Key Identifier:
keyid:36:61:E1:00:7C:88:05:09:51:8B:44:6C:47:FF:1A:4C:C9:EA:4F:12

X509v3 Basic Constraints: critical
CA:TRUE
X509v3 Key Usage: critical
Digital Signature, Certificate Sign, CRL Sign
X509v3 CRL Distribution Points:

Full Name:
URI:https://android.googleapis.com/attestation/crl/E8FA196314D2FA18

Signature Algorithm: sha256WithRSAEncryption
2c:3c:53:5b:01:e5:46:45:72:a0:d0:7d:48:c7:2d:f5:9f:eb:
dc:d4:60:2d:2d:3b:5d:ae:e4:06:67:7a:e4:e8:3a:b7:1b:93:
a2:35:fc:0b:23:8b:d1:a3:00:c4:46:04:eb:e5:1a:15:44:c2:
ec:f4:7c:d3:4c:2b:ef:74:40:61:70:82:ca:3a:76:8f:01:de:
89:83:81:ef:06:2f:21:b1:f6:d7:12:f4:62:da:49:88:7e:26:
00:69:b0:bb:d4:4a:c9:2c:51:0c:a6:b4:c9:31:20:c4:39:ed:
e5:5c:22:46:e3:4f:73:f7:da:1f:b1:ff:ec:d4:cd:62:ef:b3:
45:54:2c:2c:b4:0b:d1:2c:c8:dc:f5:38:f1:45:7a:c6:ac:60:
f4:ac:c7:46:d9:19:22:a2:75:da:dc:7f:b8:71:8a:92:51:fe:
c9:08:85:ba:74:c0:76:a7:ee:11:de:7e:3a:dc:3a:b1:c5:22:
4d:19:b7:21:18:65:1b:2f:a6:f4:a8:85:9d:69:57:30:1b:6a:
e8:f9:6c:88:b5:fc:b0:e4:2e:21:f5:74:a8:b1:ab:b2:0b:d6:
a3:8d:92:ed:f1:10:0a:da:8b:99:1c:df:e4:c8:85:dc:0f:55:
3b:20:56:d2:cb:44:99:7d:a4:43:2c:d0:b3:b1:ee:22:2f:a2:
0e:9e:ec:88:4c:41:4b:9e:f2:df:70:34:b0:35:7d:7f:a6:d0:
51:01:e7:a6:7b:b1:b5:9f:0a:5e:a2:12:63:89:d7:66:7f:6d:
1e:e3:6d:7e:9f:7b:56:53:25:21:2e:4f:6c:f3:73:09:41:0a:
7e:9a:17:c0:a4:0d:50:bf:3f:9a:ec:cd:ce:a8:fb:c7:84:1a:
1e:bb:a0:b8:34:e9:58:91:bf:26:ae:3b:6e:67:f4:54:e5:62:
11:5d:fc:97:66:a0:34:e5:09:ee:f2:eb:2e:c7:13:45:a3:35:
39:85:66:d7:21:94:31:ed:ab:76:c7:fe:ed:f3:f9:20:1d:22:
61:2a:ce:21:58:87:5b:56:02:03:c9:62:21:82:80:c3:fa:0a:
93:21:19:73:4f:0a:d2:f3:be:9d:83:2d:0c:4d:99:b5:ae:23:
04:04:1e:63:bc:08:5a:79:c8:83:05:ff:2e:e8:01:56:9c:cb:
12:d1:45:6d:3a:29:eb:e6:54:d1:90:74:b0:89:ed:a7:f7:49:
1a:ce:aa:64:78:c5:1d:9d:b0:52:1b:b1:d2:32:1c:a0:e6:5b:
de:9b:d1:bc:d8:d6:a4:1f:84:b5:10:f8:11:04:b3:75:78:5f:
10:e7:56:66:cd:e3:65:dc:39:c8:18:68:cd:23:e2:c0:5f:0d:
74:29:5b:84:93:38:1d:f0
} verified
with public key[3] { OpenSSLRSAPublicKey{modulus=afb6c7822bb1a701ec2bb42e8bcc541663abef982f32c77f7531030c97524b1b5fe809fbc72aa9451f743cbd9a6f1335744aa55e77f6b6ac3535ee17c25e639517dd9c92e6374a53cbfe258f8ffbb6fd129378a22a4ca99c452d47a59f3201f44197ca1ccd7e762fb2f53151b6feb2fffd2b6fe4fe5bc6bd9ec34bfe08239daafceb8eb5a8ed2b3acd9c5e3a7790e1b51442793159859811ad9eb2a96bbdd7a57c93a91c41fccd27d67fd6f671aa0b815261ad384fa37944864604ddb3d8c4f920a19b1656c2f14ad6d03c56ec060899041c1ed1a5fe6d3440b556bad1d0a152589c53e55d370762f0122eef91861b1b0e6c4c80927499c0e9bec0b83e3bc1f93c72c049604bbd2f1345e62c3f8e26dbec06c94766f3c128239d4f4312fad8123887e06becf567583bf8355a81feeabaf99a83c8df3e2a322afc672bf120b135158b6821ceaf309b6eee77f98833b018daa10e451f06a374d50781f359082966bb778b9308942698e74e0bcd24628a01c2cc03e51f0b3e5b4ac1e4df9eaf9ff6a492a77c1483882885015b422ce67b80b88c9b48e13b607ab545c723ff8c44f8f2d368b9f6520d31145ebf9e862ad71df6a3bfd2450959d653740d97a12f368b13ef66d5d0a54a6e2f5d9a6fef446832bc67844725861f093dd0e6f3405da89643ef0f4d69b6420051fdb93049673e36950580d3cdf4fbd08bc5848395260063,publicExponent=10001} }
Root cert { Certificate:
Data:
Version: 3 (0x2)
Serial Number:
e8:fa:19:63:14:d2:fa:18
Signature Algorithm: sha256WithRSAEncryption
Issuer: serialNumber=f92009e853b6b045
Validity
Not Before: May 26 16:28:52 2016 GMT
Not After : May 24 16:28:52 2026 GMT
Subject: serialNumber=f92009e853b6b045
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (4096 bit)
Modulus:
00:af:b6:c7:82:2b:b1:a7:01:ec:2b:b4:2e:8b:cc:
54:16:63:ab:ef:98:2f:32:c7:7f:75:31:03:0c:97:
52:4b:1b:5f:e8:09:fb:c7:2a:a9:45:1f:74:3c:bd:
9a:6f:13:35:74:4a:a5:5e:77:f6:b6:ac:35:35:ee:
17:c2:5e:63:95:17:dd:9c:92:e6:37:4a:53:cb:fe:
25:8f:8f:fb:b6:fd:12:93:78:a2:2a:4c:a9:9c:45:
2d:47:a5:9f:32:01:f4:41:97:ca:1c:cd:7e:76:2f:
b2:f5:31:51:b6:fe:b2:ff:fd:2b:6f:e4:fe:5b:c6:
bd:9e:c3:4b:fe:08:23:9d:aa:fc:eb:8e:b5:a8:ed:
2b:3a:cd:9c:5e:3a:77:90:e1:b5:14:42:79:31:59:
85:98:11:ad:9e:b2:a9:6b:bd:d7:a5:7c:93:a9:1c:
41:fc:cd:27:d6:7f:d6:f6:71:aa:0b:81:52:61:ad:
38:4f:a3:79:44:86:46:04:dd:b3:d8:c4:f9:20:a1:
9b:16:56:c2:f1:4a:d6:d0:3c:56:ec:06:08:99:04:
1c:1e:d1:a5:fe:6d:34:40:b5:56:ba:d1:d0:a1:52:
58:9c:53:e5:5d:37:07:62:f0:12:2e:ef:91:86:1b:
1b:0e:6c:4c:80:92:74:99:c0:e9:be:c0:b8:3e:3b:
c1:f9:3c:72:c0:49:60:4b:bd:2f:13:45:e6:2c:3f:
8e:26:db:ec:06:c9:47:66:f3:c1:28:23:9d:4f:43:
12:fa:d8:12:38:87:e0:6b:ec:f5:67:58:3b:f8:35:
5a:81:fe:ea:ba:f9:9a:83:c8:df:3e:2a:32:2a:fc:
67:2b:f1:20:b1:35:15:8b:68:21:ce:af:30:9b:6e:
ee:77:f9:88:33:b0:18:da:a1:0e:45:1f:06:a3:74:
d5:07:81:f3:59:08:29:66:bb:77:8b:93:08:94:26:
98:e7:4e:0b:cd:24:62:8a:01:c2:cc:03:e5:1f:0b:
3e:5b:4a:c1:e4:df:9e:af:9f:f6:a4:92:a7:7c:14:
83:88:28:85:01:5b:42:2c:e6:7b:80:b8:8c:9b:48:
e1:3b:60:7a:b5:45:c7:23:ff:8c:44:f8:f2:d3:68:
b9:f6:52:0d:31:14:5e:bf:9e:86:2a:d7:1d:f6:a3:
bf:d2:45:09:59:d6:53:74:0d:97:a1:2f:36:8b:13:
ef:66:d5:d0:a5:4a:6e:2f:5d:9a:6f:ef:44:68:32:
bc:67:84:47:25:86:1f:09:3d:d0:e6:f3:40:5d:a8:
96:43:ef:0f:4d:69:b6:42:00:51:fd:b9:30:49:67:
3e:36:95:05:80:d3:cd:f4:fb:d0:8b:c5:84:83:95:
26:00:63
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
36:61:E1:00:7C:88:05:09:51:8B:44:6C:47:FF:1A:4C:C9:EA:4F:12
X509v3 Authority Key Identifier:
keyid:36:61:E1:00:7C:88:05:09:51:8B:44:6C:47:FF:1A:4C:C9:EA:4F:12

X509v3 Basic Constraints: critical
CA:TRUE
X509v3 Key Usage: critical
Digital Signature, Certificate Sign, CRL Sign
X509v3 CRL Distribution Points:

Full Name:
URI:https://android.googleapis.com/attestation/crl/

Signature Algorithm: sha256WithRSAEncryption
20:c8:c3:8d:4b:dc:a9:57:1b:46:8c:89:2f:ff:72:aa:c6:f8:
44:a1:1d:41:a8:f0:73:6c:c3:7d:16:d6:42:6d:8e:7e:94:07:
04:4c:ea:39:e6:8b:07:c1:3d:bf:15:03:dd:5c:85:bd:af:b2:
c0:2d:5f:6c:db:4e:fa:81:27:df:8b:04:f1:82:77:0f:c4:e7:
74:5b:7f:ce:aa:87:12:9a:88:01:ce:8e:9b:c0:cb:96:37:9b:
4d:26:a8:2d:30:fd:9c:2f:8e:ed:6d:c1:be:2f:84:b6:89:e4:
d9:14:25:8b:14:4b:ba:e6:24:a1:c7:06:71:13:2e:2f:06:16:
a8:84:b2:a4:d6:a4:6f:fa:89:b6:02:bf:ba:d8:0c:12:43:71:
1f:56:eb:60:56:f6:37:c8:a0:14:1c:c5:40:94:26:8b:8c:3c:
7d:b9:94:b3:5c:0d:cd:6c:b2:ab:c2:da:fe:e2:52:02:3d:2d:
ea:0c:d6:c3:68:be:a3:e6:41:48:86:f6:b1:e5:8b:5b:d7:c7:
30:b2:68:c4:e3:c1:fb:64:24:b9:1f:eb:bd:b8:0c:58:6e:2a:
e8:36:8c:84:d5:d1:09:17:bd:a2:56:17:89:d4:68:73:93:34:
0e:2e:25:4f:56:0e:f6:4b:23:58:fc:dc:0f:bf:c6:70:09:52:
e7:08:bf:fc:c6:27:50:0c:1f:66:e8:1e:a1:7c:09:8d:7a:2e:
9b:18:80:1b:7a:b4:ac:71:58:7d:34:5d:cc:83:09:d5:b6:2a:
50:42:7a:a6:d0:3d:cb:05:99:6c:96:ba:0c:5d:71:e9:21:62:
c0:16:ca:84:9f:f3:5f:0d:52:c6:5d:05:60:5a:47:f3:ae:91:
7a:cd:2d:f9:10:ef:d2:32:66:88:59:6e:f6:9b:3b:f5:fe:31:
54:f7:ae:b8:80:a0:a7:3c:a0:4d:94:c2:ce:83:17:ee:b4:3d:
5e:ff:58:83:e3:36:f5:f2:49:da:ac:a4:89:92:37:bf:26:7e:
5c:43:ab:02:ea:44:16:24:03:72:3b:e6:aa:69:2c:61:bd:ae:
9e:d4:09:d4:63:c4:c9:7c:64:30:65:77:ee:f2:bc:75:60:b7:
57:15:cc:9c:7d:c6:7c:86:08:2d:b7:51:a8:9c:30:34:97:62:
b0:78:23:85:87:5c:f1:a3:c6:16:6e:0a:e3:c1:2d:37:4e:2d:
4f:18:46:f3:18:74:4b:d8:79:b5:87:32:9b:f0:18:21:7a:6c:
0c:77:24:1a:48:78:e4:35:c0:30:79:cb:45:12:89:c5:77:62:
06:06:9a:2f:8d:65:f8:40:e1:44:52:87:be:d8:77:ab:ae:24:
e2:44:35:16:8d:55:3c:e4
} is correctly self-signed (i=3)

the attestation data as visible in the log - contains "Device locked: false" and "Verified boot state: Unverified" statements and "Verified boot Key" is different than it is with still locked xz1/xz1c

attestation = {Attest version: 2
Attest security: TEE
KM version: 3
KM security: TEE
Challenge (base64): [+kOhfnc9rovGFq0XQtM0Y9jgLJ4qzqyo1PjK5dBEkMA=]
Unique ID (base64): []
-- SW enforced --
Active: Nov 22, 2017 09:23:51
Created: Nov 22, 2017 09:24:51
Attestation Application Id:AttestationApplicationId:
### Package info 1/1 ###
Package name: app.attestation.auditor
Version: 7
Signature digest 1/1: <...>
-- TEE enforced --
Algorithm: ECDSA
KeySize: 256
Purposes: [SIGN, VERIFY]
Digests: [SHA256]
EC Curve: secp256r1
Origin: Generated
Rollback resistant: true
Root of Trust:

Verified boot Key: D5A45BFFE65EF500725B4BC16E60BA39910D364324F702BE75ED825C1C78A50C
Device locked: false
Verified boot state: Unverified
OS Version: 80000
OS Patchlevel: 201712}

as you can see the TEE block clearly states that unlock status, screenshot attached