1 /*
2  * Copyright (c) 2024-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef SINATURETOOLS_SIGNER_FACTORY_H
16 #define SINATURETOOLS_SIGNER_FACTORY_H
17 
18 #include <dlfcn.h>
19 
20 #include "local_signer.h"
21 #include "localization_adapter.h"
22 #include "param_constants.h"
23 
24 namespace OHOS {
25 namespace SignatureTools {
26 
27 typedef struct RemoteSignerParamTypeSt {
28     const char* data;
29     size_t len;
30 } RemoteSignerParamType;
31 
32 typedef Signer* (*RemoteSignerCreator)(RemoteSignerParamType,
33                                        RemoteSignerParamType,
34                                        RemoteSignerParamType,
35                                        RemoteSignerParamType,
36                                        RemoteSignerParamType);
37 
38 class SignerFactory {
39 public:
40     SignerFactory() = default;
41     ~SignerFactory() = default;
42 
43     std::shared_ptr<Signer> GetSigner(LocalizationAdapter& adapter) const;
44 
45 private:
46     std::shared_ptr<Signer> LoadRemoteSigner(LocalizationAdapter& adapter) const;
47 };
48 } // namespace SignatureTools
49 } // namespace OHOS
50 #endif