• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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_FACTORY_H_
18 #define SYSTEM_SECURITY_CREDENTIAL_STORE_FACTORY_H_
19 
20 #include <android/security/identity/BnCredentialStoreFactory.h>
21 
22 #include "CredentialStore.h"
23 
24 namespace android {
25 namespace security {
26 namespace identity {
27 
28 using ::android::sp;
29 using ::android::binder::Status;
30 using ::std::string;
31 
32 class CredentialStoreFactory : public BnCredentialStoreFactory {
33   public:
34     explicit CredentialStoreFactory(const string& dataPath);
35     ~CredentialStoreFactory();
36 
37     Status getCredentialStore(int32_t credentialStoreType,
38                               sp<ICredentialStore>* _aidl_return) override;
39 
40   private:
41     CredentialStore* createCredentialStore(const string& instanceName);
42 
43     string dataPath_;
44 
45     sp<CredentialStore> defaultStore_;
46     sp<CredentialStore> directAccessStore_;
47 };
48 
49 }  // namespace identity
50 }  // namespace security
51 }  // namespace android
52 
53 #endif  // SYSTEM_SECURITY_CREDENTIAL_STORE_FACTORY_H_
54