blob: 200ee61df4891c9bd118332d2cccc45b45341917 [file] [log] [blame]
David Zeuthenc75ac312019-10-28 13:16:45 -04001/*
2 * Copyright 2019, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "WritableIdentityCredential"
18
Selene Huang459cb802020-01-08 22:59:02 -080019#include "WritableIdentityCredential.h"
Selene Huang459cb802020-01-08 22:59:02 -080020
David Zeuthenc75ac312019-10-28 13:16:45 -040021#include <android/hardware/identity/support/IdentityCredentialSupport.h>
22
23#include <android-base/logging.h>
David Zeuthen28edb102020-04-28 18:54:55 -040024#include <android-base/stringprintf.h>
David Zeuthenc75ac312019-10-28 13:16:45 -040025
Max Biresa3c7f4c2021-04-09 08:56:40 -070026#include <cppbor.h>
27#include <cppbor_parse.h>
David Zeuthenc75ac312019-10-28 13:16:45 -040028
Selene Huang459cb802020-01-08 22:59:02 -080029#include <utility>
30
David Zeuthen81603152020-02-11 22:04:24 -050031#include "IdentityCredentialStore.h"
David Zeuthen630de2a2020-05-11 14:04:54 -040032
33#include "FakeSecureHardwareProxy.h"
David Zeuthen81603152020-02-11 22:04:24 -050034
35namespace aidl::android::hardware::identity {
David Zeuthenc75ac312019-10-28 13:16:45 -040036
David Zeuthen28edb102020-04-28 18:54:55 -040037using ::android::base::StringPrintf;
David Zeuthenc75ac312019-10-28 13:16:45 -040038using ::std::optional;
David Zeuthen81603152020-02-11 22:04:24 -050039using namespace ::android::hardware::identity;
40
41bool WritableIdentityCredential::initialize() {
David Zeuthen630de2a2020-05-11 14:04:54 -040042 if (!hwProxy_->initialize(testCredential_)) {
David Zeuthen49f2d252020-10-16 11:27:24 -040043 LOG(ERROR) << "hwProxy->initialize() failed";
44 return false;
45 }
46 startPersonalizationCalled_ = false;
47 firstEntry_ = true;
48
49 return true;
50}
51
52// Used when updating a credential. Returns false on failure.
53bool WritableIdentityCredential::initializeForUpdate(
54 const vector<uint8_t>& encryptedCredentialKeys) {
55 if (!hwProxy_->initializeForUpdate(testCredential_, docType_, encryptedCredentialKeys)) {
56 LOG(ERROR) << "hwProxy->initializeForUpdate() failed";
David Zeuthen81603152020-02-11 22:04:24 -050057 return false;
58 }
Selene Huang92b61d62020-03-04 02:24:16 -080059 startPersonalizationCalled_ = false;
60 firstEntry_ = true;
David Zeuthen81603152020-02-11 22:04:24 -050061
62 return true;
63}
64
David Zeuthen630de2a2020-05-11 14:04:54 -040065WritableIdentityCredential::~WritableIdentityCredential() {}
66
David Zeuthen81603152020-02-11 22:04:24 -050067ndk::ScopedAStatus WritableIdentityCredential::getAttestationCertificate(
David Zeuthen630de2a2020-05-11 14:04:54 -040068 const vector<uint8_t>& attestationApplicationId,
69 const vector<uint8_t>& attestationChallenge, vector<Certificate>* outCertificateChain) {
70 if (getAttestationCertificateAlreadyCalled_) {
David Zeuthen81603152020-02-11 22:04:24 -050071 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
72 IIdentityCredentialStore::STATUS_FAILED,
Selene Huang459cb802020-01-08 22:59:02 -080073 "Error attestation certificate previously generated"));
David Zeuthen81603152020-02-11 22:04:24 -050074 }
David Zeuthen630de2a2020-05-11 14:04:54 -040075 getAttestationCertificateAlreadyCalled_ = true;
76
David Zeuthenef739512020-06-03 13:24:52 -040077 if (attestationChallenge.empty()) {
78 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
79 IIdentityCredentialStore::STATUS_INVALID_DATA, "Challenge can not be empty"));
80 }
David Zeuthen81603152020-02-11 22:04:24 -050081
David Zeuthen630de2a2020-05-11 14:04:54 -040082 optional<vector<uint8_t>> certChain =
83 hwProxy_->createCredentialKey(attestationChallenge, attestationApplicationId);
84 if (!certChain) {
David Zeuthen81603152020-02-11 22:04:24 -050085 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
86 IIdentityCredentialStore::STATUS_FAILED,
David Zeuthen630de2a2020-05-11 14:04:54 -040087 "Error generating attestation certificate chain"));
David Zeuthen81603152020-02-11 22:04:24 -050088 }
89
David Zeuthen630de2a2020-05-11 14:04:54 -040090 optional<vector<vector<uint8_t>>> certs = support::certificateChainSplit(certChain.value());
91 if (!certs) {
David Zeuthen81603152020-02-11 22:04:24 -050092 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
93 IIdentityCredentialStore::STATUS_FAILED,
David Zeuthen630de2a2020-05-11 14:04:54 -040094 "Error splitting chain into separate certificates"));
David Zeuthen81603152020-02-11 22:04:24 -050095 }
96
David Zeuthen81603152020-02-11 22:04:24 -050097 *outCertificateChain = vector<Certificate>();
David Zeuthen630de2a2020-05-11 14:04:54 -040098 for (const vector<uint8_t>& cert : certs.value()) {
David Zeuthen81603152020-02-11 22:04:24 -050099 Certificate c = Certificate();
Jooyung Han17be89b2020-02-21 21:17:06 +0900100 c.encodedCertificate = cert;
David Zeuthen81603152020-02-11 22:04:24 -0500101 outCertificateChain->push_back(std::move(c));
102 }
David Zeuthen630de2a2020-05-11 14:04:54 -0400103
David Zeuthen81603152020-02-11 22:04:24 -0500104 return ndk::ScopedAStatus::ok();
105}
106
David Zeuthen28edb102020-04-28 18:54:55 -0400107ndk::ScopedAStatus WritableIdentityCredential::setExpectedProofOfProvisioningSize(
108 int32_t expectedProofOfProvisioningSize) {
109 expectedProofOfProvisioningSize_ = expectedProofOfProvisioningSize;
110 return ndk::ScopedAStatus::ok();
111}
112
David Zeuthen81603152020-02-11 22:04:24 -0500113ndk::ScopedAStatus WritableIdentityCredential::startPersonalization(
114 int32_t accessControlProfileCount, const vector<int32_t>& entryCounts) {
Selene Huang92b61d62020-03-04 02:24:16 -0800115 if (startPersonalizationCalled_) {
116 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
117 IIdentityCredentialStore::STATUS_FAILED, "startPersonalization called already"));
118 }
Selene Huang92b61d62020-03-04 02:24:16 -0800119 startPersonalizationCalled_ = true;
David Zeuthen630de2a2020-05-11 14:04:54 -0400120
David Zeuthen81603152020-02-11 22:04:24 -0500121 numAccessControlProfileRemaining_ = accessControlProfileCount;
122 remainingEntryCounts_ = entryCounts;
123 entryNameSpace_ = "";
124
125 signedDataAccessControlProfiles_ = cppbor::Array();
126 signedDataNamespaces_ = cppbor::Map();
127 signedDataCurrentNamespace_ = cppbor::Array();
128
David Zeuthen630de2a2020-05-11 14:04:54 -0400129 if (!hwProxy_->startPersonalization(accessControlProfileCount, entryCounts, docType_,
130 expectedProofOfProvisioningSize_)) {
131 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
132 IIdentityCredentialStore::STATUS_FAILED, "eicStartPersonalization"));
133 }
134
David Zeuthen81603152020-02-11 22:04:24 -0500135 return ndk::ScopedAStatus::ok();
136}
137
138ndk::ScopedAStatus WritableIdentityCredential::addAccessControlProfile(
139 int32_t id, const Certificate& readerCertificate, bool userAuthenticationRequired,
140 int64_t timeoutMillis, int64_t secureUserId,
141 SecureAccessControlProfile* outSecureAccessControlProfile) {
David Zeuthen81603152020-02-11 22:04:24 -0500142 if (numAccessControlProfileRemaining_ == 0) {
143 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
144 IIdentityCredentialStore::STATUS_INVALID_DATA,
145 "numAccessControlProfileRemaining_ is 0 and expected non-zero"));
146 }
147
Selene Huang92b61d62020-03-04 02:24:16 -0800148 if (accessControlProfileIds_.find(id) != accessControlProfileIds_.end()) {
149 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
150 IIdentityCredentialStore::STATUS_INVALID_DATA,
151 "Access Control Profile id must be unique"));
152 }
153 accessControlProfileIds_.insert(id);
154
David Zeuthena0796e92020-04-27 15:24:55 -0400155 if (id < 0 || id >= 32) {
156 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
157 IIdentityCredentialStore::STATUS_INVALID_DATA,
158 "Access Control Profile id must be non-negative and less than 32"));
159 }
160
David Zeuthen81603152020-02-11 22:04:24 -0500161 // Spec requires if |userAuthenticationRequired| is false, then |timeoutMillis| must also
162 // be zero.
163 if (!userAuthenticationRequired && timeoutMillis != 0) {
164 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
165 IIdentityCredentialStore::STATUS_INVALID_DATA,
166 "userAuthenticationRequired is false but timeout is non-zero"));
167 }
168
David Zeuthen630de2a2020-05-11 14:04:54 -0400169 optional<vector<uint8_t>> mac = hwProxy_->addAccessControlProfile(
170 id, readerCertificate.encodedCertificate, userAuthenticationRequired, timeoutMillis,
171 secureUserId);
172 if (!mac) {
David Zeuthenef739512020-06-03 13:24:52 -0400173 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
David Zeuthen630de2a2020-05-11 14:04:54 -0400174 IIdentityCredentialStore::STATUS_FAILED, "eicAddAccessControlProfile"));
David Zeuthenef739512020-06-03 13:24:52 -0400175 }
176
David Zeuthen630de2a2020-05-11 14:04:54 -0400177 SecureAccessControlProfile profile;
David Zeuthen81603152020-02-11 22:04:24 -0500178 profile.id = id;
179 profile.readerCertificate = readerCertificate;
180 profile.userAuthenticationRequired = userAuthenticationRequired;
181 profile.timeoutMillis = timeoutMillis;
182 profile.secureUserId = secureUserId;
Jooyung Han17be89b2020-02-21 21:17:06 +0900183 profile.mac = mac.value();
David Zeuthen81603152020-02-11 22:04:24 -0500184 cppbor::Map profileMap;
185 profileMap.add("id", profile.id);
186 if (profile.readerCertificate.encodedCertificate.size() > 0) {
Jooyung Han17be89b2020-02-21 21:17:06 +0900187 profileMap.add("readerCertificate",
188 cppbor::Bstr(profile.readerCertificate.encodedCertificate));
David Zeuthen81603152020-02-11 22:04:24 -0500189 }
190 if (profile.userAuthenticationRequired) {
191 profileMap.add("userAuthenticationRequired", profile.userAuthenticationRequired);
192 profileMap.add("timeoutMillis", profile.timeoutMillis);
193 }
194 signedDataAccessControlProfiles_.add(std::move(profileMap));
195
196 numAccessControlProfileRemaining_--;
197
198 *outSecureAccessControlProfile = profile;
199 return ndk::ScopedAStatus::ok();
200}
201
202ndk::ScopedAStatus WritableIdentityCredential::beginAddEntry(
203 const vector<int32_t>& accessControlProfileIds, const string& nameSpace, const string& name,
204 int32_t entrySize) {
205 if (numAccessControlProfileRemaining_ != 0) {
206 LOG(ERROR) << "numAccessControlProfileRemaining_ is " << numAccessControlProfileRemaining_
207 << " and expected zero";
208 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
209 IIdentityCredentialStore::STATUS_INVALID_DATA,
210 "numAccessControlProfileRemaining_ is not zero"));
211 }
212
David Zeuthen1b8be712021-05-27 18:24:36 -0400213 // Ensure passed-in profile ids reference valid access control profiles
214 for (const int32_t id : accessControlProfileIds) {
215 if (accessControlProfileIds_.find(id) == accessControlProfileIds_.end()) {
216 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
217 IIdentityCredentialStore::STATUS_INVALID_DATA,
218 "An id in accessControlProfileIds references non-existing ACP"));
219 }
220 }
221
David Zeuthen81603152020-02-11 22:04:24 -0500222 if (remainingEntryCounts_.size() == 0) {
223 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
224 IIdentityCredentialStore::STATUS_INVALID_DATA, "No more namespaces to add to"));
225 }
226
227 // Handle initial beginEntry() call.
Selene Huang92b61d62020-03-04 02:24:16 -0800228 if (firstEntry_) {
229 firstEntry_ = false;
David Zeuthen81603152020-02-11 22:04:24 -0500230 entryNameSpace_ = nameSpace;
Selene Huang92b61d62020-03-04 02:24:16 -0800231 allNameSpaces_.insert(nameSpace);
David Zeuthen81603152020-02-11 22:04:24 -0500232 }
233
234 // If the namespace changed...
235 if (nameSpace != entryNameSpace_) {
Selene Huang92b61d62020-03-04 02:24:16 -0800236 if (allNameSpaces_.find(nameSpace) != allNameSpaces_.end()) {
237 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
238 IIdentityCredentialStore::STATUS_INVALID_DATA,
239 "Name space cannot be added in interleaving fashion"));
240 }
241
David Zeuthen81603152020-02-11 22:04:24 -0500242 // Then check that all entries in the previous namespace have been added..
243 if (remainingEntryCounts_[0] != 0) {
244 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
245 IIdentityCredentialStore::STATUS_INVALID_DATA,
246 "New namespace but a non-zero number of entries remain to be added"));
247 }
248 remainingEntryCounts_.erase(remainingEntryCounts_.begin());
Selene Huang92b61d62020-03-04 02:24:16 -0800249 remainingEntryCounts_[0] -= 1;
250 allNameSpaces_.insert(nameSpace);
David Zeuthen81603152020-02-11 22:04:24 -0500251
252 if (signedDataCurrentNamespace_.size() > 0) {
253 signedDataNamespaces_.add(entryNameSpace_, std::move(signedDataCurrentNamespace_));
254 signedDataCurrentNamespace_ = cppbor::Array();
255 }
256 } else {
257 // Same namespace...
258 if (remainingEntryCounts_[0] == 0) {
259 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
260 IIdentityCredentialStore::STATUS_INVALID_DATA,
261 "Same namespace but no entries remain to be added"));
262 }
263 remainingEntryCounts_[0] -= 1;
264 }
265
David Zeuthen81603152020-02-11 22:04:24 -0500266 entryRemainingBytes_ = entrySize;
267 entryNameSpace_ = nameSpace;
268 entryName_ = name;
269 entryAccessControlProfileIds_ = accessControlProfileIds;
270 entryBytes_.resize(0);
271 // LOG(INFO) << "name=" << name << " entrySize=" << entrySize;
David Zeuthen630de2a2020-05-11 14:04:54 -0400272
273 if (!hwProxy_->beginAddEntry(accessControlProfileIds, nameSpace, name, entrySize)) {
274 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
275 IIdentityCredentialStore::STATUS_FAILED, "eicBeginAddEntry"));
276 }
277
David Zeuthen81603152020-02-11 22:04:24 -0500278 return ndk::ScopedAStatus::ok();
279}
280
Jooyung Han17be89b2020-02-21 21:17:06 +0900281ndk::ScopedAStatus WritableIdentityCredential::addEntryValue(const vector<uint8_t>& content,
282 vector<uint8_t>* outEncryptedContent) {
David Zeuthen81603152020-02-11 22:04:24 -0500283 size_t contentSize = content.size();
284
285 if (contentSize > IdentityCredentialStore::kGcmChunkSize) {
286 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
287 IIdentityCredentialStore::STATUS_INVALID_DATA,
288 "Passed in chunk of is bigger than kGcmChunkSize"));
289 }
290 if (contentSize > entryRemainingBytes_) {
291 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
292 IIdentityCredentialStore::STATUS_INVALID_DATA,
293 "Passed in chunk is bigger than remaining space"));
294 }
295
296 entryBytes_.insert(entryBytes_.end(), content.begin(), content.end());
297 entryRemainingBytes_ -= contentSize;
298 if (entryRemainingBytes_ > 0) {
299 if (contentSize != IdentityCredentialStore::kGcmChunkSize) {
300 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
301 IIdentityCredentialStore::STATUS_INVALID_DATA,
302 "Retrieved non-final chunk which isn't kGcmChunkSize"));
303 }
304 }
305
David Zeuthen630de2a2020-05-11 14:04:54 -0400306 optional<vector<uint8_t>> encryptedContent = hwProxy_->addEntryValue(
307 entryAccessControlProfileIds_, entryNameSpace_, entryName_, content);
David Zeuthen81603152020-02-11 22:04:24 -0500308 if (!encryptedContent) {
309 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
David Zeuthen630de2a2020-05-11 14:04:54 -0400310 IIdentityCredentialStore::STATUS_FAILED, "eicAddEntryValue"));
David Zeuthen81603152020-02-11 22:04:24 -0500311 }
312
313 if (entryRemainingBytes_ == 0) {
314 // TODO: ideally do do this without parsing the data (but still validate data is valid
315 // CBOR).
316 auto [item, _, message] = cppbor::parse(entryBytes_);
317 if (item == nullptr) {
318 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
319 IIdentityCredentialStore::STATUS_INVALID_DATA, "Data is not valid CBOR"));
320 }
321 cppbor::Map entryMap;
322 entryMap.add("name", entryName_);
323 entryMap.add("value", std::move(item));
324 cppbor::Array profileIdArray;
325 for (auto id : entryAccessControlProfileIds_) {
326 profileIdArray.add(id);
327 }
328 entryMap.add("accessControlProfiles", std::move(profileIdArray));
329 signedDataCurrentNamespace_.add(std::move(entryMap));
330 }
331
Jooyung Han17be89b2020-02-21 21:17:06 +0900332 *outEncryptedContent = encryptedContent.value();
David Zeuthen81603152020-02-11 22:04:24 -0500333 return ndk::ScopedAStatus::ok();
334}
David Zeuthenc75ac312019-10-28 13:16:45 -0400335
David Zeuthen81603152020-02-11 22:04:24 -0500336ndk::ScopedAStatus WritableIdentityCredential::finishAddingEntries(
Jooyung Han17be89b2020-02-21 21:17:06 +0900337 vector<uint8_t>* outCredentialData, vector<uint8_t>* outProofOfProvisioningSignature) {
Selene Huang92b61d62020-03-04 02:24:16 -0800338 if (numAccessControlProfileRemaining_ != 0) {
339 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
340 IIdentityCredentialStore::STATUS_INVALID_DATA,
341 "numAccessControlProfileRemaining_ is not 0 and expected zero"));
342 }
343
344 if (remainingEntryCounts_.size() > 1 || remainingEntryCounts_[0] != 0) {
345 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
346 IIdentityCredentialStore::STATUS_INVALID_DATA,
347 "More entry spaces remain than startPersonalization configured"));
348 }
349
David Zeuthenc75ac312019-10-28 13:16:45 -0400350 if (signedDataCurrentNamespace_.size() > 0) {
351 signedDataNamespaces_.add(entryNameSpace_, std::move(signedDataCurrentNamespace_));
352 }
353 cppbor::Array popArray;
354 popArray.add("ProofOfProvisioning")
355 .add(docType_)
356 .add(std::move(signedDataAccessControlProfiles_))
357 .add(std::move(signedDataNamespaces_))
358 .add(testCredential_);
359 vector<uint8_t> encodedCbor = popArray.encode();
360
David Zeuthen28edb102020-04-28 18:54:55 -0400361 if (encodedCbor.size() != expectedProofOfProvisioningSize_) {
362 LOG(ERROR) << "CBOR for proofOfProvisioning is " << encodedCbor.size() << " bytes, "
363 << "was expecting " << expectedProofOfProvisioningSize_;
364 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
365 IIdentityCredentialStore::STATUS_INVALID_DATA,
366 StringPrintf("Unexpected CBOR size %zd for proofOfProvisioning, was expecting %zd",
367 encodedCbor.size(), expectedProofOfProvisioningSize_)
368 .c_str()));
369 }
370
David Zeuthen630de2a2020-05-11 14:04:54 -0400371 optional<vector<uint8_t>> signatureOfToBeSigned = hwProxy_->finishAddingEntries();
372 if (!signatureOfToBeSigned) {
373 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
374 IIdentityCredentialStore::STATUS_FAILED, "eicFinishAddingEntries"));
375 }
376
377 optional<vector<uint8_t>> signature =
378 support::coseSignEcDsaWithSignature(signatureOfToBeSigned.value(),
379 encodedCbor, // data
380 {}); // certificateChain
David Zeuthenc75ac312019-10-28 13:16:45 -0400381 if (!signature) {
David Zeuthen81603152020-02-11 22:04:24 -0500382 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
383 IIdentityCredentialStore::STATUS_FAILED, "Error signing data"));
David Zeuthenc75ac312019-10-28 13:16:45 -0400384 }
385
David Zeuthen630de2a2020-05-11 14:04:54 -0400386 optional<vector<uint8_t>> encryptedCredentialKeys = hwProxy_->finishGetCredentialData(docType_);
387 if (!encryptedCredentialKeys) {
David Zeuthen81603152020-02-11 22:04:24 -0500388 return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
David Zeuthen630de2a2020-05-11 14:04:54 -0400389 IIdentityCredentialStore::STATUS_FAILED,
390 "Error generating encrypted CredentialKeys"));
David Zeuthenc75ac312019-10-28 13:16:45 -0400391 }
David Zeuthen630de2a2020-05-11 14:04:54 -0400392 cppbor::Array array;
393 array.add(docType_);
394 array.add(testCredential_);
395 array.add(encryptedCredentialKeys.value());
396 vector<uint8_t> credentialData = array.encode();
David Zeuthenc75ac312019-10-28 13:16:45 -0400397
Jooyung Han17be89b2020-02-21 21:17:06 +0900398 *outCredentialData = credentialData;
399 *outProofOfProvisioningSignature = signature.value();
David Zeuthen630de2a2020-05-11 14:04:54 -0400400 hwProxy_->shutdown();
401
David Zeuthen81603152020-02-11 22:04:24 -0500402 return ndk::ScopedAStatus::ok();
David Zeuthenc75ac312019-10-28 13:16:45 -0400403}
404
David Zeuthen81603152020-02-11 22:04:24 -0500405} // namespace aidl::android::hardware::identity