mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
IIdentityCredentialStore provides an interface to a secure store for user identity documents. This HAL is deliberately fairly general and abstract. To the extent possible, specification of the message formats and semantics of communication with credential verification devices and issuing authorities (IAs) is out of scope for this HAL. It provides the interface with secure storage but a credential-specific Android application will be required to implement the presentation and verification protocols and processes appropriate for the specific credential type. Bug: 111446262 Test: VtsHalIdentityCredentialTargetTest Test: android.hardware.identity-support-lib-test Test: CtsIdentityTestCases Change-Id: I64eb50114d645dd475012ad1b889d2177aaf1d37
69 lines
2.6 KiB
C++
69 lines
2.6 KiB
C++
/*
|
|
* Copyright 2019, The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#define LOG_TAG "IdentityCredentialStore"
|
|
|
|
#include "IdentityCredentialStore.h"
|
|
#include "IdentityCredential.h"
|
|
#include "WritableIdentityCredential.h"
|
|
|
|
#include <android-base/logging.h>
|
|
|
|
namespace android {
|
|
namespace hardware {
|
|
namespace identity {
|
|
namespace implementation {
|
|
|
|
// Methods from ::android::hardware::identity::IIdentityCredentialStore follow.
|
|
|
|
Return<void> IdentityCredentialStore::getHardwareInformation(getHardwareInformation_cb _hidl_cb) {
|
|
_hidl_cb(support::resultOK(), "IdentityCredential Reference Implementation", "Google",
|
|
kGcmChunkSize, false /* isDirectAccess */, {} /* supportedDocTypes */);
|
|
return Void();
|
|
}
|
|
|
|
Return<void> IdentityCredentialStore::createCredential(const hidl_string& docType,
|
|
bool testCredential,
|
|
createCredential_cb _hidl_cb) {
|
|
auto writable_credential = new WritableIdentityCredential(docType, testCredential);
|
|
if (!writable_credential->initialize()) {
|
|
_hidl_cb(support::result(ResultCode::FAILED,
|
|
"Error initializing WritableIdentityCredential"),
|
|
writable_credential);
|
|
return Void();
|
|
}
|
|
_hidl_cb(support::resultOK(), writable_credential);
|
|
return Void();
|
|
}
|
|
|
|
Return<void> IdentityCredentialStore::getCredential(const hidl_vec<uint8_t>& credentialData,
|
|
getCredential_cb _hidl_cb) {
|
|
auto credential = new IdentityCredential(credentialData);
|
|
// We only support CIPHERSUITE_ECDHE_HKDF_ECDSA_WITH_AES_256_GCM_SHA256 right now.
|
|
auto ret = credential->initialize();
|
|
if (ret != ResultCode::OK) {
|
|
_hidl_cb(support::result(ret, "Error initializing IdentityCredential"), credential);
|
|
return Void();
|
|
}
|
|
_hidl_cb(support::resultOK(), credential);
|
|
return Void();
|
|
}
|
|
|
|
} // namespace implementation
|
|
} // namespace identity
|
|
} // namespace hardware
|
|
} // namespace android
|