summaryrefslogtreecommitdiff
path: root/identity/aidl/default/IdentityCredential.cpp
AgeCommit message (Collapse)Author
2021-01-05Identity Credential: Switch default implementation to use libeic.David Zeuthen
Introduce platform-neutral C library ("libeic") which can be used to implement an Identity Credential Trusted Application/Applet in Secure Hardware. The libeic library is intentionally low-level, has no dependencies (not even libc), uses very little run-time memory (less than 500 bytes during a provisioning or presentation session), and doesn't dynamically allocate any memory. Crypto routines are provided by the library user through a simple crypto interface defined in EicOps. Also provide an Android-side HAL implementation designed to communicate with libeic running in Secure Hardware outside Android. Abstract out communications between HAL and TA in a couple of SecureHardwareProxy* classes which mimic libeic 1:1. The default implementation of the HAL is a combination of the aforementioned HAL using libeic in-process backed by BoringSSL for the crypto bits. Test: atest VtsHalIdentityTargetTest Test: atest android.security.identity.cts Bug: 170146643 Change-Id: I3bf43fa7fd9362f94023052591801f2094a04607
2020-11-17identity: Fix attestation and documentation problems.David Zeuthen
- The docs said that IdentityCredential.createEphemeralKey() returned data encoded PKCS#8 which is wrong. It's supposed to be in DER format which is also what the VTS tests and credstore expects. - Clarify that createEphemeralKeyPair(), setReaderEphemeralPublicKey(), and createAuthChallenge() are all optional. - Avoid passing an invalid profile ID in the IdentityCredentialTests. verifyOneProfileAndEntryPass test. - Update requirements for which tags must be present in the attestation for CredentialKey as well as the requirements on expiration date and the issuer name. Update default implementation to satisfy these requirements. Update VTS tests to carefully verify these requrements are met. - Clarify requirements for X.509 cert for AuthenticationKey. Add VTS test to verify. - Mandate that TAG_IDENTITY_CREDENTIAL_KEY must not be set for test credentials. Add VTS test to verify this. - Make default implementation pretend to be implemented in a trusted environment and streamline VTS tests to not special-case for the default implementation. - Switch to using the attestation extension parser from the KM 4.1 support library instead of the one from system/keymaster. The latter one did not support the latest attestation extension and thus would fail for pretty much anything that wasn't the default HAL impl. - Fix a couple of bugs in keymaster::V4_1::parse_attestation_record(): - Report root_of_trust.security_level - Add support for Tag::IDENTITY_CREDENTIAL_KEY - Fix how EMacKey is calculated. - Add test vectors to verify how EMacKey and DeviceMac is calculated. Test: atest VtsHalIdentityTargetTest Test: atest android.security.identity.cts Bug: 171745570 Change-Id: I2f8bd772de078556733f769cec2021918d1d7de6
2020-06-24Identity: Update for changes to ISO 18013-5.David Zeuthen
Key derivation for session encryption and MACing now involves mixing in SessionTranscriptBytes. Update docs, default implementation, and VTS tests to reflect this. Also, the standard changed such that instead of DeviceAuthentication being MACed or signed, it's instead DeviceAuthenticationBytes which is defined as #6.24(bstr .cbor DeviceAuthentication). The same also for ReaderAuthentication, now ReaderAuthenticationBytes is the CBOR which is signed by the reader. Also update the URL for CDDL since it's now a published RFC. Bug: 159482543 Test: atest VtsHalIdentityTargetTest Test: atest android.security.identity.cts Change-Id: I73fc7eb48ffb71e00a8b54849266ed814295fa39
2020-06-04Update Identity Credential VTS tests.David Zeuthen
These updates are based on input/experiences implementing this HAL. There are no API changes. - Specify that the validity for credentialKey certificate shall be from current time and expire at the same time as the attestation batch certificate. - Require challenge passed to getAttestationCertificate() is non-empty. - Fix bug in VTS tests where the startPersonlization() result was not checked. - Remove verifyStartPersonalizationZero test since it cannot be completed. - Ensure secureUserId is non-zero if user authentication is needed. - Specify format for signingKeyBlob in generateSigningKeyPair() same way we do for credentialData in finishAddingEntries(). - Modify EndToEndTest to decrypt/unpack credentialData to obtain credentialPrivKey and storageKey and do cross-checks on these. - Modify EndToEndTest to decrypt/unpack signingKeyBlob to obtain signingKeyPriv and check it matches the public key in the returned certificate. - Add new VTS tests for user and reader authentication. - Relax unnecessary requirements about SessionTranscript structure - just require it has X and Y of the ephemeral key created earlier. - Allow calls in VTS tests to v2 HAL to fail - this should allow these VTS tests to pass on a compliant v1 HAL. Bug: 156911917 Bug: 158107945 Test: atest VtsHalIdentityTargetTest Test: atest android.security.identity.cts Change-Id: I11b79dbd57b1830609c70301fea9c99f9e5080cb
2020-05-08Identity Credential: Add method to accept verification token.David Zeuthen
This is to facilitate HAL implementations using a TA existing in a different environment than where auth tokens are minted. This method will be used by credstore in a companion CL. This modifies version 2 of the Identity Credential API (which was never been released) to add a new method and creates version 2 of the Keymaster types-only AIDL API to include the new VerificationToken parcelable and SecurityLevel enum. Bug: 156076333 Test: atest VtsHalIdentityTargetTest Test: atest android.security.identity.cts Change-Id: I7d05413a9ec70225ce419079f3cc9daf026cf744
2020-04-29Identity Credential: Pass additional information to HAL.David Zeuthen
Without this extra information passed upfront it's not practical to implement a HAL which incrementally builds up cryptographically authenticated data. Two new methods are added to facilitate this and the HAL version number is bumped to 2. Bug: 154631410 Test: atest VtsHalIdentityTargetTest Test: atest android.security.identity.cts Change-Id: Iff63dfa2c4485c8768e06e7f6d70e940cfc8f68e
2020-03-24use vector<uint8_t> for byte[] in AIDLJooyung Han
In native world, byte stream is typically represented in uint8_t[] or vector<uint8_t>. C++ backend already generates that way. This change involves NDK backend. Now NDK backend also uses vector<uint8_t> just like C++ backend. Bug: 144957764 Test: atest CtsNdkBinderTestCases Merged-In: I8de348b57cf92dd99b3ee16252f56300ce5f4683 Change-Id: I8de348b57cf92dd99b3ee16252f56300ce5f4683 (cherry picked from commit 9070318462e5e73acf1509cf7e75ac260e51e43a) Exempt-From-Owner-Approval: cp from internal
2020-02-27Identity: Move signingKeyBlob from finishRetrieval() to startRetrieval().David Zeuthen
The implementation of the Identity Credential TA in constrained environments may need to incrementally update the HMAC-SHA256 of DeviceAuthencation CBOR to avoid keeping the entire CBOR structure in memory. To do this they need to calculate the derived key before starting to build the CBOR so they need access to the signingKey earlier on. Bug: 150390415 Test: atest android.security.identity.cts Test: VtsHalIdentityTargetTest Change-Id: I72ad30ec3ccec0b8161cbea360ef8c9212f8cbbc
2020-02-14Port IdentityCredential HAL to AIDL.David Zeuthen
This includes add a partial types-only HAL for KeyMaster for HardwareAuthToken. Bug: 111446262 Test: atest android.security.identity.cts Test: VtsHalIdentityTargetTest Test: android.hardware.identity-support-lib-test Change-Id: I7a6254d33200bfd62269aed1957cbb2a84b16272