• 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
16import type { AsyncCallback } from './basic';
17
18/**
19 * OpenHarmony Universal KeyStore
20 *
21 * @namespace huks
22 * @syscap SystemCapability.Security.Huks
23 * @since 8
24 */
25declare namespace huks {
26  /**
27   * Generate Key.
28   *
29   * @param { string } keyAlias - keyAlias indicates the key's name.
30   * @param { HuksOptions } options - options indicates the properties of the key.
31   * @param { AsyncCallback<HuksResult> } callback - the callback of generateKey.
32   * @syscap SystemCapability.Security.Huks
33   * @since 8
34   * @deprecated since 9
35   * @useinstead ohos.security.huks.generateKeyItem
36   */
37  function generateKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>): void;
38
39  /**
40   * Generate Key.
41   *
42   * @param { string } keyAlias - keyAlias indicates the key's name.
43   * @param { HuksOptions } options - options indicates the properties of the key.
44   * @returns { Promise<HuksResult> } the promise returned by the function.
45   * @syscap SystemCapability.Security.Huks
46   * @since 8
47   * @deprecated since 9
48   * @useinstead ohos.security.huks.generateKeyItem
49   */
50  function generateKey(keyAlias: string, options: HuksOptions): Promise<HuksResult>;
51
52  /**
53   * Generate Key.
54   *
55   * @param { string } keyAlias - keyAlias indicates the key's name.
56   * @param { HuksOptions } options - options indicates the properties of the key.
57   * @param { AsyncCallback<void> } callback - the callback of generateKeyItem.
58   * @throws { BusinessError } 401 - argument is invalid
59   * @throws { BusinessError } 801 - api is not supported
60   * @throws { BusinessError } 12000001 - algorithm mode is not supported
61   * @throws { BusinessError } 12000002 - algorithm param is missing
62   * @throws { BusinessError } 12000003 - algorithm param is invalid
63   * @throws { BusinessError } 12000004 - operating file failed
64   * @throws { BusinessError } 12000005 - IPC communication failed
65   * @throws { BusinessError } 12000006 - error occured in crypto engine
66   * @throws { BusinessError } 12000012 - external error
67   * @throws { BusinessError } 12000013 - queried credential does not exist
68   * @throws { BusinessError } 12000014 - memory is insufficient
69   * @throws { BusinessError } 12000015 - call service failed
70   * @syscap SystemCapability.Security.Huks
71   * @since 9
72   */
73  function generateKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback<void>): void;
74
75  /**
76   * Generate Key.
77   *
78   * @param { string } keyAlias - keyAlias indicates the key's name.
79   * @param { HuksOptions } options - options indicates the properties of the key.
80   * @returns { Promise<void> } the promise returned by the function.
81   * @throws { BusinessError } 401 - argument is invalid
82   * @throws { BusinessError } 801 - api is not supported
83   * @throws { BusinessError } 12000001 - algorithm mode is not supported
84   * @throws { BusinessError } 12000002 - algorithm param is missing
85   * @throws { BusinessError } 12000003 - algorithm param is invalid
86   * @throws { BusinessError } 12000004 - operating file failed
87   * @throws { BusinessError } 12000005 - IPC communication failed
88   * @throws { BusinessError } 12000006 - error occured in crypto engine
89   * @throws { BusinessError } 12000012 - external error
90   * @throws { BusinessError } 12000013 - queried credential does not exist
91   * @throws { BusinessError } 12000014 - memory is insufficient
92   * @throws { BusinessError } 12000015 - call service failed
93   * @syscap SystemCapability.Security.Huks
94   * @since 9
95   */
96  function generateKeyItem(keyAlias: string, options: HuksOptions): Promise<void>;
97
98  /**
99   * Delete Key.
100   *
101   * @param { string } keyAlias - keyAlias indicates the key's name.
102   * @param { HuksOptions } options - options indicates the properties of the key.
103   * @param { AsyncCallback<HuksResult> } callback - the callback of deleteKey.
104   * @syscap SystemCapability.Security.Huks
105   * @since 8
106   * @deprecated since 9
107   * @useinstead ohos.security.huks.deleteKeyItem
108   */
109  function deleteKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>): void;
110
111  /**
112   * Delete Key.
113   *
114   * @param { string } keyAlias - keyAlias indicates the key's name.
115   * @param { HuksOptions } options - options indicates the properties of the key.
116   * @returns { Promise<HuksResult> } the promise returned by the function.
117   * @syscap SystemCapability.Security.Huks
118   * @since 8
119   * @deprecated since 9
120   * @useinstead ohos.security.huks.deleteKeyItem
121   */
122  function deleteKey(keyAlias: string, options: HuksOptions): Promise<HuksResult>;
123
124  /**
125   * Delete Key.
126   *
127   * @param { string } keyAlias - keyAlias indicates the key's name.
128   * @param { HuksOptions } options - options indicates the properties of the key.
129   * @param { AsyncCallback<void> } callback - the callback of deleteKeyItem.
130   * @throws { BusinessError } 401 - argument is invalid
131   * @throws { BusinessError } 801 - api is not supported
132   * @throws { BusinessError } 12000004 - operating file failed
133   * @throws { BusinessError } 12000005 - IPC communication failed
134   * @throws { BusinessError } 12000011 - queried entity does not exist
135   * @throws { BusinessError } 12000012 - external error
136   * @throws { BusinessError } 12000014 - memory is insufficient
137   * @syscap SystemCapability.Security.Huks
138   * @since 9
139   */
140  function deleteKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback<void>): void;
141
142  /**
143   * Delete Key.
144   *
145   * @param { string } keyAlias - keyAlias indicates the key's name.
146   * @param { HuksOptions } options - options indicates the properties of the key.
147   * @returns { Promise<void> } the promise returned by the function.
148   * @throws { BusinessError } 401 - argument is invalid
149   * @throws { BusinessError } 801 - api is not supported
150   * @throws { BusinessError } 12000004 - operating file failed
151   * @throws { BusinessError } 12000005 - IPC communication failed
152   * @throws { BusinessError } 12000011 - queried entity does not exist
153   * @throws { BusinessError } 12000012 - external error
154   * @throws { BusinessError } 12000014 - memory is insufficient
155   * @syscap SystemCapability.Security.Huks
156   * @since 9
157   */
158  function deleteKeyItem(keyAlias: string, options: HuksOptions): Promise<void>;
159
160  /**
161   * Import Key.
162   *
163   * @param { string } keyAlias - keyAlias indicates the key's name.
164   * @param { HuksOptions } options - options indicates the properties of the key.
165   * @param { AsyncCallback<HuksResult> } callback - the callback of importKey.
166   * @syscap SystemCapability.Security.Huks
167   * @since 8
168   * @deprecated since 9
169   * @useinstead ohos.security.huks.importKeyItem
170   */
171  function importKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>): void;
172
173  /**
174   * Import Key.
175   *
176   * @param { string } keyAlias - keyAlias indicates the key's name.
177   * @param { HuksOptions } options - options indicates the properties of the key.
178   * @returns { Promise<HuksResult> } the promise returned by the function.
179   * @syscap SystemCapability.Security.Huks
180   * @since 8
181   * @deprecated since 9
182   * @useinstead ohos.security.huks.importKeyItem
183   */
184  function importKey(keyAlias: string, options: HuksOptions): Promise<HuksResult>;
185
186  /**
187   * Import Key.
188   *
189   * @param { string } keyAlias - keyAlias indicates the key's name.
190   * @param { HuksOptions } options - options indicates the properties of the key.
191   * @param { AsyncCallback<void> } callback - the callback of importKeyItem.
192   * @throws { BusinessError } 401 - argument is invalid
193   * @throws { BusinessError } 801 - api is not supported
194   * @throws { BusinessError } 12000001 - algorithm mode is not supported
195   * @throws { BusinessError } 12000002 - algorithm param is missing
196   * @throws { BusinessError } 12000003 - algorithm param is invalid
197   * @throws { BusinessError } 12000004 - operating file failed
198   * @throws { BusinessError } 12000005 - IPC communication failed
199   * @throws { BusinessError } 12000006 - error occured in crypto engine
200   * @throws { BusinessError } 12000011 - queried entity does not exist
201   * @throws { BusinessError } 12000012 - external error
202   * @throws { BusinessError } 12000013 - queried credential does not exist
203   * @throws { BusinessError } 12000014 - memory is insufficient
204   * @throws { BusinessError } 12000015 - call service failed
205   * @syscap SystemCapability.Security.Huks
206   * @since 9
207   */
208  function importKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback<void>): void;
209
210  /**
211   * Import Key.
212   *
213   * @param { string } keyAlias - keyAlias indicates the key's name.
214   * @param { HuksOptions } options - options indicates the properties of the key.
215   * @returns { Promise<void> } the promise returned by the function.
216   * @throws { BusinessError } 401 - argument is invalid
217   * @throws { BusinessError } 801 - api is not supported
218   * @throws { BusinessError } 12000001 - algorithm mode is not supported
219   * @throws { BusinessError } 12000002 - algorithm param is missing
220   * @throws { BusinessError } 12000003 - algorithm param is invalid
221   * @throws { BusinessError } 12000004 - operating file failed
222   * @throws { BusinessError } 12000005 - IPC communication failed
223   * @throws { BusinessError } 12000006 - error occured in crypto engine
224   * @throws { BusinessError } 12000011 - queried entity does not exist
225   * @throws { BusinessError } 12000012 - external error
226   * @throws { BusinessError } 12000013 - queried credential does not exist
227   * @throws { BusinessError } 12000014 - memory is insufficient
228   * @throws { BusinessError } 12000015 - call service failed
229   * @syscap SystemCapability.Security.Huks
230   * @since 9
231   */
232  function importKeyItem(keyAlias: string, options: HuksOptions): Promise<void>;
233
234  /**
235   * Import Wrapped Key.
236   *
237   * @param { string } keyAlias - keyAlias indicates the name of key to be imported.
238   * @param { string } wrappingKeyAlias - wrappingKeyAlias indicates the name of key for wrapping the key to be imported.
239   * @param { HuksOptions } options - options indicates the properties of the key.
240   * @param { AsyncCallback<void> } callback - the callback of importWrappedKeyItem.
241   * @throws { BusinessError } 401 - argument is invalid
242   * @throws { BusinessError } 801 - api is not supported
243   * @throws { BusinessError } 12000001 - algorithm mode is not supported
244   * @throws { BusinessError } 12000002 - algorithm param is missing
245   * @throws { BusinessError } 12000003 - algorithm param is invalid
246   * @throws { BusinessError } 12000004 - operating file failed
247   * @throws { BusinessError } 12000005 - IPC communication failed
248   * @throws { BusinessError } 12000006 - error occured in crypto engine
249   * @throws { BusinessError } 12000011 - queried entity does not exist
250   * @throws { BusinessError } 12000012 - external error
251   * @throws { BusinessError } 12000013 - queried credential does not exist
252   * @throws { BusinessError } 12000014 - memory is insufficient
253   * @throws { BusinessError } 12000015 - call service failed
254   * @syscap SystemCapability.Security.Huks
255   * @since 9
256   */
257  function importWrappedKeyItem(
258    keyAlias: string,
259    wrappingKeyAlias: string,
260    options: HuksOptions,
261    callback: AsyncCallback<void>
262  ): void;
263
264  /**
265   * Import Wrapped Key.
266   *
267   * @param { string } keyAlias - keyAlias indicates the name of key to be imported.
268   * @param { string } wrappingKeyAlias - wrappingKeyAlias indicates the name of key for wrapping the key to be imported.
269   * @param { HuksOptions } options - options indicates the properties of the key.
270   * @returns { Promise<void> } the promise returned by the function.
271   * @throws { BusinessError } 401 - argument is invalid
272   * @throws { BusinessError } 801 - api is not supported
273   * @throws { BusinessError } 12000001 - algorithm mode is not supported
274   * @throws { BusinessError } 12000002 - algorithm param is missing
275   * @throws { BusinessError } 12000003 - algorithm param is invalid
276   * @throws { BusinessError } 12000004 - operating file failed
277   * @throws { BusinessError } 12000005 - IPC communication failed
278   * @throws { BusinessError } 12000006 - error occured in crypto engine
279   * @throws { BusinessError } 12000011 - queried entity does not exist
280   * @throws { BusinessError } 12000012 - external error
281   * @throws { BusinessError } 12000013 - queried credential does not exist
282   * @throws { BusinessError } 12000014 - memory is insufficient
283   * @throws { BusinessError } 12000015 - call service failed
284   * @syscap SystemCapability.Security.Huks
285   * @since 9
286   */
287  function importWrappedKeyItem(keyAlias: string, wrappingKeyAlias: string, options: HuksOptions): Promise<void>;
288
289  /**
290   * Export Key.
291   *
292   * @param { string } keyAlias - keyAlias indicates the key's name.
293   * @param { HuksOptions } options - options indicates the properties of the key.
294   * @param { AsyncCallback<HuksResult> } callback - the callback of exportKey.
295   * @syscap SystemCapability.Security.Huks
296   * @since 8
297   * @deprecated since 9
298   * @useinstead ohos.security.huks.exportKeyItem
299   */
300  function exportKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>): void;
301
302  /**
303   * Export Key.
304   *
305   * @param { string } keyAlias - keyAlias indicates the key's name.
306   * @param { HuksOptions } options - options indicates the properties of the key.
307   * @returns { Promise<HuksResult> } the promise returned by the function.
308   * @syscap SystemCapability.Security.Huks
309   * @since 8
310   * @deprecated since 9
311   * @useinstead ohos.security.huks.exportKeyItem
312   */
313  function exportKey(keyAlias: string, options: HuksOptions): Promise<HuksResult>;
314
315  /**
316   * Export Key.
317   *
318   * @param { string } keyAlias - keyAlias indicates the key's name.
319   * @param { HuksOptions } options - options indicates the properties of the key.
320   * @param { AsyncCallback<HuksReturnResult> } callback - the callback of exportKeyItem.
321   * @throws { BusinessError } 401 - argument is invalid
322   * @throws { BusinessError } 801 - api is not supported
323   * @throws { BusinessError } 12000001 - algorithm mode is not supported
324   * @throws { BusinessError } 12000002 - algorithm param is missing
325   * @throws { BusinessError } 12000003 - algorithm param is invalid
326   * @throws { BusinessError } 12000004 - operating file failed
327   * @throws { BusinessError } 12000005 - IPC communication failed
328   * @throws { BusinessError } 12000006 - error occured in crypto engine
329   * @throws { BusinessError } 12000011 - queried entity does not exist
330   * @throws { BusinessError } 12000012 - external error
331   * @throws { BusinessError } 12000014 - memory is insufficient
332   * @syscap SystemCapability.Security.Huks
333   * @since 9
334   */
335  function exportKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksReturnResult>): void;
336
337  /**
338   * Export Key.
339   *
340   * @param { string } keyAlias - keyAlias indicates the key's name.
341   * @param { HuksOptions } options - options indicates the properties of the key.
342   * @returns { Promise<HuksReturnResult> } the promise returned by the function.
343   * @throws { BusinessError } 401 - argument is invalid
344   * @throws { BusinessError } 801 - api is not supported
345   * @throws { BusinessError } 12000001 - algorithm mode is not supported
346   * @throws { BusinessError } 12000002 - algorithm param is missing
347   * @throws { BusinessError } 12000003 - algorithm param is invalid
348   * @throws { BusinessError } 12000004 - operating file failed
349   * @throws { BusinessError } 12000005 - IPC communication failed
350   * @throws { BusinessError } 12000006 - error occured in crypto engine
351   * @throws { BusinessError } 12000011 - queried entity does not exist
352   * @throws { BusinessError } 12000012 - external error
353   * @throws { BusinessError } 12000014 - memory is insufficient
354   * @syscap SystemCapability.Security.Huks
355   * @since 9
356   */
357  function exportKeyItem(keyAlias: string, options: HuksOptions): Promise<HuksReturnResult>;
358
359  /**
360   * Get properties of the key.
361   *
362   * @param { string } keyAlias - keyAlias indicates the key's name.
363   * @param { HuksOptions } options - options indicates the properties of the key.
364   * @param { AsyncCallback<HuksResult> } callback - the callback of getKeyProperties.
365   * @syscap SystemCapability.Security.Huks
366   * @since 8
367   * @deprecated since 9
368   * @useinstead ohos.security.huks.getKeyItemProperties
369   */
370  function getKeyProperties(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksResult>): void;
371
372  /**
373   * Get properties of the key.
374   *
375   * @param { string } keyAlias - keyAlias indicates the key's name.
376   * @param { HuksOptions } options - options indicates the properties of the key.
377   * @returns { Promise<HuksResult> } the promise returned by the function.
378   * @syscap SystemCapability.Security.Huks
379   * @since 8
380   * @deprecated since 9
381   * @useinstead ohos.security.huks.getKeyItemProperties
382   */
383  function getKeyProperties(keyAlias: string, options: HuksOptions): Promise<HuksResult>;
384
385  /**
386   * Get properties of the key.
387   *
388   * @param { string } keyAlias - keyAlias indicates the key's name.
389   * @param { HuksOptions } options - options indicates the properties of the key.
390   * @param { AsyncCallback<HuksReturnResult> } callback - the callback of getKeyItemProperties.
391   * @throws { BusinessError } 401 - argument is invalid
392   * @throws { BusinessError } 801 - api is not supported
393   * @throws { BusinessError } 12000001 - algorithm mode is not supported
394   * @throws { BusinessError } 12000002 - algorithm param is missing
395   * @throws { BusinessError } 12000003 - algorithm param is invalid
396   * @throws { BusinessError } 12000004 - operating file failed
397   * @throws { BusinessError } 12000005 - IPC communication failed
398   * @throws { BusinessError } 12000006 - error occured in crypto engine
399   * @throws { BusinessError } 12000011 - queried entity does not exist
400   * @throws { BusinessError } 12000012 - external error
401   * @throws { BusinessError } 12000014 - memory is insufficient
402   * @syscap SystemCapability.Security.Huks
403   * @since 9
404   */
405  function getKeyItemProperties(
406    keyAlias: string,
407    options: HuksOptions,
408    callback: AsyncCallback<HuksReturnResult>
409  ): void;
410
411  /**
412   * Get properties of the key.
413   *
414   * @param { string } keyAlias - keyAlias indicates the key's name.
415   * @param { HuksOptions } options - options indicates the properties of the key.
416   * @returns { Promise<HuksReturnResult> } the promise returned by the function.
417   * @throws { BusinessError } 401 - argument is invalid
418   * @throws { BusinessError } 801 - api is not supported
419   * @throws { BusinessError } 12000001 - algorithm mode is not supported
420   * @throws { BusinessError } 12000002 - algorithm param is missing
421   * @throws { BusinessError } 12000003 - algorithm param is invalid
422   * @throws { BusinessError } 12000004 - operating file failed
423   * @throws { BusinessError } 12000005 - IPC communication failed
424   * @throws { BusinessError } 12000006 - error occured in crypto engine
425   * @throws { BusinessError } 12000011 - queried entity does not exist
426   * @throws { BusinessError } 12000012 - external error
427   * @throws { BusinessError } 12000014 - memory is insufficient
428   * @syscap SystemCapability.Security.Huks
429   * @since 9
430   */
431  function getKeyItemProperties(keyAlias: string, options: HuksOptions): Promise<HuksReturnResult>;
432
433  /**
434   * Check whether the key exists.
435   *
436   * @param { string } keyAlias - keyAlias indicates the key's name.
437   * @param { HuksOptions } options - options indicates the properties of the key.
438   * @param { AsyncCallback<boolean> } callback - the callback of isKeyExist.
439   * @syscap SystemCapability.Security.Huks
440   * @since 8
441   * @deprecated since 9
442   * @useinstead ohos.security.huks.isKeyItemExist
443   */
444  function isKeyExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback<boolean>): void;
445
446  /**
447   * Check whether the key exists.
448   *
449   * @param { string } keyAlias - keyAlias indicates the key's name.
450   * @param { HuksOptions } options - options indicates the properties of the key.
451   * @returns { Promise<boolean> } the promise returned by the function.
452   * @syscap SystemCapability.Security.Huks
453   * @since 8
454   * @deprecated since 9
455   * @useinstead ohos.security.huks.isKeyItemExist
456   */
457  function isKeyExist(keyAlias: string, options: HuksOptions): Promise<boolean>;
458
459  /**
460   * Check whether the key exists.
461   *
462   * @param { string } keyAlias - keyAlias indicates the key's name.
463   * @param { HuksOptions } options - options indicates the properties of the key.
464   * @param { AsyncCallback<boolean> } callback - the callback of isKeyItemExist.
465   * @throws { BusinessError } 401 - argument is invalid
466   * @throws { BusinessError } 801 - api is not supported
467   * @throws { BusinessError } 12000002 - algorithm param is missing
468   * @throws { BusinessError } 12000003 - algorithm param is invalid
469   * @throws { BusinessError } 12000004 - operating file failed
470   * @throws { BusinessError } 12000005 - IPC communication failed
471   * @throws { BusinessError } 12000006 - error occured in crypto engine
472   * @throws { BusinessError } 12000012 - external error
473   * @throws { BusinessError } 12000014 - memory is insufficient
474   * @syscap SystemCapability.Security.Huks
475   * @since 9
476   */
477  function isKeyItemExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback<boolean>): void;
478
479  /**
480   * Check whether the key exists.
481   *
482   * @param { string } keyAlias - keyAlias indicates the key's name.
483   * @param { HuksOptions } options - options indicates the properties of the key.
484   * @returns { Promise<boolean> } the promise returned by the function.
485   * @throws { BusinessError } 401 - argument is invalid
486   * @throws { BusinessError } 801 - api is not supported
487   * @throws { BusinessError } 12000002 - algorithm param is missing
488   * @throws { BusinessError } 12000003 - algorithm param is invalid
489   * @throws { BusinessError } 12000004 - operating file failed
490   * @throws { BusinessError } 12000005 - IPC communication failed
491   * @throws { BusinessError } 12000006 - error occured in crypto engine
492   * @throws { BusinessError } 12000012 - external error
493   * @throws { BusinessError } 12000014 - memory is insufficient
494   * @syscap SystemCapability.Security.Huks
495   * @since 9
496   */
497  function isKeyItemExist(keyAlias: string, options: HuksOptions): Promise<boolean>;
498
499  /**
500   * Init Operation.
501   *
502   * @param { string } keyAlias - keyAlias indicates the key's name.
503   * @param { HuksOptions } options - options indicates the properties of the key.
504   * @param { AsyncCallback<HuksHandle> } callback - the callback of init, include the handle.
505   * @syscap SystemCapability.Security.Huks
506   * @since 8
507   * @deprecated since 9
508   * @useinstead ohos.security.huks.initSession
509   */
510  function init(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksHandle>): void;
511
512  /**
513   * Init Operation.
514   *
515   * @param { string } keyAlias - keyAlias indicates the key's name.
516   * @param { HuksOptions } options - options indicates the properties of the key.
517   * @returns { Promise<HuksHandle> } the promise returned by the function, include the handle.
518   * @syscap SystemCapability.Security.Huks
519   * @since 8
520   * @deprecated since 9
521   * @useinstead ohos.security.huks.initSession
522   */
523  function init(keyAlias: string, options: HuksOptions): Promise<HuksHandle>;
524
525  /**
526   * Init Operation.
527   *
528   * @param { string } keyAlias - keyAlias indicates the key's name.
529   * @param { HuksOptions } options - options indicates the properties of the key.
530   * @param { AsyncCallback<HuksSessionHandle> } callback - the callback of initSession.
531   * @throws { BusinessError } 401 - argument is invalid
532   * @throws { BusinessError } 801 - api is not supported
533   * @throws { BusinessError } 12000001 - algorithm mode is not supported
534   * @throws { BusinessError } 12000002 - algorithm param is missing
535   * @throws { BusinessError } 12000003 - algorithm param is invalid
536   * @throws { BusinessError } 12000004 - operating file failed
537   * @throws { BusinessError } 12000005 - IPC communication failed
538   * @throws { BusinessError } 12000006 - error occured in crypto engine
539   * @throws { BusinessError } 12000010 - the number of sessions has reached limit
540   * @throws { BusinessError } 12000011 - queried entity does not exist
541   * @throws { BusinessError } 12000012 - external error
542   * @throws { BusinessError } 12000014 - memory is insufficient
543   * @syscap SystemCapability.Security.Huks
544   * @since 9
545   */
546  function initSession(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksSessionHandle>): void;
547
548  /**
549   * Init Operation.
550   *
551   * @param { string } keyAlias - keyAlias indicates the key's name.
552   * @param { HuksOptions } options - options indicates the properties of the key.
553   * @returns { Promise<HuksSessionHandle> } the promise returned by the function.
554   * @throws { BusinessError } 401 - argument is invalid
555   * @throws { BusinessError } 801 - api is not supported
556   * @throws { BusinessError } 12000001 - algorithm mode is not supported
557   * @throws { BusinessError } 12000002 - algorithm param is missing
558   * @throws { BusinessError } 12000003 - algorithm param is invalid
559   * @throws { BusinessError } 12000004 - operating file failed
560   * @throws { BusinessError } 12000005 - IPC communication failed
561   * @throws { BusinessError } 12000006 - error occured in crypto engine
562   * @throws { BusinessError } 12000010 - the number of sessions has reached limit
563   * @throws { BusinessError } 12000011 - queried entity does not exist
564   * @throws { BusinessError } 12000012 - external error
565   * @throws { BusinessError } 12000014 - memory is insufficient
566   * @syscap SystemCapability.Security.Huks
567   * @since 9
568   */
569  function initSession(keyAlias: string, options: HuksOptions): Promise<HuksSessionHandle>;
570
571  /**
572   * Update Operation.
573   *
574   * @param { number } handle - indicates the handle of the init operation.
575   * @param { Uint8Array } token - token indicates the value of token.
576   * @param { HuksOptions } options - options indicates the properties of the update operation.
577   * @param { AsyncCallback<HuksResult> } callback - the callback of update.
578   * @syscap SystemCapability.Security.Huks
579   * @since 8
580   * @deprecated since 9
581   * @useinstead ohos.security.huks.updateSession
582   */
583  function update(handle: number, token?: Uint8Array, options: HuksOptions, callback: AsyncCallback<HuksResult>): void;
584
585  /**
586   * Update Operation.
587   *
588   * @param { number } handle - indicates the handle of the init operation.
589   * @param { Uint8Array } token - indicates the value of token.
590   * @param { HuksOptions } options - options indicates the properties of the update operation.
591   * @returns { Promise<HuksResult> } the promise returned by the function.
592   * @syscap SystemCapability.Security.Huks
593   * @since 8
594   * @deprecated since 9
595   * @useinstead ohos.security.huks.updateSession
596   */
597  function update(handle: number, token?: Uint8Array, options: HuksOptions): Promise<HuksResult>;
598
599  /**
600   * Update Operation.
601   *
602   * @param { number } handle - indicates the handle of the init operation.
603   * @param { HuksOptions } options - options indicates the properties of the update operation.
604   * @param { AsyncCallback<HuksReturnResult> } callback - the callback of updateSession.
605   * @throws { BusinessError } 401 - argument is invalid
606   * @throws { BusinessError } 801 - api is not supported
607   * @throws { BusinessError } 12000001 - algorithm mode is not supported
608   * @throws { BusinessError } 12000002 - algorithm param is missing
609   * @throws { BusinessError } 12000003 - algorithm param is invalid
610   * @throws { BusinessError } 12000004 - operating file failed
611   * @throws { BusinessError } 12000005 - IPC communication failed
612   * @throws { BusinessError } 12000006 - error occured in crypto engine
613   * @throws { BusinessError } 12000007 - this credential is already invalidated permanently
614   * @throws { BusinessError } 12000008 - verify authtoken failed
615   * @throws { BusinessError } 12000009 - authtoken is already timeout
616   * @throws { BusinessError } 12000011 - queried entity does not exist
617   * @throws { BusinessError } 12000012 - external error
618   * @throws { BusinessError } 12000014 - memory is insufficient
619   * @syscap SystemCapability.Security.Huks
620   * @since 9
621   */
622  function updateSession(handle: number, options: HuksOptions, callback: AsyncCallback<HuksReturnResult>): void;
623
624  /**
625   * Update Operation.
626   *
627   * @param { number } handle - indicates the handle of the init operation.
628   * @param { HuksOptions } options - options indicates the properties of the update operation.
629   * @param { Uint8Array } token - token indicates the value of AuthToken from USER IAM service.
630   * @param { AsyncCallback<HuksReturnResult> } callback - the callback of updateSession.
631   * @throws { BusinessError } 401 - argument is invalid
632   * @throws { BusinessError } 801 - api is not supported
633   * @throws { BusinessError } 12000001 - algorithm mode is not supported
634   * @throws { BusinessError } 12000002 - algorithm param is missing
635   * @throws { BusinessError } 12000003 - algorithm param is invalid
636   * @throws { BusinessError } 12000004 - operating file failed
637   * @throws { BusinessError } 12000005 - IPC communication failed
638   * @throws { BusinessError } 12000006 - error occured in crypto engine
639   * @throws { BusinessError } 12000007 - this credential is already invalidated permanently
640   * @throws { BusinessError } 12000008 - verify authtoken failed
641   * @throws { BusinessError } 12000009 - authtoken is already timeout
642   * @throws { BusinessError } 12000011 - queried entity does not exist
643   * @throws { BusinessError } 12000012 - external error
644   * @throws { BusinessError } 12000014 - memory is insufficient
645   * @syscap SystemCapability.Security.Huks
646   * @since 9
647   */
648  function updateSession(
649    handle: number,
650    options: HuksOptions,
651    token: Uint8Array,
652    callback: AsyncCallback<HuksReturnResult>
653  ): void;
654
655  /**
656   * Update Operation.
657   *
658   * @param { number } handle - indicates the handle of the init operation.
659   * @param { HuksOptions } options - options indicates the properties of the update operation.
660   * @param { Uint8Array } token - token indicates the value of AuthToken from USER IAM service.
661   * @returns { Promise<HuksReturnResult> } the promise returned by the function.
662   * @throws { BusinessError } 401 - argument is invalid
663   * @throws { BusinessError } 801 - api is not supported
664   * @throws { BusinessError } 12000001 - algorithm mode is not supported
665   * @throws { BusinessError } 12000002 - algorithm param is missing
666   * @throws { BusinessError } 12000003 - algorithm param is invalid
667   * @throws { BusinessError } 12000004 - operating file failed
668   * @throws { BusinessError } 12000005 - IPC communication failed
669   * @throws { BusinessError } 12000006 - error occured in crypto engine
670   * @throws { BusinessError } 12000007 - this credential is already invalidated permanently
671   * @throws { BusinessError } 12000008 - verify authtoken failed
672   * @throws { BusinessError } 12000009 - authtoken is already timeout
673   * @throws { BusinessError } 12000011 - queried entity does not exist
674   * @throws { BusinessError } 12000012 - external error
675   * @throws { BusinessError } 12000014 - memory is insufficient
676   * @syscap SystemCapability.Security.Huks
677   * @since 9
678   */
679  function updateSession(handle: number, options: HuksOptions, token?: Uint8Array): Promise<HuksReturnResult>;
680
681  /**
682   * Finish Operation.
683   *
684   * @param { number } handle - indicates the handle of the init operation.
685   * @param { HuksOptions } options - options indicates the properties of the finish operation.
686   * @param { AsyncCallback<HuksResult> } callback - the callback of finish.
687   * @syscap SystemCapability.Security.Huks
688   * @since 8
689   * @deprecated since 9
690   * @useinstead ohos.security.huks.finishSession
691   */
692  function finish(handle: number, options: HuksOptions, callback: AsyncCallback<HuksResult>): void;
693
694  /**
695   * Finish Operation.
696   *
697   * @param { number } handle - indicates the handle of the init operation.
698   * @param { HuksOptions } options - options indicates the properties of the finish operation.
699   * @returns { Promise<HuksResult> } the promise returned by the function.
700   * @syscap SystemCapability.Security.Huks
701   * @since 8
702   * @deprecated since 9
703   * @useinstead ohos.security.huks.finishSession
704   */
705  function finish(handle: number, options: HuksOptions): Promise<HuksResult>;
706
707  /**
708   * Finish Operation.
709   *
710   * @param { number } handle - indicates the handle of the init operation.
711   * @param { HuksOptions } options - options indicates the properties of the finish operation.
712   * @param { AsyncCallback<HuksReturnResult> } callback - the callback of finishSession.
713   * @throws { BusinessError } 401 - argument is invalid
714   * @throws { BusinessError } 801 - api is not supported
715   * @throws { BusinessError } 12000001 - algorithm mode is not supported
716   * @throws { BusinessError } 12000002 - algorithm param is missing
717   * @throws { BusinessError } 12000003 - algorithm param is invalid
718   * @throws { BusinessError } 12000004 - operating file failed
719   * @throws { BusinessError } 12000005 - IPC communication failed
720   * @throws { BusinessError } 12000006 - error occured in crypto engine
721   * @throws { BusinessError } 12000007 - this credential is already invalidated permanently
722   * @throws { BusinessError } 12000008 - verify authtoken failed
723   * @throws { BusinessError } 12000009 - authtoken is already timeout
724   * @throws { BusinessError } 12000011 - queried entity does not exist
725   * @throws { BusinessError } 12000012 - external error
726   * @throws { BusinessError } 12000014 - memory is insufficient
727   * @syscap SystemCapability.Security.Huks
728   * @since 9
729   */
730  function finishSession(handle: number, options: HuksOptions, callback: AsyncCallback<HuksReturnResult>): void;
731
732  /**
733   * Finish Operation.
734   *
735   * @param { number } handle - indicates the handle of the init operation.
736   * @param { HuksOptions } options - options indicates the properties of the finish operation.
737   * @param { Uint8Array } token - token indicates the value of AuthToken from USER IAM service.
738   * @param { AsyncCallback<HuksReturnResult> } callback - the callback of finishSession.
739   * @throws { BusinessError } 401 - argument is invalid
740   * @throws { BusinessError } 801 - api is not supported
741   * @throws { BusinessError } 12000001 - algorithm mode is not supported
742   * @throws { BusinessError } 12000002 - algorithm param is missing
743   * @throws { BusinessError } 12000003 - algorithm param is invalid
744   * @throws { BusinessError } 12000004 - operating file failed
745   * @throws { BusinessError } 12000005 - IPC communication failed
746   * @throws { BusinessError } 12000006 - error occured in crypto engine
747   * @throws { BusinessError } 12000007 - this credential is already invalidated permanently
748   * @throws { BusinessError } 12000008 - verify authtoken failed
749   * @throws { BusinessError } 12000009 - authtoken is already timeout
750   * @throws { BusinessError } 12000011 - queried entity does not exist
751   * @throws { BusinessError } 12000012 - external error
752   * @throws { BusinessError } 12000014 - memory is insufficient
753   * @syscap SystemCapability.Security.Huks
754   * @since 9
755   */
756  function finishSession(
757    handle: number,
758    options: HuksOptions,
759    token: Uint8Array,
760    callback: AsyncCallback<HuksReturnResult>
761  ): void;
762
763  /**
764   * Finish Operation.
765   *
766   * @param { number } handle - indicates the handle of the init operation.
767   * @param { HuksOptions } options - options indicates the properties of the finish operation.
768   * @param { Uint8Array } token - token indicates the value of AuthToken from USER IAM service.
769   * @returns { Promise<HuksReturnResult> } the promise returned by the function.
770   * @throws { BusinessError } 401 - argument is invalid
771   * @throws { BusinessError } 801 - api is not supported
772   * @throws { BusinessError } 12000001 - algorithm mode is not supported
773   * @throws { BusinessError } 12000002 - algorithm param is missing
774   * @throws { BusinessError } 12000003 - algorithm param is invalid
775   * @throws { BusinessError } 12000004 - operating file failed
776   * @throws { BusinessError } 12000005 - IPC communication failed
777   * @throws { BusinessError } 12000006 - error occured in crypto engine
778   * @throws { BusinessError } 12000007 - this credential is already invalidated permanently
779   * @throws { BusinessError } 12000008 - verify authtoken failed
780   * @throws { BusinessError } 12000009 - authtoken is already timeout
781   * @throws { BusinessError } 12000011 - queried entity does not exist
782   * @throws { BusinessError } 12000012 - external error
783   * @throws { BusinessError } 12000014 - memory is insufficient
784   * @syscap SystemCapability.Security.Huks
785   * @since 9
786   */
787  function finishSession(handle: number, options: HuksOptions, token?: Uint8Array): Promise<HuksReturnResult>;
788
789  /**
790   * Abort Operation.
791   *
792   * @param { number } handle - indicates the handle of the init operation.
793   * @param { HuksOptions } options - options indicates the properties of the abort operation.
794   * @param { AsyncCallback<HuksResult> } callback - the callback of finishSession.
795   * @syscap SystemCapability.Security.Huks
796   * @since 8
797   * @deprecated since 9
798   * @useinstead ohos.security.huks.abortSession
799   */
800  function abort(handle: number, options: HuksOptions, callback: AsyncCallback<HuksResult>): void;
801
802  /**
803   * Abort Operation.
804   *
805   * @param { number } handle - indicates the handle of the init operation.
806   * @param { HuksOptions } options - options indicates the properties of the abort operation.
807   * @returns { Promise<HuksResult> } the promise returned by the function.
808   * @syscap SystemCapability.Security.Huks
809   * @since 8
810   * @deprecated since 9
811   * @useinstead ohos.security.huks.abortSession
812   */
813  function abort(handle: number, options: HuksOptions): Promise<HuksResult>;
814
815  /**
816   * Abort Operation.
817   *
818   * @param { number } handle - indicates the handle of the init operation.
819   * @param { HuksOptions } options - options indicates the properties of the abort operation.
820   * @param { AsyncCallback<void> } callback - the callback of abortSession.
821   * @throws { BusinessError } 401 - argument is invalid
822   * @throws { BusinessError } 801 - api is not supported
823   * @throws { BusinessError } 12000004 - operating file failed
824   * @throws { BusinessError } 12000005 - IPC communication failed
825   * @throws { BusinessError } 12000006 - error occured in crypto engine
826   * @throws { BusinessError } 12000012 - external error
827   * @throws { BusinessError } 12000014 - memory is insufficient
828   * @syscap SystemCapability.Security.Huks
829   * @since 9
830   */
831  function abortSession(handle: number, options: HuksOptions, callback: AsyncCallback<void>): void;
832
833  /**
834   * Abort Operation.
835   *
836   * @param { number } handle - indicates the handle of the init operation.
837   * @param { HuksOptions } options - options indicates the properties of the abort operation.
838   * @returns { Promise<void> } the promise returned by the function.
839   * @throws { BusinessError } 401 - argument is invalid
840   * @throws { BusinessError } 801 - api is not supported
841   * @throws { BusinessError } 12000004 - operating file failed
842   * @throws { BusinessError } 12000005 - IPC communication failed
843   * @throws { BusinessError } 12000006 - error occured in crypto engine
844   * @throws { BusinessError } 12000012 - external error
845   * @throws { BusinessError } 12000014 - memory is insufficient
846   * @syscap SystemCapability.Security.Huks
847   * @since 9
848   */
849  function abortSession(handle: number, options: HuksOptions): Promise<void>;
850
851  /**
852   * Key Attestation.
853   *
854   * @param { string } keyAlias - keyAlias indicates the key's name.
855   * @param { HuksOptions } options - options indicates the properties of the key attestation operation.
856   * @param { AsyncCallback<HuksReturnResult> } callback - the callback of attestKeyItem.
857   * @throws { BusinessError } 201 - check permission failed
858   * @throws { BusinessError } 401 - argument is invalid
859   * @throws { BusinessError } 801 - api is not supported
860   * @throws { BusinessError } 12000001 - algorithm mode is not supported
861   * @throws { BusinessError } 12000002 - algorithm param is missing
862   * @throws { BusinessError } 12000003 - algorithm param is invalid
863   * @throws { BusinessError } 12000004 - operating file failed
864   * @throws { BusinessError } 12000005 - IPC communication failed
865   * @throws { BusinessError } 12000006 - error occured in crypto engine
866   * @throws { BusinessError } 12000011 - queried entity does not exist
867   * @throws { BusinessError } 12000012 - external error
868   * @throws { BusinessError } 12000014 - memory is insufficient
869   * @syscap SystemCapability.Security.Huks
870   * @since 9
871   */
872  function attestKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback<HuksReturnResult>): void;
873
874  /**
875   * Key Attestation.
876   *
877   * @param { string } keyAlias - keyAlias indicates the key's name.
878   * @param { HuksOptions } options - options indicates the properties of the key attestation operation.
879   * @returns { Promise<HuksReturnResult> } the promise returned by the function.
880   * @throws { BusinessError } 201 - check permission failed
881   * @throws { BusinessError } 401 - argument is invalid
882   * @throws { BusinessError } 801 - api is not supported
883   * @throws { BusinessError } 12000001 - algorithm mode is not supported
884   * @throws { BusinessError } 12000002 - algorithm param is missing
885   * @throws { BusinessError } 12000003 - algorithm param is invalid
886   * @throws { BusinessError } 12000004 - operating file failed
887   * @throws { BusinessError } 12000005 - IPC communication failed
888   * @throws { BusinessError } 12000006 - error occured in crypto engine
889   * @throws { BusinessError } 12000011 - queried entity does not exist
890   * @throws { BusinessError } 12000012 - external error
891   * @throws { BusinessError } 12000014 - memory is insufficient
892   * @syscap SystemCapability.Security.Huks
893   * @since 9
894   */
895  function attestKeyItem(keyAlias: string, options: HuksOptions): Promise<HuksReturnResult>;
896
897  /**
898   * Get the sdk version.
899   *
900   * @param { HuksOptions } options - options indicates the properties of the key.
901   * @returns { string } the character string of the sdk version.
902   * @syscap SystemCapability.Security.Huks
903   * @since 8
904   */
905  function getSdkVersion(options: HuksOptions): string;
906
907  /**
908   * Interface of huks param.
909   *
910   * @typedef HuksParam
911   * @syscap SystemCapability.Security.Huks
912   * @since 8
913   */
914  export interface HuksParam {
915    tag: HuksTag;
916    value: boolean | number | bigint | Uint8Array;
917  }
918
919  /**
920   * Interface of huks handle.
921   *
922   * @typedef HuksHandle
923   * @syscap SystemCapability.Security.Huks
924   * @since 8
925   * @deprecated since 9
926   * @useinstead ohos.security.huks.HuksSessionHandle
927   */
928  export interface HuksHandle {
929    errorCode: number;
930    handle: number;
931    token?: Uint8Array;
932  }
933
934  /**
935   * Interface of huks handle.
936   *
937   * @typedef HuksSessionHandle
938   * @syscap SystemCapability.Security.Huks
939   * @since 9
940   */
941  export interface HuksSessionHandle {
942    handle: number;
943    challenge?: Uint8Array;
944  }
945
946  /**
947   * Interface of huks option.
948   *
949   * @typedef HuksOptions
950   * @syscap SystemCapability.Security.Huks
951   * @since 8
952   */
953  export interface HuksOptions {
954    properties?: Array<HuksParam>;
955    inData?: Uint8Array;
956  }
957
958  /**
959   * Interface of huks result.
960   *
961   * @typedef HuksResult
962   * @syscap SystemCapability.Security.Huks
963   * @since 8
964   * @deprecated since 9
965   * @useinstead ohos.security.huks.HuksReturnResult
966   */
967  export interface HuksResult {
968    errorCode: number;
969    outData?: Uint8Array;
970    properties?: Array<HuksParam>;
971    certChains?: Array<string>;
972  }
973
974  /**
975   * Interface of huks result.
976   *
977   * @typedef HuksReturnResult
978   * @syscap SystemCapability.Security.Huks
979   * @since 9
980   */
981  export interface HuksReturnResult {
982    outData?: Uint8Array;
983    properties?: Array<HuksParam>;
984    certChains?: Array<string>;
985  }
986
987  /**
988   * Enum for huks error code.
989   *
990   * @enum { number }
991   * @syscap SystemCapability.Security.Huks
992   * @since 8
993   * @deprecated since 9
994   * @useinstead ohos.security.huks.HuksExceptionErrCode
995   */
996  export enum HuksErrorCode {
997    HUKS_SUCCESS = 0,
998    HUKS_FAILURE = -1,
999    HUKS_ERROR_BAD_STATE = -2,
1000    HUKS_ERROR_INVALID_ARGUMENT = -3,
1001    HUKS_ERROR_NOT_SUPPORTED = -4,
1002    HUKS_ERROR_NO_PERMISSION = -5,
1003    HUKS_ERROR_INSUFFICIENT_DATA = -6,
1004    HUKS_ERROR_BUFFER_TOO_SMALL = -7,
1005    HUKS_ERROR_INSUFFICIENT_MEMORY = -8,
1006    HUKS_ERROR_COMMUNICATION_FAILURE = -9,
1007    HUKS_ERROR_STORAGE_FAILURE = -10,
1008    HUKS_ERROR_HARDWARE_FAILURE = -11,
1009    HUKS_ERROR_ALREADY_EXISTS = -12,
1010    HUKS_ERROR_NOT_EXIST = -13,
1011    HUKS_ERROR_NULL_POINTER = -14,
1012    HUKS_ERROR_FILE_SIZE_FAIL = -15,
1013    HUKS_ERROR_READ_FILE_FAIL = -16,
1014    HUKS_ERROR_INVALID_PUBLIC_KEY = -17,
1015    HUKS_ERROR_INVALID_PRIVATE_KEY = -18,
1016    HUKS_ERROR_INVALID_KEY_INFO = -19,
1017    HUKS_ERROR_HASH_NOT_EQUAL = -20,
1018    HUKS_ERROR_MALLOC_FAIL = -21,
1019    HUKS_ERROR_WRITE_FILE_FAIL = -22,
1020    HUKS_ERROR_REMOVE_FILE_FAIL = -23,
1021    HUKS_ERROR_OPEN_FILE_FAIL = -24,
1022    HUKS_ERROR_CLOSE_FILE_FAIL = -25,
1023    HUKS_ERROR_MAKE_DIR_FAIL = -26,
1024    HUKS_ERROR_INVALID_KEY_FILE = -27,
1025    HUKS_ERROR_IPC_MSG_FAIL = -28,
1026    HUKS_ERROR_REQUEST_OVERFLOWS = -29,
1027    HUKS_ERROR_PARAM_NOT_EXIST = -30,
1028    HUKS_ERROR_CRYPTO_ENGINE_ERROR = -31,
1029    HUKS_ERROR_COMMUNICATION_TIMEOUT = -32,
1030    HUKS_ERROR_IPC_INIT_FAIL = -33,
1031    HUKS_ERROR_IPC_DLOPEN_FAIL = -34,
1032    HUKS_ERROR_EFUSE_READ_FAIL = -35,
1033    HUKS_ERROR_NEW_ROOT_KEY_MATERIAL_EXIST = -36,
1034    HUKS_ERROR_UPDATE_ROOT_KEY_MATERIAL_FAIL = -37,
1035    HUKS_ERROR_VERIFICATION_FAILED = -38,
1036
1037    HUKS_ERROR_CHECK_GET_ALG_FAIL = -100,
1038    HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL = -101,
1039    HUKS_ERROR_CHECK_GET_PADDING_FAIL = -102,
1040    HUKS_ERROR_CHECK_GET_PURPOSE_FAIL = -103,
1041    HUKS_ERROR_CHECK_GET_DIGEST_FAIL = -104,
1042    HUKS_ERROR_CHECK_GET_MODE_FAIL = -105,
1043    HUKS_ERROR_CHECK_GET_NONCE_FAIL = -106,
1044    HUKS_ERROR_CHECK_GET_AAD_FAIL = -107,
1045    HUKS_ERROR_CHECK_GET_IV_FAIL = -108,
1046    HUKS_ERROR_CHECK_GET_AE_TAG_FAIL = -109,
1047    HUKS_ERROR_CHECK_GET_SALT_FAIL = -110,
1048    HUKS_ERROR_CHECK_GET_ITERATION_FAIL = -111,
1049    HUKS_ERROR_INVALID_ALGORITHM = -112,
1050    HUKS_ERROR_INVALID_KEY_SIZE = -113,
1051    HUKS_ERROR_INVALID_PADDING = -114,
1052    HUKS_ERROR_INVALID_PURPOSE = -115,
1053    HUKS_ERROR_INVALID_MODE = -116,
1054    HUKS_ERROR_INVALID_DIGEST = -117,
1055    HUKS_ERROR_INVALID_SIGNATURE_SIZE = -118,
1056    HUKS_ERROR_INVALID_IV = -119,
1057    HUKS_ERROR_INVALID_AAD = -120,
1058    HUKS_ERROR_INVALID_NONCE = -121,
1059    HUKS_ERROR_INVALID_AE_TAG = -122,
1060    HUKS_ERROR_INVALID_SALT = -123,
1061    HUKS_ERROR_INVALID_ITERATION = -124,
1062    HUKS_ERROR_INVALID_OPERATION = -125,
1063
1064    HUKS_ERROR_INTERNAL_ERROR = -999,
1065    HUKS_ERROR_UNKNOWN_ERROR = -1000
1066  }
1067
1068  /**
1069   * Enum for huks exception error code.
1070   *
1071   * @enum { number }
1072   * @syscap SystemCapability.Security.Huks
1073   * @since 9
1074   */
1075  export enum HuksExceptionErrCode {
1076    HUKS_ERR_CODE_PERMISSION_FAIL = 201,
1077    HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401,
1078    HUKS_ERR_CODE_NOT_SUPPORTED_API = 801,
1079
1080    HUKS_ERR_CODE_FEATURE_NOT_SUPPORTED = 12000001,
1081    HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT = 12000002,
1082    HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT = 12000003,
1083    HUKS_ERR_CODE_FILE_OPERATION_FAIL = 12000004,
1084    HUKS_ERR_CODE_COMMUNICATION_FAIL = 12000005,
1085    HUKS_ERR_CODE_CRYPTO_FAIL = 12000006,
1086    HUKS_ERR_CODE_KEY_AUTH_PERMANENTLY_INVALIDATED = 12000007,
1087    HUKS_ERR_CODE_KEY_AUTH_VERIFY_FAILED = 12000008,
1088    HUKS_ERR_CODE_KEY_AUTH_TIME_OUT = 12000009,
1089    HUKS_ERR_CODE_SESSION_LIMIT = 12000010,
1090    HUKS_ERR_CODE_ITEM_NOT_EXIST = 12000011,
1091    HUKS_ERR_CODE_EXTERNAL_ERROR = 12000012,
1092    HUKS_ERR_CODE_CREDENTIAL_NOT_EXIST = 12000013,
1093    HUKS_ERR_CODE_INSUFFICIENT_MEMORY = 12000014,
1094    HUKS_ERR_CODE_CALL_SERVICE_FAILED = 12000015
1095  }
1096
1097  /**
1098   * Enum for huks key purpose.
1099   *
1100   * @enum { number }
1101   * @syscap SystemCapability.Security.Huks
1102   * @since 8
1103   */
1104  export enum HuksKeyPurpose {
1105    /* Usable with RSA, EC and AES keys. */
1106    HUKS_KEY_PURPOSE_ENCRYPT = 1,
1107    /* Usable with RSA, EC and AES keys. */
1108    HUKS_KEY_PURPOSE_DECRYPT = 2,
1109    /* Usable with RSA, EC keys. */
1110    HUKS_KEY_PURPOSE_SIGN = 4,
1111    /* Usable with RSA, EC keys. */
1112    HUKS_KEY_PURPOSE_VERIFY = 8,
1113    /* Usable with EC keys. */
1114    HUKS_KEY_PURPOSE_DERIVE = 16,
1115    /* Usable with wrap key. */
1116    HUKS_KEY_PURPOSE_WRAP = 32,
1117    /* Usable with unwrap key. */
1118    HUKS_KEY_PURPOSE_UNWRAP = 64,
1119    /* Usable with mac. */
1120    HUKS_KEY_PURPOSE_MAC = 128,
1121    /* Usable with agree. */
1122    HUKS_KEY_PURPOSE_AGREE = 256
1123  }
1124
1125  /**
1126   * Enum for huks key digest.
1127   *
1128   * @enum { number }
1129   * @syscap SystemCapability.Security.Huks
1130   * @since 8
1131   */
1132  export enum HuksKeyDigest {
1133    HUKS_DIGEST_NONE = 0,
1134    HUKS_DIGEST_MD5 = 1,
1135    /**
1136     * @syscap SystemCapability.Security.Huks
1137     * @since 9
1138     */
1139    HUKS_DIGEST_SM3 = 2,
1140    HUKS_DIGEST_SHA1 = 10,
1141    HUKS_DIGEST_SHA224 = 11,
1142    HUKS_DIGEST_SHA256 = 12,
1143    HUKS_DIGEST_SHA384 = 13,
1144    HUKS_DIGEST_SHA512 = 14
1145  }
1146
1147  /**
1148   * Enum for huks key padding.
1149   *
1150   * @enum { number }
1151   * @syscap SystemCapability.Security.Huks
1152   * @since 8
1153   */
1154  export enum HuksKeyPadding {
1155    HUKS_PADDING_NONE = 0,
1156    HUKS_PADDING_OAEP = 1,
1157    HUKS_PADDING_PSS = 2,
1158    HUKS_PADDING_PKCS1_V1_5 = 3,
1159    HUKS_PADDING_PKCS5 = 4,
1160    HUKS_PADDING_PKCS7 = 5
1161  }
1162
1163  /**
1164   * Enum for huks cipher mode.
1165   *
1166   * @enum { number }
1167   * @syscap SystemCapability.Security.Huks
1168   * @since 8
1169   */
1170  export enum HuksCipherMode {
1171    HUKS_MODE_ECB = 1,
1172    HUKS_MODE_CBC = 2,
1173    HUKS_MODE_CTR = 3,
1174    HUKS_MODE_OFB = 4,
1175    HUKS_MODE_CCM = 31,
1176    HUKS_MODE_GCM = 32
1177  }
1178
1179  /**
1180   * Enum for huks key size.
1181   *
1182   * @enum { number }
1183   * @syscap SystemCapability.Security.Huks
1184   * @since 8
1185   */
1186  export enum HuksKeySize {
1187    HUKS_RSA_KEY_SIZE_512 = 512,
1188    HUKS_RSA_KEY_SIZE_768 = 768,
1189    HUKS_RSA_KEY_SIZE_1024 = 1024,
1190    HUKS_RSA_KEY_SIZE_2048 = 2048,
1191    HUKS_RSA_KEY_SIZE_3072 = 3072,
1192    HUKS_RSA_KEY_SIZE_4096 = 4096,
1193
1194    HUKS_ECC_KEY_SIZE_224 = 224,
1195    HUKS_ECC_KEY_SIZE_256 = 256,
1196    HUKS_ECC_KEY_SIZE_384 = 384,
1197    HUKS_ECC_KEY_SIZE_521 = 521,
1198
1199    HUKS_AES_KEY_SIZE_128 = 128,
1200    HUKS_AES_KEY_SIZE_192 = 192,
1201    HUKS_AES_KEY_SIZE_256 = 256,
1202    HUKS_AES_KEY_SIZE_512 = 512,
1203
1204    HUKS_CURVE25519_KEY_SIZE_256 = 256,
1205
1206    HUKS_DH_KEY_SIZE_2048 = 2048,
1207    HUKS_DH_KEY_SIZE_3072 = 3072,
1208    HUKS_DH_KEY_SIZE_4096 = 4096,
1209
1210    /**
1211     * @syscap SystemCapability.Security.Huks
1212     * @since 9
1213     */
1214    HUKS_SM2_KEY_SIZE_256 = 256,
1215    /**
1216     * @syscap SystemCapability.Security.Huks
1217     * @since 9
1218     */
1219    HUKS_SM4_KEY_SIZE_128 = 128
1220  }
1221
1222  /**
1223   * Enum for huks key algorithm.
1224   *
1225   * @enum { number }
1226   * @syscap SystemCapability.Security.Huks
1227   * @since 8
1228   */
1229  export enum HuksKeyAlg {
1230    HUKS_ALG_RSA = 1,
1231    HUKS_ALG_ECC = 2,
1232    HUKS_ALG_DSA = 3,
1233
1234    HUKS_ALG_AES = 20,
1235    HUKS_ALG_HMAC = 50,
1236    HUKS_ALG_HKDF = 51,
1237    HUKS_ALG_PBKDF2 = 52,
1238
1239    HUKS_ALG_ECDH = 100,
1240    HUKS_ALG_X25519 = 101,
1241    HUKS_ALG_ED25519 = 102,
1242    HUKS_ALG_DH = 103,
1243
1244    /**
1245     * @syscap SystemCapability.Security.Huks
1246     * @since 9
1247     */
1248    HUKS_ALG_SM2 = 150,
1249    /**
1250     * @syscap SystemCapability.Security.Huks
1251     * @since 9
1252     */
1253    HUKS_ALG_SM3 = 151,
1254    /**
1255     * @syscap SystemCapability.Security.Huks
1256     * @since 9
1257     */
1258    HUKS_ALG_SM4 = 152
1259  }
1260
1261  /**
1262   * Enum for huks unwrap suite.
1263   *
1264   * @enum { number }
1265   * @syscap SystemCapability.Security.Huks
1266   * @since 9
1267   */
1268  export enum HuksUnwrapSuite {
1269    HUKS_UNWRAP_SUITE_X25519_AES_256_GCM_NOPADDING = 1,
1270    HUKS_UNWRAP_SUITE_ECDH_AES_256_GCM_NOPADDING = 2
1271  }
1272
1273  /**
1274   * Enum for huks key generate type.
1275   *
1276   * @enum { number }
1277   * @syscap SystemCapability.Security.Huks
1278   * @since 8
1279   */
1280  export enum HuksKeyGenerateType {
1281    HUKS_KEY_GENERATE_TYPE_DEFAULT = 0,
1282    HUKS_KEY_GENERATE_TYPE_DERIVE = 1,
1283    HUKS_KEY_GENERATE_TYPE_AGREE = 2
1284  }
1285
1286  /**
1287   * Enum for huks key flag.
1288   *
1289   * @enum { number }
1290   * @syscap SystemCapability.Security.Huks
1291   * @since 8
1292   */
1293  export enum HuksKeyFlag {
1294    HUKS_KEY_FLAG_IMPORT_KEY = 1,
1295    HUKS_KEY_FLAG_GENERATE_KEY = 2,
1296    HUKS_KEY_FLAG_AGREE_KEY = 3,
1297    HUKS_KEY_FLAG_DERIVE_KEY = 4
1298  }
1299
1300  /**
1301   * Enum for huks key storage type.
1302   *
1303   * @enum { number }
1304   * @syscap SystemCapability.Security.Huks
1305   * @since 8
1306   */
1307  export enum HuksKeyStorageType {
1308    HUKS_STORAGE_TEMP = 0,
1309    HUKS_STORAGE_PERSISTENT = 1
1310  }
1311
1312  /**
1313   * Enum for huks import key type.
1314   *
1315   * @enum { number }
1316   * @syscap SystemCapability.Security.Huks
1317   * @since 9
1318   */
1319  export enum HuksImportKeyType {
1320    HUKS_KEY_TYPE_PUBLIC_KEY = 0,
1321    HUKS_KEY_TYPE_PRIVATE_KEY = 1,
1322    HUKS_KEY_TYPE_KEY_PAIR = 2
1323  }
1324
1325  /**
1326   * Enum for huks user auth type.
1327   *
1328   * @enum { number }
1329   * @syscap SystemCapability.Security.Huks
1330   * @since 9
1331   */
1332  export enum HuksUserAuthType {
1333    HUKS_USER_AUTH_TYPE_FINGERPRINT = 1 << 0,
1334    HUKS_USER_AUTH_TYPE_FACE = 1 << 1,
1335    HUKS_USER_AUTH_TYPE_PIN = 1 << 2
1336  }
1337
1338  /**
1339   * Enum for huks auth access type.
1340   *
1341   * @enum { number }
1342   * @syscap SystemCapability.Security.Huks
1343   * @since 9
1344   */
1345  export enum HuksAuthAccessType {
1346    HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD = 1 << 0,
1347    HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL = 1 << 1
1348  }
1349
1350  /**
1351   * Enum for huks auth access challenge type.
1352   *
1353   * @enum { number }
1354   * @syscap SystemCapability.Security.Huks
1355   * @since 9
1356   */
1357  export enum HuksChallengeType {
1358    HUKS_CHALLENGE_TYPE_NORMAL = 0,
1359    HUKS_CHALLENGE_TYPE_CUSTOM = 1,
1360    HUKS_CHALLENGE_TYPE_NONE = 2
1361  }
1362
1363  /**
1364   * Enum for huks challenge position.
1365   *
1366   * @enum { number }
1367   * @syscap SystemCapability.Security.Huks
1368   * @since 9
1369   */
1370  export enum HuksChallengePosition {
1371    HUKS_CHALLENGE_POS_0 = 0,
1372    HUKS_CHALLENGE_POS_1,
1373    HUKS_CHALLENGE_POS_2,
1374    HUKS_CHALLENGE_POS_3
1375  }
1376
1377  /**
1378   * Enum for huks secure sign type.
1379   *
1380   * @enum { number }
1381   * @syscap SystemCapability.Security.Huks
1382   * @since 9
1383   */
1384  export enum HuksSecureSignType {
1385    HUKS_SECURE_SIGN_WITH_AUTHINFO = 1
1386  }
1387
1388  /**
1389   * Enum for huks ipc send type.
1390   *
1391   * @enum { number }
1392   * @syscap SystemCapability.Security.Huks
1393   * @since 8
1394   */
1395  export enum HuksSendType {
1396    HUKS_SEND_TYPE_ASYNC = 0,
1397    HUKS_SEND_TYPE_SYNC = 1
1398  }
1399
1400  /**
1401   * Enum for huks base tag type.
1402   *
1403   * @enum { number }
1404   * @syscap SystemCapability.Security.Huks
1405   * @since 8
1406   */
1407  export enum HuksTagType {
1408    HUKS_TAG_TYPE_INVALID = 0 << 28,
1409    HUKS_TAG_TYPE_INT = 1 << 28,
1410    HUKS_TAG_TYPE_UINT = 2 << 28,
1411    HUKS_TAG_TYPE_ULONG = 3 << 28,
1412    HUKS_TAG_TYPE_BOOL = 4 << 28,
1413    HUKS_TAG_TYPE_BYTES = 5 << 28
1414  }
1415
1416  /**
1417   * Enum for huks tag.
1418   *
1419   * @enum { number }
1420   * @syscap SystemCapability.Security.Huks
1421   * @since 8
1422   */
1423  export enum HuksTag {
1424    /**
1425     * Invalid TAG
1426     *
1427     * @syscap SystemCapability.Security.Huks
1428     * @since 8
1429     * @deprecated since 9
1430     */
1431    HUKS_TAG_INVALID = HuksTagType.HUKS_TAG_TYPE_INVALID | 0,
1432
1433    /* Base algrithom TAG: 1 - 200 */
1434    HUKS_TAG_ALGORITHM = HuksTagType.HUKS_TAG_TYPE_UINT | 1,
1435    HUKS_TAG_PURPOSE = HuksTagType.HUKS_TAG_TYPE_UINT | 2,
1436    HUKS_TAG_KEY_SIZE = HuksTagType.HUKS_TAG_TYPE_UINT | 3,
1437    HUKS_TAG_DIGEST = HuksTagType.HUKS_TAG_TYPE_UINT | 4,
1438    HUKS_TAG_PADDING = HuksTagType.HUKS_TAG_TYPE_UINT | 5,
1439    HUKS_TAG_BLOCK_MODE = HuksTagType.HUKS_TAG_TYPE_UINT | 6,
1440    HUKS_TAG_KEY_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 7,
1441    HUKS_TAG_ASSOCIATED_DATA = HuksTagType.HUKS_TAG_TYPE_BYTES | 8,
1442    HUKS_TAG_NONCE = HuksTagType.HUKS_TAG_TYPE_BYTES | 9,
1443    HUKS_TAG_IV = HuksTagType.HUKS_TAG_TYPE_BYTES | 10,
1444
1445    /* Key derivation TAG */
1446    HUKS_TAG_INFO = HuksTagType.HUKS_TAG_TYPE_BYTES | 11,
1447    HUKS_TAG_SALT = HuksTagType.HUKS_TAG_TYPE_BYTES | 12,
1448    /**
1449     * @syscap SystemCapability.Security.Huks
1450     * @since 8
1451     * @deprecated since 9
1452     */
1453    HUKS_TAG_PWD = HuksTagType.HUKS_TAG_TYPE_BYTES | 13,
1454    HUKS_TAG_ITERATION = HuksTagType.HUKS_TAG_TYPE_UINT | 14,
1455
1456    /* choose from enum HuksKeyGenerateType */
1457    HUKS_TAG_KEY_GENERATE_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 15,
1458
1459    /**
1460     * @syscap SystemCapability.Security.Huks
1461     * @since 8
1462     * @deprecated since 9
1463     */
1464    HUKS_TAG_DERIVE_MAIN_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES | 16,
1465    /**
1466     * @syscap SystemCapability.Security.Huks
1467     * @since 8
1468     * @deprecated since 9
1469     */
1470    HUKS_TAG_DERIVE_FACTOR = HuksTagType.HUKS_TAG_TYPE_BYTES | 17,
1471    /**
1472     * @syscap SystemCapability.Security.Huks
1473     * @since 8
1474     * @deprecated since 9
1475     */
1476    HUKS_TAG_DERIVE_ALG = HuksTagType.HUKS_TAG_TYPE_UINT | 18,
1477    HUKS_TAG_AGREE_ALG = HuksTagType.HUKS_TAG_TYPE_UINT | 19,
1478    HUKS_TAG_AGREE_PUBLIC_KEY_IS_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL | 20,
1479    HUKS_TAG_AGREE_PRIVATE_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BYTES | 21,
1480    HUKS_TAG_AGREE_PUBLIC_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES | 22,
1481    HUKS_TAG_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BYTES | 23,
1482    HUKS_TAG_DERIVE_KEY_SIZE = HuksTagType.HUKS_TAG_TYPE_UINT | 24,
1483
1484    /**
1485     * Choose from enum HuksImportKeyType
1486     *
1487     * @syscap SystemCapability.Security.Huks
1488     * @since 9
1489     */
1490    HUKS_TAG_IMPORT_KEY_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 25,
1491
1492    /**
1493     * @syscap SystemCapability.Security.Huks
1494     * @since 9
1495     */
1496    HUKS_TAG_UNWRAP_ALGORITHM_SUITE = HuksTagType.HUKS_TAG_TYPE_UINT | 26,
1497
1498    /*
1499     * Key authentication related TAG: 201 - 300
1500     *
1501     * Start of validity
1502     */
1503    /**
1504     * @syscap SystemCapability.Security.Huks
1505     * @since 8
1506     * @deprecated since 9
1507     */
1508    HUKS_TAG_ACTIVE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG | 201,
1509    /**
1510     * Date when new "messages" should not be created.
1511     *
1512     * @syscap SystemCapability.Security.Huks
1513     * @since 8
1514     * @deprecated since 9
1515     */
1516    HUKS_TAG_ORIGINATION_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG | 202,
1517    /**
1518     * Date when existing "messages" should not be used.
1519     *
1520     * @syscap SystemCapability.Security.Huks
1521     * @since 8
1522     * @deprecated since 9
1523     */
1524    HUKS_TAG_USAGE_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG | 203,
1525    /**
1526     * Key creation time.
1527     *
1528     * @syscap SystemCapability.Security.Huks
1529     * @since 8
1530     * @deprecated since 9
1531     */
1532    HUKS_TAG_CREATION_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG | 204,
1533
1534    /* Other authentication related TAG: 301 - 500 */
1535    HUKS_TAG_ALL_USERS = HuksTagType.HUKS_TAG_TYPE_BOOL | 301,
1536    HUKS_TAG_USER_ID = HuksTagType.HUKS_TAG_TYPE_UINT | 302,
1537    HUKS_TAG_NO_AUTH_REQUIRED = HuksTagType.HUKS_TAG_TYPE_BOOL | 303,
1538    HUKS_TAG_USER_AUTH_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 304,
1539    HUKS_TAG_AUTH_TIMEOUT = HuksTagType.HUKS_TAG_TYPE_UINT | 305,
1540    HUKS_TAG_AUTH_TOKEN = HuksTagType.HUKS_TAG_TYPE_BYTES | 306,
1541
1542    /* Key secure access control and user auth TAG */
1543    /**
1544     * @syscap SystemCapability.Security.Huks
1545     * @since 9
1546     */
1547    HUKS_TAG_KEY_AUTH_ACCESS_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 307,
1548
1549    /**
1550     * @syscap SystemCapability.Security.Huks
1551     * @since 9
1552     */
1553    HUKS_TAG_KEY_SECURE_SIGN_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 308,
1554
1555    /**
1556     * @syscap SystemCapability.Security.Huks
1557     * @since 9
1558     */
1559    HUKS_TAG_CHALLENGE_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 309,
1560
1561    /**
1562     * @syscap SystemCapability.Security.Huks
1563     * @since 9
1564     */
1565    HUKS_TAG_CHALLENGE_POS = HuksTagType.HUKS_TAG_TYPE_UINT | 310,
1566
1567    /* Attestation related TAG: 501 - 600 */
1568    HUKS_TAG_ATTESTATION_CHALLENGE = HuksTagType.HUKS_TAG_TYPE_BYTES | 501,
1569    HUKS_TAG_ATTESTATION_APPLICATION_ID = HuksTagType.HUKS_TAG_TYPE_BYTES | 502,
1570    /**
1571     * @syscap SystemCapability.Security.Huks
1572     * @since 8
1573     * @deprecated since 9
1574     */
1575    HUKS_TAG_ATTESTATION_ID_BRAND = HuksTagType.HUKS_TAG_TYPE_BYTES | 503,
1576    /**
1577     * @syscap SystemCapability.Security.Huks
1578     * @since 8
1579     * @deprecated since 9
1580     */
1581    HUKS_TAG_ATTESTATION_ID_DEVICE = HuksTagType.HUKS_TAG_TYPE_BYTES | 504,
1582    /**
1583     * @syscap SystemCapability.Security.Huks
1584     * @since 8
1585     * @deprecated since 9
1586     */
1587    HUKS_TAG_ATTESTATION_ID_PRODUCT = HuksTagType.HUKS_TAG_TYPE_BYTES | 505,
1588    /**
1589     * @syscap SystemCapability.Security.Huks
1590     * @since 8
1591     * @deprecated since 9
1592     */
1593    HUKS_TAG_ATTESTATION_ID_SERIAL = HuksTagType.HUKS_TAG_TYPE_BYTES | 506,
1594    /**
1595     * @syscap SystemCapability.Security.Huks
1596     * @since 8
1597     * @deprecated since 9
1598     */
1599    HUKS_TAG_ATTESTATION_ID_IMEI = HuksTagType.HUKS_TAG_TYPE_BYTES | 507,
1600    /**
1601     * @syscap SystemCapability.Security.Huks
1602     * @since 8
1603     * @deprecated since 9
1604     */
1605    HUKS_TAG_ATTESTATION_ID_MEID = HuksTagType.HUKS_TAG_TYPE_BYTES | 508,
1606    /**
1607     * @syscap SystemCapability.Security.Huks
1608     * @since 8
1609     * @deprecated since 9
1610     */
1611    HUKS_TAG_ATTESTATION_ID_MANUFACTURER = HuksTagType.HUKS_TAG_TYPE_BYTES | 509,
1612    /**
1613     * @syscap SystemCapability.Security.Huks
1614     * @since 8
1615     * @deprecated since 9
1616     */
1617    HUKS_TAG_ATTESTATION_ID_MODEL = HuksTagType.HUKS_TAG_TYPE_BYTES | 510,
1618    HUKS_TAG_ATTESTATION_ID_ALIAS = HuksTagType.HUKS_TAG_TYPE_BYTES | 511,
1619    /**
1620     * @syscap SystemCapability.Security.Huks
1621     * @since 8
1622     * @deprecated since 9
1623     */
1624    HUKS_TAG_ATTESTATION_ID_SOCID = HuksTagType.HUKS_TAG_TYPE_BYTES | 512,
1625    /**
1626     * @syscap SystemCapability.Security.Huks
1627     * @since 8
1628     * @deprecated since 9
1629     */
1630    HUKS_TAG_ATTESTATION_ID_UDID = HuksTagType.HUKS_TAG_TYPE_BYTES | 513,
1631    HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO = HuksTagType.HUKS_TAG_TYPE_BYTES | 514,
1632    HUKS_TAG_ATTESTATION_ID_VERSION_INFO = HuksTagType.HUKS_TAG_TYPE_BYTES | 515,
1633
1634    /*
1635     * Other reserved TAG: 601 - 1000
1636     *
1637     * Extention TAG: 1001 - 9999
1638     */
1639    HUKS_TAG_IS_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL | 1001,
1640    /* choose from enum HuksKeyStorageType */
1641    HUKS_TAG_KEY_STORAGE_FLAG = HuksTagType.HUKS_TAG_TYPE_UINT | 1002,
1642    HUKS_TAG_IS_ALLOWED_WRAP = HuksTagType.HUKS_TAG_TYPE_BOOL | 1003,
1643    HUKS_TAG_KEY_WRAP_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 1004,
1644    HUKS_TAG_KEY_AUTH_ID = HuksTagType.HUKS_TAG_TYPE_BYTES | 1005,
1645    HUKS_TAG_KEY_ROLE = HuksTagType.HUKS_TAG_TYPE_UINT | 1006,
1646    /* choose from enum HuksKeyFlag */
1647    HUKS_TAG_KEY_FLAG = HuksTagType.HUKS_TAG_TYPE_UINT | 1007,
1648    HUKS_TAG_IS_ASYNCHRONIZED = HuksTagType.HUKS_TAG_TYPE_UINT | 1008,
1649    /**
1650     * @syscap SystemCapability.Security.Huks
1651     * @since 8
1652     * @deprecated since 9
1653     */
1654    HUKS_TAG_SECURE_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL | 1009,
1655    /**
1656     * @syscap SystemCapability.Security.Huks
1657     * @since 8
1658     * @deprecated since 9
1659     */
1660    HUKS_TAG_SECURE_KEY_UUID = HuksTagType.HUKS_TAG_TYPE_BYTES | 1010,
1661    HUKS_TAG_KEY_DOMAIN = HuksTagType.HUKS_TAG_TYPE_UINT | 1011,
1662
1663    /* Inner-use TAG: 10001 - 10999 */
1664    /**
1665     * @syscap SystemCapability.Security.Huks
1666     * @since 8
1667     * @deprecated since 9
1668     */
1669    HUKS_TAG_PROCESS_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES | 10001,
1670    /**
1671     * @syscap SystemCapability.Security.Huks
1672     * @since 8
1673     * @deprecated since 9
1674     */
1675    HUKS_TAG_PACKAGE_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES | 10002,
1676    /**
1677     * @syscap SystemCapability.Security.Huks
1678     * @since 8
1679     * @deprecated since 9
1680     */
1681    HUKS_TAG_ACCESS_TIME = HuksTagType.HUKS_TAG_TYPE_UINT | 10003,
1682    /**
1683     * @syscap SystemCapability.Security.Huks
1684     * @since 8
1685     * @deprecated since 9
1686     */
1687    HUKS_TAG_USES_TIME = HuksTagType.HUKS_TAG_TYPE_UINT | 10004,
1688    /**
1689     * @syscap SystemCapability.Security.Huks
1690     * @since 8
1691     * @deprecated since 9
1692     */
1693    HUKS_TAG_CRYPTO_CTX = HuksTagType.HUKS_TAG_TYPE_ULONG | 10005,
1694    HUKS_TAG_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES | 10006,
1695    /**
1696     * @syscap SystemCapability.Security.Huks
1697     * @since 8
1698     * @deprecated since 9
1699     */
1700    HUKS_TAG_KEY_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT | 10007,
1701    /**
1702     * @syscap SystemCapability.Security.Huks
1703     * @since 8
1704     * @deprecated since 9
1705     */
1706    HUKS_TAG_PAYLOAD_LEN = HuksTagType.HUKS_TAG_TYPE_UINT | 10008,
1707    HUKS_TAG_AE_TAG = HuksTagType.HUKS_TAG_TYPE_BYTES | 10009,
1708    /**
1709     * @syscap SystemCapability.Security.Huks
1710     * @since 8
1711     * @deprecated since 9
1712     */
1713    HUKS_TAG_IS_KEY_HANDLE = HuksTagType.HUKS_TAG_TYPE_ULONG | 10010,
1714
1715    /* Os version related TAG */
1716    /**
1717     * @syscap SystemCapability.Security.Huks
1718     * @since 8
1719     * @deprecated since 9
1720     */
1721    HUKS_TAG_OS_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT | 10101,
1722    /**
1723     * @syscap SystemCapability.Security.Huks
1724     * @since 8
1725     * @deprecated since 9
1726     */
1727    HUKS_TAG_OS_PATCHLEVEL = HuksTagType.HUKS_TAG_TYPE_UINT | 10102,
1728
1729    /*
1730     * Reversed TAGs for SOTER: 11000 - 12000
1731     *
1732     * Other TAGs: 20001 - N
1733     * TAGs used for paramSetOut
1734     */
1735    HUKS_TAG_SYMMETRIC_KEY_DATA = HuksTagType.HUKS_TAG_TYPE_BYTES | 20001,
1736    HUKS_TAG_ASYMMETRIC_PUBLIC_KEY_DATA = HuksTagType.HUKS_TAG_TYPE_BYTES | 20002,
1737    HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA = HuksTagType.HUKS_TAG_TYPE_BYTES | 20003
1738  }
1739}
1740
1741export default huks;
1742