• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022-2023 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 
16 #ifndef HCF_KEY_H
17 #define HCF_KEY_H
18 
19 #include "blob.h"
20 #include "result.h"
21 #include "object_base.h"
22 
23 typedef enum {
24     DSA_P_BN = 101,
25     DSA_Q_BN = 102,
26     DSA_G_BN = 103,
27     DSA_SK_BN = 104,
28     DSA_PK_BN = 105,
29 
30     ECC_FP_P_BN = 201,
31     ECC_A_BN = 202,
32     ECC_B_BN = 203,
33     ECC_G_X_BN = 204,
34     ECC_G_Y_BN = 205,
35     ECC_N_BN = 206,
36     ECC_H_INT = 207,  // warning: ECC_H_NUM in JS
37     ECC_SK_BN = 208,
38     ECC_PK_X_BN = 209,
39     ECC_PK_Y_BN = 210,
40     ECC_FIELD_TYPE_STR = 211,
41     ECC_FIELD_SIZE_INT = 212,  // warning: ECC_FIELD_SIZE_NUM in JS
42     ECC_CURVE_NAME_STR = 213,
43 
44     RSA_N_BN = 301,
45     RSA_SK_BN = 302,
46     RSA_PK_BN = 303,
47 } AsyKeySpecItem;
48 
49 typedef struct HcfKey HcfKey;
50 
51 struct HcfKey {
52     HcfObjectBase base;
53 
54     const char *(*getAlgorithm)(HcfKey *self);
55 
56     HcfResult (*getEncoded)(HcfKey *self, HcfBlob *returnBlob);
57 
58     const char *(*getFormat)(HcfKey *self);
59 };
60 
61 #endif
62