• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (c) 2022 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
16import {AsyncCallback} from './basic';
17
18/**
19 * OpenHarmony Universal KeyStore
20 * @since 8
21 * @syscap SystemCapability.Security.Huks
22 */
23declare namespace huks {
24    /**
25     * Generate Key.
26     * @since 8
27     * @deprecated since 9
28     * @useinstead ohos.security.huks.generateKeyItem
29     * @syscap SystemCapability.Security.Huks
30     * @param keyAlias Indicates the key's name.
31     * @param options Indicates the properties of the key.
32     */
33    function generateKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void;
34    function generateKey(keyAlias: string, options: HuksOptions) : Promise<HuksResult>;
35
36    /**
37     * Generate Key.
38     * @param {string} keyAlias - Indicates the key's name.
39     * @param {HuksOptions} options - Indicates the properties of the key.
40     * @throws {BusinessError} 401 - argument is invalid
41     * @throws {BusinessError} 801 - api is not supported
42     * @throws {BusinessError} 12000001 - algorithm mode is not supported
43     * @throws {BusinessError} 12000002 - algorithm param is missing
44     * @throws {BusinessError} 12000003 - algorithm param is invalid
45     * @throws {BusinessError} 12000004 - operating file failed
46     * @throws {BusinessError} 12000005 - IPC communication failed
47     * @throws {BusinessError} 12000006 - error occured in crypto engine
48     * @throws {BusinessError} 12000012 - external error
49     * @throws {BusinessError} 12000013 - queried credential does not exist
50     * @throws {BusinessError} 12000014 - memory is insufficient
51     * @throws {BusinessError} 12000015 - call service failed
52     * @syscap SystemCapability.Security.Huks
53     * @since 9
54     */
55    function generateKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback<void>) : void;
56    function generateKeyItem(keyAlias: string, options: HuksOptions) : Promise<void>;
57
58    /**
59     * Delete Key.
60     * @since 8
61     * @deprecated since 9
62     * @useinstead ohos.security.huks.deleteKeyItem
63     * @syscap SystemCapability.Security.Huks
64     * @param keyAlias Indicates the key's name.
65     * @param options Indicates the properties of the key.
66     */
67    function deleteKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void;
68    function deleteKey(keyAlias: string, options: HuksOptions) : Promise<HuksResult>;
69
70    /**
71     * Delete Key.
72     * @param {string} keyAlias - Indicates the key's name.
73     * @param {HuksOptions} options - Indicates the properties of the key.
74     * @throws {BusinessError} 401 - argument is invalid
75     * @throws {BusinessError} 801 - api is not supported
76     * @throws {BusinessError} 12000004 - operating file failed
77     * @throws {BusinessError} 12000005 - IPC communication failed
78     * @throws {BusinessError} 12000011 - queried entity does not exist
79     * @throws {BusinessError} 12000012 - external error
80     * @throws {BusinessError} 12000014 - memory is insufficient
81     * @syscap SystemCapability.Security.Huks
82     * @since 9
83     */
84    function deleteKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback<void>) : void;
85    function deleteKeyItem(keyAlias: string, options: HuksOptions) : Promise<void>;
86
87    /**
88     * Import Key.
89     * @since 8
90     * @deprecated since 9
91     * @useinstead ohos.security.huks.importKeyItem
92     * @syscap SystemCapability.Security.Huks
93     * @param keyAlias Indicates the key's name.
94     * @param options Indicates the properties of the key.
95     */
96    function importKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void;
97    function importKey(keyAlias: string, options: HuksOptions) : Promise<HuksResult>;
98
99    /**
100     * Import Key.
101     * @param {string} keyAlias - Indicates the key's name.
102     * @param {HuksOptions} options - Indicates the properties of the key.
103     * @throws {BusinessError} 401 - argument is invalid
104     * @throws {BusinessError} 801 - api is not supported
105     * @throws {BusinessError} 12000001 - algorithm mode is not supported
106     * @throws {BusinessError} 12000002 - algorithm param is missing
107     * @throws {BusinessError} 12000003 - algorithm param is invalid
108     * @throws {BusinessError} 12000004 - operating file failed
109     * @throws {BusinessError} 12000005 - IPC communication failed
110     * @throws {BusinessError} 12000006 - error occured in crypto engine
111     * @throws {BusinessError} 12000011 - queried entity does not exist
112     * @throws {BusinessError} 12000012 - external error
113     * @throws {BusinessError} 12000013 - queried credential does not exist
114     * @throws {BusinessError} 12000014 - memory is insufficient
115     * @throws {BusinessError} 12000015 - call service failed
116     * @syscap SystemCapability.Security.Huks
117     * @since 9
118     */
119    function importKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback<void>) : void;
120    function importKeyItem(keyAlias: string, options: HuksOptions) : Promise<void>;
121
122    /**
123     * Import Wrapped Key.
124     * @param {string} keyAlias - Indicates the name of key to be imported.
125     * @param {string} wrappingKeyAlias - Indicates the name of key for wrapping the key to be imported
126     * @param {HuksOptions} options - Indicates the properties of the key.
127     * @throws {BusinessError} 401 - argument is invalid
128     * @throws {BusinessError} 801 - api is not supported
129     * @throws {BusinessError} 12000001 - algorithm mode is not supported
130     * @throws {BusinessError} 12000002 - algorithm param is missing
131     * @throws {BusinessError} 12000003 - algorithm param is invalid
132     * @throws {BusinessError} 12000004 - operating file failed
133     * @throws {BusinessError} 12000005 - IPC communication failed
134     * @throws {BusinessError} 12000006 - error occured in crypto engine
135     * @throws {BusinessError} 12000011 - queried entity does not exist
136     * @throws {BusinessError} 12000012 - external error
137     * @throws {BusinessError} 12000013 - queried credential does not exist
138     * @throws {BusinessError} 12000014 - memory is insufficient
139     * @throws {BusinessError} 12000015 - call service failed
140     * @syscap SystemCapability.Security.Huks
141     * @since 9
142     */
143    function importWrappedKeyItem(keyAlias: string, wrappingKeyAlias: string, options: HuksOptions, callback: AsyncCallback<void>) : void;
144    function importWrappedKeyItem(keyAlias: string, wrappingKeyAlias: string, options: HuksOptions) : Promise<void>;
145
146    /**
147     * Export Key.
148     * @since 8
149     * @deprecated since 9
150     * @useinstead ohos.security.huks.exportKeyItem
151     * @syscap SystemCapability.Security.Huks
152     * @param keyAlias Indicates the key's name.
153     * @param options Indicates the properties of the key.
154     */
155    function exportKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void;
156    function exportKey(keyAlias: string, options: HuksOptions) : Promise<HuksResult>;
157
158    /**
159     * Export Key.
160     * @param {string} keyAlias - Indicates the key's name.
161     * @param {HuksOptions} options - Indicates the properties of the key.
162     * @throws {BusinessError} 401 - argument is invalid
163     * @throws {BusinessError} 801 - api is not supported
164     * @throws {BusinessError} 12000001 - algorithm mode is not supported
165     * @throws {BusinessError} 12000002 - algorithm param is missing
166     * @throws {BusinessError} 12000003 - algorithm param is invalid
167     * @throws {BusinessError} 12000004 - operating file failed
168     * @throws {BusinessError} 12000005 - IPC communication failed
169     * @throws {BusinessError} 12000006 - error occured in crypto engine
170     * @throws {BusinessError} 12000011 - queried entity does not exist
171     * @throws {BusinessError} 12000012 - external error
172     * @throws {BusinessError} 12000014 - memory is insufficient
173     * @syscap SystemCapability.Security.Huks
174     * @since 9
175     */
176    function exportKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksReturnResult>) : void;
177    function exportKeyItem(keyAlias: string, options: HuksOptions) : Promise<HuksReturnResult>;
178
179    /**
180     * Get properties of the key.
181     * @since 8
182     * @deprecated since 9
183     * @useinstead ohos.security.huks.getKeyItemProperties
184     * @syscap SystemCapability.Security.Huks
185     * @param keyAlias Indicates the key's name.
186     * @param options Indicates the properties of the key.
187     */
188    function getKeyProperties(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void;
189    function getKeyProperties(keyAlias: string, options: HuksOptions) : Promise<HuksResult>;
190
191    /**
192     * Get properties of the key.
193     * @param {string} keyAlias - Indicates the key's name.
194     * @param {HuksOptions} options - Indicates the properties of the key.
195     * @throws {BusinessError} 401 - argument is invalid
196     * @throws {BusinessError} 801 - api is not supported
197     * @throws {BusinessError} 12000001 - algorithm mode is not supported
198     * @throws {BusinessError} 12000002 - algorithm param is missing
199     * @throws {BusinessError} 12000003 - algorithm param is invalid
200     * @throws {BusinessError} 12000004 - operating file failed
201     * @throws {BusinessError} 12000005 - IPC communication failed
202     * @throws {BusinessError} 12000006 - error occured in crypto engine
203     * @throws {BusinessError} 12000011 - queried entity does not exist
204     * @throws {BusinessError} 12000012 - external error
205     * @throws {BusinessError} 12000014 - memory is insufficient
206     * @syscap SystemCapability.Security.Huks
207     * @since 9
208     */
209    function getKeyItemProperties(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksReturnResult>) : void;
210    function getKeyItemProperties(keyAlias: string, options: HuksOptions) : Promise<HuksReturnResult>;
211
212    /**
213     * Check whether the key exists.
214     * @since 8
215     * @deprecated since 9
216     * @useinstead ohos.security.huks.isKeyItemExist
217     * @syscap SystemCapability.Security.Huks
218     * @param keyAlias Indicates the key's name.
219     * @param options Indicates the properties of the key.
220     */
221    function isKeyExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback<boolean>) : void;
222    function isKeyExist(keyAlias: string, options: HuksOptions) : Promise<boolean>;
223
224    /**
225     * Check whether the key exists.
226     * @param {string} keyAlias - Indicates the key's name.
227     * @param {HuksOptions} options - Indicates the properties of the key.
228     * @throws {BusinessError} 401 - argument is invalid
229     * @throws {BusinessError} 801 - api is not supported
230     * @throws {BusinessError} 12000002 - algorithm param is missing
231     * @throws {BusinessError} 12000003 - algorithm param is invalid
232     * @throws {BusinessError} 12000004 - operating file failed
233     * @throws {BusinessError} 12000005 - IPC communication failed
234     * @throws {BusinessError} 12000006 - error occured in crypto engine
235     * @throws {BusinessError} 12000012 - external error
236     * @throws {BusinessError} 12000014 - memory is insufficient
237     * @syscap SystemCapability.Security.Huks
238     * @since 9
239     */
240    function isKeyItemExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback<boolean>) : void;
241    function isKeyItemExist(keyAlias: string, options: HuksOptions) : Promise<boolean>;
242
243    /**
244     * Init Operation.
245     * @since 8
246     * @deprecated since 9
247     * @useinstead ohos.security.huks.initSession
248     * @syscap SystemCapability.Security.Huks
249     * @param keyAlias Indicates the key's name.
250     * @param options Indicates the properties of the key.
251     * @returns The handle of the init Operation.
252     */
253    function init(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksHandle>) : void;
254    function init(keyAlias: string, options: HuksOptions) : Promise<HuksHandle>;
255
256    /**
257     * Init Operation.
258     * @param {string} keyAlias - Indicates the key's name.
259     * @param {HuksOptions} options - Indicates the properties of the key.
260     * @throws {BusinessError} 401 - argument is invalid
261     * @throws {BusinessError} 801 - api is not supported
262     * @throws {BusinessError} 12000001 - algorithm mode is not supported
263     * @throws {BusinessError} 12000002 - algorithm param is missing
264     * @throws {BusinessError} 12000003 - algorithm param is invalid
265     * @throws {BusinessError} 12000004 - operating file failed
266     * @throws {BusinessError} 12000005 - IPC communication failed
267     * @throws {BusinessError} 12000006 - error occured in crypto engine
268     * @throws {BusinessError} 12000010 - the number of sessions has reached limit
269     * @throws {BusinessError} 12000011 - queried entity does not exist
270     * @throws {BusinessError} 12000012 - external error
271     * @throws {BusinessError} 12000014 - memory is insufficient
272     * @syscap SystemCapability.Security.Huks
273     * @since 9
274     */
275    function initSession(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksSessionHandle>) : void;
276    function initSession(keyAlias: string, options: HuksOptions) : Promise<HuksSessionHandle>;
277
278    /**
279     * Update Operation.
280     * @since 8
281     * @deprecated since 9
282     * @useinstead ohos.security.huks.updateSession
283     * @syscap SystemCapability.Security.Huks
284     * @param handle Indicates the handle of the init operation.
285     * @param options Indicates the properties of the update operation.
286     * @param token Indicates the value of token.
287     */
288    function update(handle: number, token?: Uint8Array, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void;
289    function update(handle: number, token?: Uint8Array, options: HuksOptions) : Promise<HuksResult>;
290
291    /**
292     * Update Operation.
293     * @param {number} handle - Indicates the handle of the init operation.
294     * @param {HuksOptions} options - Indicates the properties of the update operation.
295     * @param {Uint8Array} token - Indicates the value of AuthToken from USER IAM service.
296     * @throws {BusinessError} 401 - argument is invalid
297     * @throws {BusinessError} 801 - api is not supported
298     * @throws {BusinessError} 12000001 - algorithm mode is not supported
299     * @throws {BusinessError} 12000002 - algorithm param is missing
300     * @throws {BusinessError} 12000003 - algorithm param is invalid
301     * @throws {BusinessError} 12000004 - operating file failed
302     * @throws {BusinessError} 12000005 - IPC communication failed
303     * @throws {BusinessError} 12000006 - error occured in crypto engine
304     * @throws {BusinessError} 12000007 - this credential is already invalidated permanently
305     * @throws {BusinessError} 12000008 - verify authtoken failed
306     * @throws {BusinessError} 12000009 - authtoken is already timeout
307     * @throws {BusinessError} 12000011 - queried entity does not exist
308     * @throws {BusinessError} 12000012 - external error
309     * @throws {BusinessError} 12000014 - memory is insufficient
310     * @syscap SystemCapability.Security.Huks
311     * @since 9
312     */
313    function updateSession(handle: number, options: HuksOptions, callback: AsyncCallback<HuksReturnResult>) : void;
314    function updateSession(handle: number, options: HuksOptions, token: Uint8Array, callback: AsyncCallback<HuksReturnResult>) : void;
315    function updateSession(handle: number, options: HuksOptions, token?: Uint8Array) : Promise<HuksReturnResult>;
316
317    /**
318     * Finish Operation.
319     * @since 8
320     * @deprecated since 9
321     * @useinstead ohos.security.huks.finishSession
322     * @syscap SystemCapability.Security.Huks
323     * @param handle Indicates the handle of the init operation.
324     * @param options Indicates the properties of the finish operation.
325     */
326    function finish(handle: number, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void;
327    function finish(handle: number, options: HuksOptions) : Promise<HuksResult>;
328
329    /**
330     * Finish Operation.
331     * @param {number} handle - Indicates the handle of the init operation.
332     * @param {HuksOptions} options - Indicates the properties of the finish operation.
333     * @param {Uint8Array} token - Indicates the value of AuthToken from USER IAM service.
334     * @throws {BusinessError} 401 - argument is invalid
335     * @throws {BusinessError} 801 - api is not supported
336     * @throws {BusinessError} 12000001 - algorithm mode is not supported
337     * @throws {BusinessError} 12000002 - algorithm param is missing
338     * @throws {BusinessError} 12000003 - algorithm param is invalid
339     * @throws {BusinessError} 12000004 - operating file failed
340     * @throws {BusinessError} 12000005 - IPC communication failed
341     * @throws {BusinessError} 12000006 - error occured in crypto engine
342     * @throws {BusinessError} 12000007 - this credential is already invalidated permanently
343     * @throws {BusinessError} 12000008 - verify authtoken failed
344     * @throws {BusinessError} 12000009 - authtoken is already timeout
345     * @throws {BusinessError} 12000011 - queried entity does not exist
346     * @throws {BusinessError} 12000012 - external error
347     * @throws {BusinessError} 12000014 - memory is insufficient
348     * @syscap SystemCapability.Security.Huks
349     * @since 9
350     */
351     function finishSession(handle: number, options: HuksOptions, callback: AsyncCallback<HuksReturnResult>) : void;
352     function finishSession(handle: number, options: HuksOptions, token: Uint8Array, callback: AsyncCallback<HuksReturnResult>) : void;
353     function finishSession(handle: number, options: HuksOptions, token?: Uint8Array) : Promise<HuksReturnResult>;
354
355    /**
356     * Abort Operation.
357     * @since 8
358     * @deprecated since 9
359     * @useinstead ohos.security.huks.abortSession
360     * @syscap SystemCapability.Security.Huks
361     * @param handle Indicates the handle of the init operation.
362     * @param options Indicates the properties of the abort operation.
363     */
364    function abort(handle: number, options: HuksOptions, callback: AsyncCallback<HuksResult>) : void;
365    function abort(handle: number, options: HuksOptions) : Promise<HuksResult>;
366
367    /**
368     * Abort Operation.
369     * @param {number} handle - Indicates the handle of the init operation.
370     * @param {HuksOptions} options - Indicates the properties of the abort operation.
371     * @throws {BusinessError} 401 - argument is invalid
372     * @throws {BusinessError} 801 - api is not supported
373     * @throws {BusinessError} 12000004 - operating file failed
374     * @throws {BusinessError} 12000005 - IPC communication failed
375     * @throws {BusinessError} 12000006 - error occured in crypto engine
376     * @throws {BusinessError} 12000012 - external error
377     * @throws {BusinessError} 12000014 - memory is insufficient
378     * @syscap SystemCapability.Security.Huks
379     * @since 9
380     */
381    function abortSession(handle: number, options: HuksOptions, callback: AsyncCallback<void>) : void;
382    function abortSession(handle: number, options: HuksOptions) : Promise<void>;
383
384    /**
385     * Key Attestation.
386     * @param {string} keyAlias - Indicates the key's name.
387     * @param {HuksOptions} options - Indicates the properties of the key attestation operation.
388     * @throws {BusinessError} 201 - check permission failed
389     * @throws {BusinessError} 401 - argument is invalid
390     * @throws {BusinessError} 801 - api is not supported
391     * @throws {BusinessError} 12000001 - algorithm mode is not supported
392     * @throws {BusinessError} 12000002 - algorithm param is missing
393     * @throws {BusinessError} 12000003 - algorithm param is invalid
394     * @throws {BusinessError} 12000004 - operating file failed
395     * @throws {BusinessError} 12000005 - IPC communication failed
396     * @throws {BusinessError} 12000006 - error occured in crypto engine
397     * @throws {BusinessError} 12000011 - queried entity does not exist
398     * @throws {BusinessError} 12000012 - external error
399     * @throws {BusinessError} 12000014 - memory is insufficient
400     * @syscap SystemCapability.Security.Huks
401     * @since 9
402     */
403     function attestKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksReturnResult>) : void;
404     function attestKeyItem(keyAlias: string, options: HuksOptions) : Promise<HuksReturnResult>;
405
406    /**
407     * Get the sdk version.
408     * @since 8
409     * @syscap SystemCapability.Security.Huks
410     * @param options Indicates the properties of the key.
411     * @returns Return the character string of the sdk version.
412     */
413    function getSdkVersion(options: HuksOptions) : string;
414
415    /**
416     * Interface of huks param.
417     * @since 8
418     * @syscap SystemCapability.Security.Huks
419     */
420    export interface HuksParam {
421        tag: HuksTag;
422        value: boolean | number | bigint | Uint8Array;
423    }
424
425    /**
426     * Interface of huks handle.
427     * @since 8
428     * @deprecated since 9
429     * @useinstead ohos.security.huks.HuksSessionHandle
430     * @syscap SystemCapability.Security.Huks
431     */
432    export interface HuksHandle {
433        errorCode: number;
434        handle: number;
435        token?: Uint8Array;
436    }
437
438    /**
439     * Interface of huks handle.
440     * @since 9
441     * @syscap SystemCapability.Security.Huks
442     */
443     export interface HuksSessionHandle {
444        handle: number;
445        challenge?: Uint8Array;
446    }
447
448    /**
449     * Interface of huks option.
450     * @since 8
451     * @syscap SystemCapability.Security.Huks
452     */
453    export interface HuksOptions {
454        properties?: Array<HuksParam>;
455        inData?: Uint8Array;
456    }
457
458    /**
459     * Interface of huks result.
460     * @since 8
461     * @deprecated since 9
462     * @useinstead ohos.security.huks.HuksReturnResult
463     * @syscap SystemCapability.Security.Huks
464     */
465    export interface HuksResult {
466        errorCode: number;
467        outData?: Uint8Array;
468        properties?: Array<HuksParam>;
469        certChains?: Array<string>;
470    }
471
472    /**
473     * Interface of huks result.
474     * @since 9
475     * @syscap SystemCapability.Security.Huks
476     */
477    export interface HuksReturnResult {
478        outData?: Uint8Array;
479        properties?: Array<HuksParam>;
480        certChains?: Array<string>;
481    }
482
483    /**
484     * @name HuksErrorCode
485     * @since 8
486     * @deprecated since 9
487     * @useinstead ohos.security.huks.HuksExceptionErrCode
488     * @syscap SystemCapability.Security.Huks
489     */
490    export enum HuksErrorCode {
491        HUKS_SUCCESS = 0,
492        HUKS_FAILURE = -1,
493        HUKS_ERROR_BAD_STATE = -2,
494        HUKS_ERROR_INVALID_ARGUMENT = -3,
495        HUKS_ERROR_NOT_SUPPORTED = -4,
496        HUKS_ERROR_NO_PERMISSION = -5,
497        HUKS_ERROR_INSUFFICIENT_DATA = -6,
498        HUKS_ERROR_BUFFER_TOO_SMALL = -7,
499        HUKS_ERROR_INSUFFICIENT_MEMORY = -8,
500        HUKS_ERROR_COMMUNICATION_FAILURE = -9,
501        HUKS_ERROR_STORAGE_FAILURE = -10,
502        HUKS_ERROR_HARDWARE_FAILURE = -11,
503        HUKS_ERROR_ALREADY_EXISTS = -12,
504        HUKS_ERROR_NOT_EXIST = -13,
505        HUKS_ERROR_NULL_POINTER = -14,
506        HUKS_ERROR_FILE_SIZE_FAIL = -15,
507        HUKS_ERROR_READ_FILE_FAIL = -16,
508        HUKS_ERROR_INVALID_PUBLIC_KEY = -17,
509        HUKS_ERROR_INVALID_PRIVATE_KEY = -18,
510        HUKS_ERROR_INVALID_KEY_INFO = -19,
511        HUKS_ERROR_HASH_NOT_EQUAL = -20,
512        HUKS_ERROR_MALLOC_FAIL = -21,
513        HUKS_ERROR_WRITE_FILE_FAIL = -22,
514        HUKS_ERROR_REMOVE_FILE_FAIL = -23,
515        HUKS_ERROR_OPEN_FILE_FAIL = -24,
516        HUKS_ERROR_CLOSE_FILE_FAIL = -25,
517        HUKS_ERROR_MAKE_DIR_FAIL = -26,
518        HUKS_ERROR_INVALID_KEY_FILE = -27,
519        HUKS_ERROR_IPC_MSG_FAIL = -28,
520        HUKS_ERROR_REQUEST_OVERFLOWS = -29,
521        HUKS_ERROR_PARAM_NOT_EXIST = -30,
522        HUKS_ERROR_CRYPTO_ENGINE_ERROR = -31,
523        HUKS_ERROR_COMMUNICATION_TIMEOUT = -32,
524        HUKS_ERROR_IPC_INIT_FAIL = -33,
525        HUKS_ERROR_IPC_DLOPEN_FAIL = -34,
526        HUKS_ERROR_EFUSE_READ_FAIL = -35,
527        HUKS_ERROR_NEW_ROOT_KEY_MATERIAL_EXIST = -36,
528        HUKS_ERROR_UPDATE_ROOT_KEY_MATERIAL_FAIL = -37,
529        HUKS_ERROR_VERIFICATION_FAILED = -38,
530
531        HUKS_ERROR_CHECK_GET_ALG_FAIL = -100,
532        HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL = -101,
533        HUKS_ERROR_CHECK_GET_PADDING_FAIL = -102,
534        HUKS_ERROR_CHECK_GET_PURPOSE_FAIL = -103,
535        HUKS_ERROR_CHECK_GET_DIGEST_FAIL =  -104,
536        HUKS_ERROR_CHECK_GET_MODE_FAIL = -105,
537        HUKS_ERROR_CHECK_GET_NONCE_FAIL = -106,
538        HUKS_ERROR_CHECK_GET_AAD_FAIL = -107,
539        HUKS_ERROR_CHECK_GET_IV_FAIL = -108,
540        HUKS_ERROR_CHECK_GET_AE_TAG_FAIL = -109,
541        HUKS_ERROR_CHECK_GET_SALT_FAIL = -110,
542        HUKS_ERROR_CHECK_GET_ITERATION_FAIL = -111,
543        HUKS_ERROR_INVALID_ALGORITHM = -112,
544        HUKS_ERROR_INVALID_KEY_SIZE = -113,
545        HUKS_ERROR_INVALID_PADDING = -114,
546        HUKS_ERROR_INVALID_PURPOSE = -115,
547        HUKS_ERROR_INVALID_MODE = -116,
548        HUKS_ERROR_INVALID_DIGEST =  -117,
549        HUKS_ERROR_INVALID_SIGNATURE_SIZE = -118,
550        HUKS_ERROR_INVALID_IV = -119,
551        HUKS_ERROR_INVALID_AAD = -120,
552        HUKS_ERROR_INVALID_NONCE = -121,
553        HUKS_ERROR_INVALID_AE_TAG = -122,
554        HUKS_ERROR_INVALID_SALT = -123,
555        HUKS_ERROR_INVALID_ITERATION = -124,
556        HUKS_ERROR_INVALID_OPERATION = -125,
557
558        HUKS_ERROR_INTERNAL_ERROR = -999,
559        HUKS_ERROR_UNKNOWN_ERROR = -1000,
560    }
561
562    /**
563     * @name HuksExceptionErrCode
564     * @since 9
565     * @syscap SystemCapability.Security.Huks
566     */
567     export enum HuksExceptionErrCode {
568        HUKS_ERR_CODE_PERMISSION_FAIL = 201,
569        HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401,
570        HUKS_ERR_CODE_NOT_SUPPORTED_API = 801,
571
572        HUKS_ERR_CODE_FEATURE_NOT_SUPPORTED = 12000001,
573        HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT = 12000002,
574        HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT = 12000003,
575        HUKS_ERR_CODE_FILE_OPERATION_FAIL = 12000004,
576        HUKS_ERR_CODE_COMMUNICATION_FAIL = 12000005,
577        HUKS_ERR_CODE_CRYPTO_FAIL = 12000006,
578        HUKS_ERR_CODE_KEY_AUTH_PERMANENTLY_INVALIDATED = 12000007,
579        HUKS_ERR_CODE_KEY_AUTH_VERIFY_FAILED = 12000008,
580        HUKS_ERR_CODE_KEY_AUTH_TIME_OUT = 12000009,
581        HUKS_ERR_CODE_SESSION_LIMIT = 12000010,
582        HUKS_ERR_CODE_ITEM_NOT_EXIST = 12000011,
583        HUKS_ERR_CODE_EXTERNAL_ERROR = 12000012,
584        HUKS_ERR_CODE_CREDENTIAL_NOT_EXIST = 12000013,
585        HUKS_ERR_CODE_INSUFFICIENT_MEMORY = 12000014,
586        HUKS_ERR_CODE_CALL_SERVICE_FAILED = 12000015,
587    }
588
589    /**
590     * @name HuksKeyPurpose
591     * @since 8
592     * @syscap SystemCapability.Security.Huks
593     */
594    export enum HuksKeyPurpose {
595        HUKS_KEY_PURPOSE_ENCRYPT = 1,                   /* Usable with RSA, EC and AES keys. */
596        HUKS_KEY_PURPOSE_DECRYPT = 2,                   /* Usable with RSA, EC and AES keys. */
597        HUKS_KEY_PURPOSE_SIGN = 4,                      /* Usable with RSA, EC keys. */
598        HUKS_KEY_PURPOSE_VERIFY = 8,                    /* Usable with RSA, EC keys. */
599        HUKS_KEY_PURPOSE_DERIVE = 16,                   /* Usable with EC keys. */
600        HUKS_KEY_PURPOSE_WRAP = 32,                     /* Usable with wrap key. */
601        HUKS_KEY_PURPOSE_UNWRAP = 64,                   /* Usable with unwrap key. */
602        HUKS_KEY_PURPOSE_MAC = 128,                     /* Usable with mac. */
603        HUKS_KEY_PURPOSE_AGREE = 256,                   /* Usable with agree. */
604    }
605
606    /**
607     * @name HuksKeyDigest
608     * @since 8
609     * @syscap SystemCapability.Security.Huks
610     */
611    export enum HuksKeyDigest {
612        HUKS_DIGEST_NONE = 0,
613        HUKS_DIGEST_MD5 = 1,
614        /**
615         * @name HUKS_DIGEST_SM3
616         * @since 9
617         * @syscap SystemCapability.Security.Huks
618         */
619        HUKS_DIGEST_SM3 = 2,
620        HUKS_DIGEST_SHA1 = 10,
621        HUKS_DIGEST_SHA224 = 11,
622        HUKS_DIGEST_SHA256 = 12,
623        HUKS_DIGEST_SHA384 = 13,
624        HUKS_DIGEST_SHA512 = 14,
625    }
626
627    /**
628     * @name HuksKeyPadding
629     * @since 8
630     * @syscap SystemCapability.Security.Huks
631     */
632    export enum HuksKeyPadding {
633        HUKS_PADDING_NONE = 0,
634        HUKS_PADDING_OAEP = 1,
635        HUKS_PADDING_PSS = 2,
636        HUKS_PADDING_PKCS1_V1_5 = 3,
637        HUKS_PADDING_PKCS5 = 4,
638        HUKS_PADDING_PKCS7 = 5,
639    }
640
641    /**
642     * @name HuksCipherMode
643     * @since 8
644     * @syscap SystemCapability.Security.Huks
645     */
646    export enum HuksCipherMode {
647        HUKS_MODE_ECB = 1,
648        HUKS_MODE_CBC = 2,
649        HUKS_MODE_CTR = 3,
650        HUKS_MODE_OFB = 4,
651        HUKS_MODE_CCM = 31,
652        HUKS_MODE_GCM = 32,
653    }
654
655    /**
656     * @name HuksKeySize
657     * @since 8
658     * @syscap SystemCapability.Security.Huks
659     */
660    export enum HuksKeySize {
661        HUKS_RSA_KEY_SIZE_512 = 512,
662        HUKS_RSA_KEY_SIZE_768 = 768,
663        HUKS_RSA_KEY_SIZE_1024 = 1024,
664        HUKS_RSA_KEY_SIZE_2048 = 2048,
665        HUKS_RSA_KEY_SIZE_3072 = 3072,
666        HUKS_RSA_KEY_SIZE_4096 = 4096,
667
668        HUKS_ECC_KEY_SIZE_224 = 224,
669        HUKS_ECC_KEY_SIZE_256 = 256,
670        HUKS_ECC_KEY_SIZE_384 = 384,
671        HUKS_ECC_KEY_SIZE_521 = 521,
672
673        HUKS_AES_KEY_SIZE_128 = 128,
674        HUKS_AES_KEY_SIZE_192 = 192,
675        HUKS_AES_KEY_SIZE_256 = 256,
676        HUKS_AES_KEY_SIZE_512 = 512,
677
678        HUKS_CURVE25519_KEY_SIZE_256 = 256,
679
680        HUKS_DH_KEY_SIZE_2048 = 2048,
681        HUKS_DH_KEY_SIZE_3072 = 3072,
682        HUKS_DH_KEY_SIZE_4096 = 4096,
683
684        /**
685         * @name HUKS_SM2_KEY_SIZE_256
686         * @since 9
687         * @syscap SystemCapability.Security.Huks
688         */
689        HUKS_SM2_KEY_SIZE_256 = 256,
690        /**
691         * @name HUKS_SM4_KEY_SIZE_128
692         * @since 9
693         * @syscap SystemCapability.Security.Huks
694         */
695        HUKS_SM4_KEY_SIZE_128 = 128,
696    }
697
698    /**
699     * @name HuksKeyAlg
700     * @since 8
701     * @syscap SystemCapability.Security.Huks
702     */
703    export enum HuksKeyAlg {
704        HUKS_ALG_RSA = 1,
705        HUKS_ALG_ECC = 2,
706        HUKS_ALG_DSA = 3,
707
708        HUKS_ALG_AES = 20,
709        HUKS_ALG_HMAC = 50,
710        HUKS_ALG_HKDF = 51,
711        HUKS_ALG_PBKDF2 = 52,
712
713        HUKS_ALG_ECDH = 100,
714        HUKS_ALG_X25519 = 101,
715        HUKS_ALG_ED25519 = 102,
716        HUKS_ALG_DH = 103,
717
718        /**
719         * @name HUKS_ALG_SM2
720         * @since 9
721         * @syscap SystemCapability.Security.Huks
722         */
723        HUKS_ALG_SM2 = 150,
724        /**
725         * @name HUKS_ALG_SM3
726         * @since 9
727         * @syscap SystemCapability.Security.Huks
728         */
729        HUKS_ALG_SM3 = 151,
730        /**
731         * @name HUKS_ALG_SM4
732         * @since 9
733         * @syscap SystemCapability.Security.Huks
734         */
735        HUKS_ALG_SM4 = 152,
736    }
737
738    /**
739     * @name HuksUnwrapSuite
740     * @since 9
741     * @syscap SystemCapability.Security.Huks
742     */
743    export enum HuksUnwrapSuite {
744        HUKS_UNWRAP_SUITE_X25519_AES_256_GCM_NOPADDING = 1,
745        HUKS_UNWRAP_SUITE_ECDH_AES_256_GCM_NOPADDING = 2,
746    }
747
748    /**
749     * @name HuksKeyGenerateType
750     * @since 8
751     * @syscap SystemCapability.Security.Huks
752     */
753    export enum HuksKeyGenerateType {
754        HUKS_KEY_GENERATE_TYPE_DEFAULT = 0,
755        HUKS_KEY_GENERATE_TYPE_DERIVE = 1,
756        HUKS_KEY_GENERATE_TYPE_AGREE = 2,
757    }
758
759    /**
760     * @name HuksKeyFlag
761     * @since 8
762     * @syscap SystemCapability.Security.Huks
763     */
764    export enum HuksKeyFlag {
765        HUKS_KEY_FLAG_IMPORT_KEY = 1,
766        HUKS_KEY_FLAG_GENERATE_KEY = 2,
767        HUKS_KEY_FLAG_AGREE_KEY = 3,
768        HUKS_KEY_FLAG_DERIVE_KEY = 4,
769    }
770
771    /**
772     * @name HuksKeyStorageType
773     * @since 8
774     * @syscap SystemCapability.Security.Huks
775     */
776    export enum HuksKeyStorageType {
777        HUKS_STORAGE_TEMP = 0,
778        HUKS_STORAGE_PERSISTENT = 1,
779    }
780
781    /**
782     * @name HuksImportKeyType
783     * @since 9
784     * @syscap SystemCapability.Security.Huks
785     */
786    export enum HuksImportKeyType {
787        HUKS_KEY_TYPE_PUBLIC_KEY = 0,
788        HUKS_KEY_TYPE_PRIVATE_KEY = 1,
789        HUKS_KEY_TYPE_KEY_PAIR = 2,
790    }
791
792    /**
793     * @name HuksUserAuthType
794     * @since 9
795     * @syscap SystemCapability.Security.Huks
796     */
797    export enum HuksUserAuthType {
798        HUKS_USER_AUTH_TYPE_FINGERPRINT = 1 << 0,
799        HUKS_USER_AUTH_TYPE_FACE = 1 << 1,
800        HUKS_USER_AUTH_TYPE_PIN = 1 << 2,
801    }
802
803    /**
804     * @name HuksAuthAccessType
805     * @since 9
806     * @syscap SystemCapability.Security.Huks
807     */
808    export enum HuksAuthAccessType {
809        HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD = 1 << 0,
810        HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL = 1 << 1,
811    }
812
813    /**
814     * @name HuksChallengeType
815     * @since 9
816     * @syscap SystemCapability.Security.Huks
817     */
818    export enum HuksChallengeType {
819        HUKS_CHALLENGE_TYPE_NORMAL = 0,
820        HUKS_CHALLENGE_TYPE_CUSTOM = 1,
821        HUKS_CHALLENGE_TYPE_NONE = 2,
822    }
823
824    /**
825     * @name HuksChallengePosition
826     * @since 9
827     * @syscap SystemCapability.Security.Huks
828     */
829    export enum HuksChallengePosition {
830        HUKS_CHALLENGE_POS_0 = 0,
831        HUKS_CHALLENGE_POS_1,
832        HUKS_CHALLENGE_POS_2,
833        HUKS_CHALLENGE_POS_3,
834    }
835
836    /**
837     * @name HuksSecureSignType
838     * @since 9
839     * @syscap SystemCapability.Security.Huks
840     */
841    export enum HuksSecureSignType {
842        HUKS_SECURE_SIGN_WITH_AUTHINFO = 1,
843    }
844
845    /**
846     * @name HuksSendType
847     * @since 8
848     * @syscap SystemCapability.Security.Huks
849     */
850    export enum HuksSendType {
851        HUKS_SEND_TYPE_ASYNC = 0,
852        HUKS_SEND_TYPE_SYNC = 1,
853    }
854
855    /**
856     * @name HuksTagType
857     * @since 8
858     * @syscap SystemCapability.Security.Huks
859     */
860    export enum HuksTagType {
861        HUKS_TAG_TYPE_INVALID = 0 << 28,
862        HUKS_TAG_TYPE_INT = 1 << 28,
863        HUKS_TAG_TYPE_UINT = 2 << 28,
864        HUKS_TAG_TYPE_ULONG = 3 << 28,
865        HUKS_TAG_TYPE_BOOL = 4 << 28,
866        HUKS_TAG_TYPE_BYTES = 5 << 28,
867    }
868
869    /**
870     * @name HuksTag
871     * @since 8
872     * @syscap SystemCapability.Security.Huks
873     */
874    export enum HuksTag {
875        /* Invalid TAG */
876        /**
877         * @since 8
878         * @deprecated since 9
879         * @syscap SystemCapability.Security.Huks
880         */
881        HUKS_TAG_INVALID = HuksTagType.HUKS_TAG_TYPE_INVALID | 0,
882
883        /* Base algrithom TAG: 1 - 200 */
884        HUKS_TAG_ALGORITHM = HuksTagType.HUKS_TAG_TYPE_UINT | 1,
885        HUKS_TAG_PURPOSE = HuksTagType.HUKS_TAG_TYPE_UINT | 2,
886        HUKS_TAG_KEY_SIZE = HuksTagType.HUKS_TAG_TYPE_UINT | 3,
887        HUKS_TAG_DIGEST = HuksTagType.HUKS_TAG_TYPE_UINT | 4,
888        HUKS_TAG_PADDING = HuksTagType.HUKS_TAG_TYPE_UINT | 5,
889        HUKS_TAG_BLOCK_MODE = HuksTagType.HUKS_TAG_TYPE_UINT | 6,
890        HUKS_TAG_KEY_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 7,
891        HUKS_TAG_ASSOCIATED_DATA = HuksTagType.HUKS_TAG_TYPE_BYTES | 8,
892        HUKS_TAG_NONCE = HuksTagType.HUKS_TAG_TYPE_BYTES | 9,
893        HUKS_TAG_IV = HuksTagType.HUKS_TAG_TYPE_BYTES | 10,
894
895        /* Key derivation TAG */
896        HUKS_TAG_INFO = HuksTagType.HUKS_TAG_TYPE_BYTES | 11,
897        HUKS_TAG_SALT = HuksTagType.HUKS_TAG_TYPE_BYTES | 12,
898        /**
899         * @since 8
900         * @deprecated since 9
901         * @syscap SystemCapability.Security.Huks
902         */
903        HUKS_TAG_PWD = HuksTagType.HUKS_TAG_TYPE_BYTES | 13,
904        HUKS_TAG_ITERATION = HuksTagType.HUKS_TAG_TYPE_UINT | 14,
905
906        HUKS_TAG_KEY_GENERATE_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 15, /* choose from enum HuksKeyGenerateType */
907        /**
908         * @since 8
909         * @deprecated since 9
910         * @syscap SystemCapability.Security.Huks
911         */
912        HUKS_TAG_DERIVE_MAIN_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES | 16,
913        /**
914         * @since 8
915         * @deprecated since 9
916         * @syscap SystemCapability.Security.Huks
917         */
918        HUKS_TAG_DERIVE_FACTOR = HuksTagType.HUKS_TAG_TYPE_BYTES | 17,
919        /**
920         * @since 8
921         * @deprecated since 9
922         * @syscap SystemCapability.Security.Huks
923         */
924        HUKS_TAG_DERIVE_ALG = HuksTagType.HUKS_TAG_TYPE_UINT | 18,
925        HUKS_TAG_AGREE_ALG = HuksTagType.HUKS_TAG_TYPE_UINT | 19,
926        HUKS_TAG_AGREE_PUBLIC_KEY_IS_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL | 20,
927        HUKS_TAG_AGREE_PRIVATE_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BYTES | 21,
928        HUKS_TAG_AGREE_PUBLIC_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES | 22,
929        HUKS_TAG_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BYTES | 23,
930        HUKS_TAG_DERIVE_KEY_SIZE = HuksTagType.HUKS_TAG_TYPE_UINT | 24,
931
932        /**
933         * @name HUKS_TAG_IMPORT_KEY_TYPE
934         * @since 9
935         * @syscap SystemCapability.Security.Huks
936         */
937        HUKS_TAG_IMPORT_KEY_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 25, /* choose from enum HuksImportKeyType */
938
939        /**
940         * @name HUKS_TAG_UNWRAP_ALGORITHM_SUITE
941         * @since 9
942         * @syscap SystemCapability.Security.Huks
943         */
944        HUKS_TAG_UNWRAP_ALGORITHM_SUITE = HuksTagType.HUKS_TAG_TYPE_UINT | 26,
945
946        /*
947         * Key authentication related TAG: 201 - 300
948         *
949         * Start of validity
950         */
951        /**
952         * @since 8
953         * @deprecated since 9
954         * @syscap SystemCapability.Security.Huks
955         */
956        HUKS_TAG_ACTIVE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG | 201,
957
958        /* Date when new "messages" should not be created. */
959        /**
960         * @since 8
961         * @deprecated since 9
962         * @syscap SystemCapability.Security.Huks
963         */
964        HUKS_TAG_ORIGINATION_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG | 202,
965
966        /* Date when existing "messages" should not be used. */
967        /**
968         * @since 8
969         * @deprecated since 9
970         * @syscap SystemCapability.Security.Huks
971         */
972        HUKS_TAG_USAGE_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG | 203,
973
974        /* Key creation time */
975        /**
976         * @since 8
977         * @deprecated since 9
978         * @syscap SystemCapability.Security.Huks
979         */
980        HUKS_TAG_CREATION_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG | 204,
981
982        /* Other authentication related TAG: 301 - 500 */
983        HUKS_TAG_ALL_USERS = HuksTagType.HUKS_TAG_TYPE_BOOL | 301,
984        HUKS_TAG_USER_ID = HuksTagType.HUKS_TAG_TYPE_UINT | 302,
985        HUKS_TAG_NO_AUTH_REQUIRED = HuksTagType.HUKS_TAG_TYPE_BOOL | 303,
986        HUKS_TAG_USER_AUTH_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 304,
987        HUKS_TAG_AUTH_TIMEOUT = HuksTagType.HUKS_TAG_TYPE_UINT | 305,
988        HUKS_TAG_AUTH_TOKEN = HuksTagType.HUKS_TAG_TYPE_BYTES | 306,
989
990        /* Key secure access control and user auth TAG */
991
992        /**
993         * @name HUKS_TAG_KEY_AUTH_ACCESS_TYPE
994         * @since 9
995         * @syscap SystemCapability.Security.Huks
996         */
997         HUKS_TAG_KEY_AUTH_ACCESS_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 307,
998
999        /**
1000         * @name HUKS_TAG_KEY_SECURE_SIGN_TYPE
1001         * @since 9
1002         * @syscap SystemCapability.Security.Huks
1003         */
1004        HUKS_TAG_KEY_SECURE_SIGN_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 308,
1005
1006        /**
1007         * @name HUKS_TAG_CHALLENGE_TYPE
1008         * @since 9
1009         * @syscap SystemCapability.Security.Huks
1010         */
1011        HUKS_TAG_CHALLENGE_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 309,
1012
1013        /**
1014         * @name HUKS_TAG_CHALLENGE_POS
1015         * @since 9
1016         * @syscap SystemCapability.Security.Huks
1017         */
1018        HUKS_TAG_CHALLENGE_POS = HuksTagType.HUKS_TAG_TYPE_UINT | 310,
1019
1020        /* Attestation related TAG: 501 - 600 */
1021        HUKS_TAG_ATTESTATION_CHALLENGE = HuksTagType.HUKS_TAG_TYPE_BYTES | 501,
1022        HUKS_TAG_ATTESTATION_APPLICATION_ID = HuksTagType.HUKS_TAG_TYPE_BYTES | 502,
1023        /**
1024         * @since 8
1025         * @deprecated since 9
1026         * @syscap SystemCapability.Security.Huks
1027         */
1028        HUKS_TAG_ATTESTATION_ID_BRAND = HuksTagType.HUKS_TAG_TYPE_BYTES | 503,
1029        /**
1030         * @since 8
1031         * @deprecated since 9
1032         * @syscap SystemCapability.Security.Huks
1033         */
1034        HUKS_TAG_ATTESTATION_ID_DEVICE = HuksTagType.HUKS_TAG_TYPE_BYTES | 504,
1035        /**
1036         * @since 8
1037         * @deprecated since 9
1038         * @syscap SystemCapability.Security.Huks
1039         */
1040        HUKS_TAG_ATTESTATION_ID_PRODUCT = HuksTagType.HUKS_TAG_TYPE_BYTES | 505,
1041        /**
1042         * @since 8
1043         * @deprecated since 9
1044         * @syscap SystemCapability.Security.Huks
1045         */
1046        HUKS_TAG_ATTESTATION_ID_SERIAL = HuksTagType.HUKS_TAG_TYPE_BYTES | 506,
1047        /**
1048         * @since 8
1049         * @deprecated since 9
1050         * @syscap SystemCapability.Security.Huks
1051         */
1052        HUKS_TAG_ATTESTATION_ID_IMEI = HuksTagType.HUKS_TAG_TYPE_BYTES | 507,
1053        /**
1054         * @since 8
1055         * @deprecated since 9
1056         * @syscap SystemCapability.Security.Huks
1057         */
1058        HUKS_TAG_ATTESTATION_ID_MEID = HuksTagType.HUKS_TAG_TYPE_BYTES | 508,
1059        /**
1060         * @since 8
1061         * @deprecated since 9
1062         * @syscap SystemCapability.Security.Huks
1063         */
1064        HUKS_TAG_ATTESTATION_ID_MANUFACTURER = HuksTagType.HUKS_TAG_TYPE_BYTES | 509,
1065        /**
1066         * @since 8
1067         * @deprecated since 9
1068         * @syscap SystemCapability.Security.Huks
1069         */
1070        HUKS_TAG_ATTESTATION_ID_MODEL = HuksTagType.HUKS_TAG_TYPE_BYTES | 510,
1071        HUKS_TAG_ATTESTATION_ID_ALIAS = HuksTagType.HUKS_TAG_TYPE_BYTES | 511,
1072        /**
1073         * @since 8
1074         * @deprecated since 9
1075         * @syscap SystemCapability.Security.Huks
1076         */
1077        HUKS_TAG_ATTESTATION_ID_SOCID = HuksTagType.HUKS_TAG_TYPE_BYTES | 512,
1078        /**
1079         * @since 8
1080         * @deprecated since 9
1081         * @syscap SystemCapability.Security.Huks
1082         */
1083        HUKS_TAG_ATTESTATION_ID_UDID = HuksTagType.HUKS_TAG_TYPE_BYTES | 513,
1084        HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO = HuksTagType.HUKS_TAG_TYPE_BYTES | 514,
1085        HUKS_TAG_ATTESTATION_ID_VERSION_INFO = HuksTagType.HUKS_TAG_TYPE_BYTES | 515,
1086
1087        /*
1088         * Other reserved TAG: 601 - 1000
1089         *
1090         * Extention TAG: 1001 - 9999
1091         */
1092        HUKS_TAG_IS_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL | 1001,
1093        HUKS_TAG_KEY_STORAGE_FLAG = HuksTagType.HUKS_TAG_TYPE_UINT | 1002, /* choose from enum HuksKeyStorageType */
1094        HUKS_TAG_IS_ALLOWED_WRAP = HuksTagType.HUKS_TAG_TYPE_BOOL | 1003,
1095        HUKS_TAG_KEY_WRAP_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 1004,
1096        HUKS_TAG_KEY_AUTH_ID = HuksTagType.HUKS_TAG_TYPE_BYTES | 1005,
1097        HUKS_TAG_KEY_ROLE = HuksTagType.HUKS_TAG_TYPE_UINT | 1006,
1098        HUKS_TAG_KEY_FLAG = HuksTagType.HUKS_TAG_TYPE_UINT | 1007, /* choose from enum HuksKeyFlag */
1099        HUKS_TAG_IS_ASYNCHRONIZED = HuksTagType.HUKS_TAG_TYPE_UINT | 1008,
1100        /**
1101         * @since 8
1102         * @deprecated since 9
1103         * @syscap SystemCapability.Security.Huks
1104         */
1105        HUKS_TAG_SECURE_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL | 1009,
1106        /**
1107         * @since 8
1108         * @deprecated since 9
1109         * @syscap SystemCapability.Security.Huks
1110         */
1111        HUKS_TAG_SECURE_KEY_UUID = HuksTagType.HUKS_TAG_TYPE_BYTES | 1010,
1112        HUKS_TAG_KEY_DOMAIN = HuksTagType.HUKS_TAG_TYPE_UINT | 1011,
1113
1114        /* Inner-use TAG: 10001 - 10999 */
1115        /**
1116         * @since 8
1117         * @deprecated since 9
1118         * @syscap SystemCapability.Security.Huks
1119         */
1120        HUKS_TAG_PROCESS_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES | 10001,
1121        /**
1122         * @since 8
1123         * @deprecated since 9
1124         * @syscap SystemCapability.Security.Huks
1125         */
1126        HUKS_TAG_PACKAGE_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES | 10002,
1127        /**
1128         * @since 8
1129         * @deprecated since 9
1130         * @syscap SystemCapability.Security.Huks
1131         */
1132        HUKS_TAG_ACCESS_TIME = HuksTagType.HUKS_TAG_TYPE_UINT | 10003,
1133        /**
1134         * @since 8
1135         * @deprecated since 9
1136         * @syscap SystemCapability.Security.Huks
1137         */
1138        HUKS_TAG_USES_TIME = HuksTagType.HUKS_TAG_TYPE_UINT | 10004,
1139        /**
1140         * @since 8
1141         * @deprecated since 9
1142         * @syscap SystemCapability.Security.Huks
1143         */
1144        HUKS_TAG_CRYPTO_CTX = HuksTagType.HUKS_TAG_TYPE_ULONG | 10005,
1145        HUKS_TAG_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES | 10006,
1146        /**
1147         * @since 8
1148         * @deprecated since 9
1149         * @syscap SystemCapability.Security.Huks
1150         */
1151        HUKS_TAG_KEY_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT | 10007,
1152        /**
1153         * @since 8
1154         * @deprecated since 9
1155         * @syscap SystemCapability.Security.Huks
1156         */
1157        HUKS_TAG_PAYLOAD_LEN = HuksTagType.HUKS_TAG_TYPE_UINT | 10008,
1158        HUKS_TAG_AE_TAG = HuksTagType.HUKS_TAG_TYPE_BYTES | 10009,
1159        /**
1160         * @since 8
1161         * @deprecated since 9
1162         * @syscap SystemCapability.Security.Huks
1163         */
1164        HUKS_TAG_IS_KEY_HANDLE = HuksTagType.HUKS_TAG_TYPE_ULONG | 10010,
1165
1166        /* Os version related TAG */
1167        /**
1168         * @since 8
1169         * @deprecated since 9
1170         * @syscap SystemCapability.Security.Huks
1171         */
1172        HUKS_TAG_OS_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT | 10101,
1173        /**
1174         * @since 8
1175         * @deprecated since 9
1176         * @syscap SystemCapability.Security.Huks
1177         */
1178        HUKS_TAG_OS_PATCHLEVEL = HuksTagType.HUKS_TAG_TYPE_UINT | 10102,
1179
1180        /*
1181         * Reversed TAGs for SOTER: 11000 - 12000
1182         *
1183         * Other TAGs: 20001 - N
1184         * TAGs used for paramSetOut
1185         */
1186        HUKS_TAG_SYMMETRIC_KEY_DATA = HuksTagType.HUKS_TAG_TYPE_BYTES | 20001,
1187        HUKS_TAG_ASYMMETRIC_PUBLIC_KEY_DATA = HuksTagType.HUKS_TAG_TYPE_BYTES | 20002,
1188        HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA = HuksTagType.HUKS_TAG_TYPE_BYTES | 20003,
1189    }
1190}
1191
1192export default huks;
1193