xref: /aosp_15_r20/system/security/identity/CredentialStoreFactory.h (revision e1997b9af69e3155ead6e072d106a0077849ffba)
1*e1997b9aSAndroid Build Coastguard Worker /*
2*e1997b9aSAndroid Build Coastguard Worker  * Copyright (c) 2019, The Android Open Source Project
3*e1997b9aSAndroid Build Coastguard Worker  *
4*e1997b9aSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*e1997b9aSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*e1997b9aSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*e1997b9aSAndroid Build Coastguard Worker  *
8*e1997b9aSAndroid Build Coastguard Worker  *     http://www.apache.org/licenses/LICENSE-2.0
9*e1997b9aSAndroid Build Coastguard Worker  *
10*e1997b9aSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*e1997b9aSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*e1997b9aSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*e1997b9aSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*e1997b9aSAndroid Build Coastguard Worker  * limitations under the License.
15*e1997b9aSAndroid Build Coastguard Worker  */
16*e1997b9aSAndroid Build Coastguard Worker 
17*e1997b9aSAndroid Build Coastguard Worker #ifndef SYSTEM_SECURITY_CREDENTIAL_STORE_FACTORY_H_
18*e1997b9aSAndroid Build Coastguard Worker #define SYSTEM_SECURITY_CREDENTIAL_STORE_FACTORY_H_
19*e1997b9aSAndroid Build Coastguard Worker 
20*e1997b9aSAndroid Build Coastguard Worker #include <android/security/identity/BnCredentialStoreFactory.h>
21*e1997b9aSAndroid Build Coastguard Worker 
22*e1997b9aSAndroid Build Coastguard Worker #include "CredentialStore.h"
23*e1997b9aSAndroid Build Coastguard Worker 
24*e1997b9aSAndroid Build Coastguard Worker namespace android {
25*e1997b9aSAndroid Build Coastguard Worker namespace security {
26*e1997b9aSAndroid Build Coastguard Worker namespace identity {
27*e1997b9aSAndroid Build Coastguard Worker 
28*e1997b9aSAndroid Build Coastguard Worker using ::android::sp;
29*e1997b9aSAndroid Build Coastguard Worker using ::android::binder::Status;
30*e1997b9aSAndroid Build Coastguard Worker using ::std::string;
31*e1997b9aSAndroid Build Coastguard Worker 
32*e1997b9aSAndroid Build Coastguard Worker class CredentialStoreFactory : public BnCredentialStoreFactory {
33*e1997b9aSAndroid Build Coastguard Worker   public:
34*e1997b9aSAndroid Build Coastguard Worker     explicit CredentialStoreFactory(const string& dataPath);
35*e1997b9aSAndroid Build Coastguard Worker     ~CredentialStoreFactory();
36*e1997b9aSAndroid Build Coastguard Worker 
37*e1997b9aSAndroid Build Coastguard Worker     Status getCredentialStore(int32_t credentialStoreType,
38*e1997b9aSAndroid Build Coastguard Worker                               sp<ICredentialStore>* _aidl_return) override;
39*e1997b9aSAndroid Build Coastguard Worker 
40*e1997b9aSAndroid Build Coastguard Worker   private:
41*e1997b9aSAndroid Build Coastguard Worker     CredentialStore* createCredentialStore(const string& instanceName);
42*e1997b9aSAndroid Build Coastguard Worker 
43*e1997b9aSAndroid Build Coastguard Worker     string dataPath_;
44*e1997b9aSAndroid Build Coastguard Worker 
45*e1997b9aSAndroid Build Coastguard Worker     sp<CredentialStore> defaultStore_;
46*e1997b9aSAndroid Build Coastguard Worker     sp<CredentialStore> directAccessStore_;
47*e1997b9aSAndroid Build Coastguard Worker };
48*e1997b9aSAndroid Build Coastguard Worker 
49*e1997b9aSAndroid Build Coastguard Worker }  // namespace identity
50*e1997b9aSAndroid Build Coastguard Worker }  // namespace security
51*e1997b9aSAndroid Build Coastguard Worker }  // namespace android
52*e1997b9aSAndroid Build Coastguard Worker 
53*e1997b9aSAndroid Build Coastguard Worker #endif  // SYSTEM_SECURITY_CREDENTIAL_STORE_FACTORY_H_
54