blob: 24b2b4db6346fa0fff8abe133c7773955551d4a1 [file] [log] [blame]
David Zeuthenab3e5652019-10-28 13:32:48 -04001/*
2 * Copyright (c) 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#ifndef SYSTEM_SECURITY_CREDENTIAL_STORE_H_
18#define SYSTEM_SECURITY_CREDENTIAL_STORE_H_
19
20#include <string>
21#include <vector>
22
David Zeuthena6f9fba2020-02-11 22:08:27 -050023#include <android/hardware/identity/IIdentityCredentialStore.h>
David Zeuthenab3e5652019-10-28 13:32:48 -040024
25#include <android/security/identity/BnCredentialStore.h>
26
27namespace android {
28namespace security {
29namespace identity {
30
31using ::android::sp;
32using ::android::binder::Status;
33using ::std::string;
34using ::std::unique_ptr;
35using ::std::vector;
36
David Zeuthena6f9fba2020-02-11 22:08:27 -050037using ::android::hardware::identity::HardwareInformation;
38using ::android::hardware::identity::IIdentityCredentialStore;
David Zeuthenab3e5652019-10-28 13:32:48 -040039
40class CredentialStore : public BnCredentialStore {
41 public:
42 CredentialStore(const string& dataPath, sp<IIdentityCredentialStore> hal);
43 ~CredentialStore();
44
45 bool init();
46
47 // ICredentialStore overrides
48 Status getSecurityHardwareInfo(SecurityHardwareInfoParcel* _aidl_return) override;
49
50 Status createCredential(const string& credentialName, const string& docType,
51 sp<IWritableCredential>* _aidl_return) override;
52
53 Status getCredentialByName(const string& credentialName, int32_t cipherSuite,
54 sp<ICredential>* _aidl_return) override;
55
56 private:
57 string dataPath_;
58
59 sp<IIdentityCredentialStore> hal_;
60
David Zeuthena6f9fba2020-02-11 22:08:27 -050061 HardwareInformation hwInfo_;
David Zeuthenab3e5652019-10-28 13:32:48 -040062};
63
64} // namespace identity
65} // namespace security
66} // namespace android
67
68#endif // SYSTEM_SECURITY_CREDENTIAL_STORE_H_