• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit DeviceCertificateKit
19 */
20
21import type { AsyncCallback } from './@ohos.base';
22
23/**
24 * OpenHarmony Universal CertificateManager
25 *
26 * @namespace certificateManager
27 * @syscap SystemCapability.Security.CertificateManager
28 * @since 11
29 */
30declare namespace certificateManager {
31  /**
32   * Enum for result code
33   *
34   * @enum { number }
35   * @syscap SystemCapability.Security.CertificateManager
36   * @since 11
37   */
38  export enum CMErrorCode {
39    /**
40     * Indicates that the application has no permission to call the API.
41     *
42     * @syscap SystemCapability.Security.CertificateManager
43     * @since 11
44     */
45    CM_ERROR_NO_PERMISSION = 201,
46
47    /**
48     * Indicates that the application is not a system application.
49     *
50     * @syscap SystemCapability.Security.CertificateManager
51     * @systemapi
52     * @since 11
53     */
54    CM_ERROR_NOT_SYSTEM_APP = 202,
55
56    /**
57     * Indicates that the input parameters is invalid.
58     *
59     * @syscap SystemCapability.Security.CertificateManager
60     * @since 11
61     */
62    CM_ERROR_INVALID_PARAMS = 401,
63
64    /**
65     * Indicates that there is an internal error occurred when calling the API.
66     *
67     * @syscap SystemCapability.Security.CertificateManager
68     * @since 11
69     */
70    CM_ERROR_GENERIC = 17500001,
71
72    /**
73     * Indicates that the certificate do not exist.
74     *
75     * @syscap SystemCapability.Security.CertificateManager
76     * @since 11
77     */
78    CM_ERROR_NO_FOUND = 17500002,
79
80    /**
81     * Indicates that the input is not valid certificate or credential.
82     *
83     * @syscap SystemCapability.Security.CertificateManager
84     * @since 11
85     */
86    CM_ERROR_INCORRECT_FORMAT = 17500003
87  }
88
89  /**
90   * Provides the CertInfo type.
91   *
92   * @typedef CertInfo
93   * @syscap SystemCapability.Security.CertificateManager
94   * @since 11
95   */
96  export interface CertInfo {
97    /**
98     * Indicates the uri of certificate.
99     *
100     * @type { string }
101     * @syscap SystemCapability.Security.CertificateManager
102     * @since 11
103     */
104    uri: string;
105
106    /**
107     * Indicates the alias of certificate.
108     *
109     * @type { string }
110     * @syscap SystemCapability.Security.CertificateManager
111     * @since 11
112     */
113    certAlias: string;
114
115    /**
116     * Indicates the state of certificate.
117     *
118     * @type { boolean }
119     * @syscap SystemCapability.Security.CertificateManager
120     * @since 11
121     */
122    state: boolean;
123
124    /**
125     * Indicates the issuer name of certificate.
126     *
127     * @type { string }
128     * @syscap SystemCapability.Security.CertificateManager
129     * @since 11
130     */
131    issuerName: string;
132
133    /**
134     * Indicates the subject name of certificate.
135     *
136     * @type { string }
137     * @syscap SystemCapability.Security.CertificateManager
138     * @since 11
139     */
140    subjectName: string;
141
142    /**
143     * Indicates the serial number of certificate.
144     *
145     * @type { string }
146     * @syscap SystemCapability.Security.CertificateManager
147     * @since 11
148     */
149    serial: string;
150
151    /**
152     * Indicates the not before time of certificate.
153     *
154     * @type { string }
155     * @syscap SystemCapability.Security.CertificateManager
156     * @since 11
157     */
158    notBefore: string;
159
160    /**
161     * Indicates the not after time of certificate.
162     *
163     * @type { string }
164     * @syscap SystemCapability.Security.CertificateManager
165     * @since 11
166     */
167    notAfter: string;
168
169    /**
170     * Indicates the fingerprint of certificate.
171     *
172     * @type { string }
173     * @syscap SystemCapability.Security.CertificateManager
174     * @since 11
175     */
176    fingerprintSha256: string;
177
178    /**
179     * Indicates the certificate binary data.
180     *
181     * @type { Uint8Array }
182     * @syscap SystemCapability.Security.CertificateManager
183     * @since 11
184     */
185    cert: Uint8Array;
186  }
187
188  /**
189   * Provides the abstract Cert type.
190   *
191   * @typedef CertAbstract
192   * @syscap SystemCapability.Security.CertificateManager
193   * @since 11
194   */
195  export interface CertAbstract {
196    /**
197     * Indicates the uri of certificate.
198     *
199     * @type { string }
200     * @syscap SystemCapability.Security.CertificateManager
201     * @since 11
202     */
203    uri: string;
204
205    /**
206     * Indicates the alias of certificate.
207     *
208     * @type { string }
209     * @syscap SystemCapability.Security.CertificateManager
210     * @since 11
211     */
212    certAlias: string;
213
214    /**
215     * Indicates the state of certificate.
216     *
217     * @type { boolean }
218     * @syscap SystemCapability.Security.CertificateManager
219     * @since 11
220     */
221    state: boolean;
222
223    /**
224     * Indicates the subject name of certificate.
225     *
226     * @type { string }
227     * @syscap SystemCapability.Security.CertificateManager
228     * @since 11
229     */
230    subjectName: string;
231  }
232
233  /**
234   * Provides the Credential type.
235   *
236   * @typedef Credential
237   * @syscap SystemCapability.Security.CertificateManager
238   * @since 11
239   */
240  export interface Credential {
241    /**
242     * Indicates the type of Credential.
243     *
244     * @type { string }
245     * @syscap SystemCapability.Security.CertificateManager
246     * @since 11
247     */
248    type: string;
249
250    /**
251     * Indicates the alias of Credential.
252     *
253     * @type { string }
254     * @syscap SystemCapability.Security.CertificateManager
255     * @since 11
256     */
257    alias: string;
258
259    /**
260     * Indicates the uri of Credential.
261     *
262     * @type { string }
263     * @syscap SystemCapability.Security.CertificateManager
264     * @since 11
265     */
266    keyUri: string;
267
268    /**
269     * Indicates the number of certificates included in the credential.
270     *
271     * @type { number }
272     * @syscap SystemCapability.Security.CertificateManager
273     * @since 11
274     */
275    certNum: number;
276
277    /**
278     * Indicates the number of key included in the credential.
279     *
280     * @type { number }
281     * @syscap SystemCapability.Security.CertificateManager
282     * @since 11
283     */
284    keyNum: number;
285
286    /**
287     * Indicates the credential binary data.
288     *
289     * @type { Uint8Array }
290     * @syscap SystemCapability.Security.CertificateManager
291     * @since 11
292     */
293    credentialData: Uint8Array;
294  }
295
296  /**
297   * Provides the abstract Credential type.
298   *
299   * @typedef CredentialAbstract
300   * @syscap SystemCapability.Security.CertificateManager
301   * @since 11
302   */
303  export interface CredentialAbstract {
304    /**
305     * Indicates the type of Credential.
306     *
307     * @type { string }
308     * @syscap SystemCapability.Security.CertificateManager
309     * @since 11
310     */
311    type: string;
312
313    /**
314     * Indicates the alias of Credential.
315     *
316     * @type { string }
317     * @syscap SystemCapability.Security.CertificateManager
318     * @since 11
319     */
320    alias: string;
321
322    /**
323     * Indicates the uri of Credential.
324     *
325     * @type { string }
326     * @syscap SystemCapability.Security.CertificateManager
327     * @since 11
328     */
329    keyUri: string;
330  }
331
332  /**
333   * Provides the CMResult type.
334   *
335   * @typedef CMResult
336   * @syscap SystemCapability.Security.CertificateManager
337   * @since 11
338   */
339  export interface CMResult {
340    /**
341     * Indicates the certificate list of CMResult.
342     *
343     * @type { ?Array<CertAbstract> }
344     * @syscap SystemCapability.Security.CertificateManager
345     * @since 11
346     */
347    certList?: Array<CertAbstract>;
348
349    /**
350     * Indicates the certificate info of CMResult.
351     *
352     * @type { ?CertInfo }
353     * @syscap SystemCapability.Security.CertificateManager
354     * @since 11
355     */
356    certInfo?: CertInfo;
357
358    /**
359     * Indicates the credential list of CMResult.
360     *
361     * @type { ?Array<CredentialAbstract> }
362     * @syscap SystemCapability.Security.CertificateManager
363     * @since 11
364     */
365    credentialList?: Array<CredentialAbstract>;
366
367    /**
368     * Indicates the credential of CMResult.
369     *
370     * @type { ?Credential }
371     * @syscap SystemCapability.Security.CertificateManager
372     * @since 11
373     */
374    credential?: Credential;
375
376    /**
377     * Indicates the app uid list of CMResult.
378     *
379     * @type { ?Array<string> }
380     * @syscap SystemCapability.Security.CertificateManager
381     * @since 11
382     */
383    appUidList?: Array<string>;
384
385    /**
386     * Indicates the certificate uri of CMResult.
387     *
388     * @type { ?string }
389     * @syscap SystemCapability.Security.CertificateManager
390     * @since 11
391     */
392    uri?: string;
393
394    /**
395     * Indicates the outData of CMResult.
396     *
397     * @type { ?Uint8Array }
398     * @syscap SystemCapability.Security.CertificateManager
399     * @since 11
400     */
401    outData?: Uint8Array;
402  }
403
404  /**
405   * Enum for Key Purpose
406   *
407   * @enum { number }
408   * @syscap SystemCapability.Security.CertificateManager
409   * @since 11
410   */
411  export enum CmKeyPurpose {
412    /**
413     * Indicates that key for signature.
414     *
415     * @syscap SystemCapability.Security.CertificateManager
416     * @since 11
417     */
418    CM_KEY_PURPOSE_SIGN = 4,
419
420    /**
421     * Indicates that key for verify.
422     *
423     * @syscap SystemCapability.Security.CertificateManager
424     * @since 11
425     */
426    CM_KEY_PURPOSE_VERIFY = 8
427  }
428
429  /**
430   * Enum for Key Digest
431   *
432   * @enum { number }
433   * @syscap SystemCapability.Security.CertificateManager
434   * @since 11
435   */
436  export enum CmKeyDigest {
437    /**
438     * Indicates that key digest is none.
439     *
440     * @syscap SystemCapability.Security.CertificateManager
441     * @since 11
442     */
443    CM_DIGEST_NONE = 0,
444
445    /**
446     * Indicates that key digest is md5.
447     *
448     * @syscap SystemCapability.Security.CertificateManager
449     * @since 11
450     */
451    CM_DIGEST_MD5 = 1,
452
453    /**
454     * Indicates that key digest is sha1.
455     *
456     * @syscap SystemCapability.Security.CertificateManager
457     * @since 11
458     */
459    CM_DIGEST_SHA1 = 2,
460
461    /**
462     * Indicates that key digest is sha224.
463     *
464     * @syscap SystemCapability.Security.CertificateManager
465     * @since 11
466     */
467    CM_DIGEST_SHA224 = 3,
468
469    /**
470     * Indicates that key digest is sha256.
471     *
472     * @syscap SystemCapability.Security.CertificateManager
473     * @since 11
474     */
475    CM_DIGEST_SHA256 = 4,
476
477    /**
478     * Indicates that key digest is sha384.
479     *
480     * @syscap SystemCapability.Security.CertificateManager
481     * @since 11
482     */
483    CM_DIGEST_SHA384 = 5,
484
485    /**
486     * Indicates that key digest is sha512.
487     *
488     * @syscap SystemCapability.Security.CertificateManager
489     * @since 11
490     */
491    CM_DIGEST_SHA512 = 6
492  }
493
494  /**
495   * Enum for Key Padding
496   *
497   * @enum { number }
498   * @syscap SystemCapability.Security.CertificateManager
499   * @since 11
500   */
501  export enum CmKeyPadding {
502    /**
503     * Indicates that key padding is none.
504     *
505     * @syscap SystemCapability.Security.CertificateManager
506     * @since 11
507     */
508    CM_PADDING_NONE = 0,
509
510    /**
511     * Indicates that key padding is PSS.
512     *
513     * @syscap SystemCapability.Security.CertificateManager
514     * @since 11
515     */
516    CM_PADDING_PSS = 1,
517
518    /**
519     * Indicates that key padding is PKCS1_V1_5.
520     *
521     * @syscap SystemCapability.Security.CertificateManager
522     * @since 11
523     */
524    CM_PADDING_PKCS1_V1_5 = 2
525  }
526
527  /**
528   * Provides the CMSignatureSpec type.
529   *
530   * @typedef CMSignatureSpec
531   * @syscap SystemCapability.Security.CertificateManager
532   * @since 11
533   */
534  export interface CMSignatureSpec {
535    /**
536     * Indicates the key purpose of CMSignatureSpec.
537     *
538     * @type { CmKeyPurpose }
539     * @syscap SystemCapability.Security.CertificateManager
540     * @since 11
541     */
542    purpose: CmKeyPurpose;
543
544    /**
545     * Indicates the key padding of CMSignatureSpec.
546     *
547     * @type { ?CmKeyPadding }
548     * @syscap SystemCapability.Security.CertificateManager
549     * @since 11
550     */
551    padding?: CmKeyPadding;
552
553    /**
554     * Indicates the key digest of CMSignatureSpec.
555     *
556     * @type { ?CmKeyDigest }
557     * @syscap SystemCapability.Security.CertificateManager
558     * @since 11
559     */
560    digest?: CmKeyDigest;
561  }
562
563  /**
564   * Provides the CMHandle type.
565   *
566   * @typedef CMHandle
567   * @syscap SystemCapability.Security.CertificateManager
568   * @since 11
569   */
570  export interface CMHandle {
571    /**
572     * Indicates the handle .
573     *
574     * @type { Uint8Array }
575     * @syscap SystemCapability.Security.CertificateManager
576     * @since 11
577     */
578    handle: Uint8Array;
579  }
580
581  /**
582   * Install private application certificate.
583   *
584   * @permission ohos.permission.ACCESS_CERT_MANAGER
585   * @param { Uint8Array } keystore - Indicates the keystore file with key pair and certificate.
586   * @param { string } keystorePwd - Indicates the password of keystore file.
587   * @param { string } certAlias - Indicates the certificate name inputted by the user.
588   * @param { AsyncCallback<CMResult> } callback - the callback of installPrivateCertificate.
589   * @throws { BusinessError } 201 - the application has no permission to call the API.
590   * @throws { BusinessError } 401 - the parameter check failed.
591   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
592   * @throws { BusinessError } 17500003 - the keystore is not valid format or keystorePwd is not correct.
593   * @syscap SystemCapability.Security.CertificateManager
594   * @since 11
595   */
596  function installPrivateCertificate(
597    keystore: Uint8Array,
598    keystorePwd: string,
599    certAlias: string,
600    callback: AsyncCallback<CMResult>
601  ): void;
602
603  /**
604   * Install private application certificate.
605   *
606   * @permission ohos.permission.ACCESS_CERT_MANAGER
607   * @param { Uint8Array } keystore - Indicates the keystore file with key pair and certificate.
608   * @param { string } keystorePwd - Indicates the password of keystore file.
609   * @param { string } certAlias - Indicates the certificate name inputted by the user.
610   * @returns { Promise<CMResult> } the promise returned by the function.
611   * @throws { BusinessError } 201 - the application has no permission to call the API.
612   * @throws { BusinessError } 401 - the parameter check failed.
613   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
614   * @throws { BusinessError } 17500003 - the keystore is not valid format or keystorePwd is not correct.
615   * @syscap SystemCapability.Security.CertificateManager
616   * @since 11
617   */
618  function installPrivateCertificate(keystore: Uint8Array, keystorePwd: string, certAlias: string): Promise<CMResult>;
619
620  /**
621   * Uninstall the specified normal application certificate.
622   *
623   * @permission ohos.permission.ACCESS_CERT_MANAGER
624   * @param { string } keyUri - Indicates key's name.
625   * @param { AsyncCallback<void> } callback - the callback of uninstallPrivateCertificate.
626   * @throws { BusinessError } 201 - the application has no permission to call the API.
627   * @throws { BusinessError } 401 - the parameter check failed.
628   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
629   * @throws { BusinessError } 17500002 - the certificate do not exist .
630   * @syscap SystemCapability.Security.CertificateManager
631   * @since 11
632   */
633  function uninstallPrivateCertificate(keyUri: string, callback: AsyncCallback<void>): void;
634
635  /**
636   * Uninstall the specified normal application certificate.
637   *
638   * @permission ohos.permission.ACCESS_CERT_MANAGER
639   * @param { string } keyUri - Indicates key's name.
640   * @returns { Promise<void> } the promise returned by the function.
641   * @throws { BusinessError } 201 - the application has no permission to call the API.
642   * @throws { BusinessError } 401 - the parameter check failed.
643   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
644   * @throws { BusinessError } 17500002 - the certificate do not exist .
645   * @syscap SystemCapability.Security.CertificateManager
646   * @since 11
647   */
648  function uninstallPrivateCertificate(keyUri: string): Promise<void>;
649
650  /**
651   * Get a list of all applications private certificates.
652   *
653   * @permission ohos.permission.ACCESS_CERT_MANAGER and ohos.permission.ACCESS_CERT_MANAGER_INTERNAL
654   * @param { AsyncCallback<CMResult> } callback - the callback of getAllAppPrivateCertificates.
655   * @throws { BusinessError } 201 - the application has no permission to call the API.
656   * @throws { BusinessError } 202 - the application is not system app.
657   * @throws { BusinessError } 401 - the parameter check failed.
658   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
659   * @syscap SystemCapability.Security.CertificateManager
660   * @systemapi
661   * @since 11
662   */
663  function getAllAppPrivateCertificates(callback: AsyncCallback<CMResult>): void;
664
665  /**
666   * Get a list of all applications private certificates.
667   *
668   * @permission ohos.permission.ACCESS_CERT_MANAGER and ohos.permission.ACCESS_CERT_MANAGER_INTERNAL
669   * @returns { Promise<CMResult> } the promise returned by the function.
670   * @throws { BusinessError } 201 - the application has no permission to call the API.
671   * @throws { BusinessError } 202 - the application is not system app.
672   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
673   * @syscap SystemCapability.Security.CertificateManager
674   * @systemapi
675   * @since 11
676   */
677  function getAllAppPrivateCertificates(): Promise<CMResult>;
678
679  /**
680   * Get the detail of private application certificate.
681   *
682   * @permission ohos.permission.ACCESS_CERT_MANAGER
683   * @param { string } keyUri - Indicates key's name.
684   * @param { AsyncCallback<CMResult> } callback - the callback of getPrivateCertificate.
685   * @throws { BusinessError } 201 - the application has no permission to call the API.
686   * @throws { BusinessError } 401 - the parameter check failed.
687   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
688   * @throws { BusinessError } 17500002 - the certificate do not exist .
689   * @syscap SystemCapability.Security.CertificateManager
690   * @since 11
691   */
692  function getPrivateCertificate(keyUri: string, callback: AsyncCallback<CMResult>): void;
693
694  /**
695   * Get the detail of private application certificate.
696   *
697   * @permission ohos.permission.ACCESS_CERT_MANAGER
698   * @param { string } keyUri - Indicates key's name.
699   * @returns { Promise<CMResult> } the promise returned by the function.
700   * @throws { BusinessError } 201 - the application has no permission to call the API.
701   * @throws { BusinessError } 401 - the parameter check failed.
702   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
703   * @throws { BusinessError } 17500002 - the certificate do not exist .
704   * @syscap SystemCapability.Security.CertificateManager
705   * @since 11
706   */
707  function getPrivateCertificate(keyUri: string): Promise<CMResult>;
708
709  /**
710   * Init operation for signing and verifying etc.
711   *
712   * @permission ohos.permission.ACCESS_CERT_MANAGER
713   * @param { string } authUri - Indicates the authorization relationship between application and application certificate.
714   * @param { CMSignatureSpec } spec - Indicates the properties of the signature and verification..
715   * @param { AsyncCallback<CMHandle> } callback - the callback of init.
716   * @throws { BusinessError } 201 - the application has no permission to call the API.
717   * @throws { BusinessError } 401 - the parameter check failed.
718   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
719   * @throws { BusinessError } 17500002 - the certificate do not exist .
720   * @syscap SystemCapability.Security.CertificateManager
721   * @since 11
722   */
723  function init(authUri: string, spec: CMSignatureSpec, callback: AsyncCallback<CMHandle>): void;
724
725  /**
726   * Init operation for signing and verifying etc.
727   *
728   * @permission ohos.permission.ACCESS_CERT_MANAGER
729   * @param { string } authUri - Indicates the authorization relationship between application and application certificate.
730   * @param { CMSignatureSpec } spec - Indicates the properties of the signature and verification.
731   * @returns { Promise<CMHandle> } the promise returned by the function.
732   * @throws { BusinessError } 201 - the application has no permission to call the API.
733   * @throws { BusinessError } 401 - the parameter check failed.
734   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
735   * @throws { BusinessError } 17500002 - the certificate do not exist .
736   * @syscap SystemCapability.Security.CertificateManager
737   * @since 11
738   */
739  function init(authUri: string, spec: CMSignatureSpec): Promise<CMHandle>;
740
741  /**
742   * Update operation for signing and verifying etc.
743   *
744   * @permission ohos.permission.ACCESS_CERT_MANAGER
745   * @param { Uint8Array } handle - Indicates the handle of the init operation.
746   * @param { Uint8Array } data - Indicates the input value.
747   * @param { AsyncCallback<void> } callback - the callback of update.
748   * @throws { BusinessError } 201 - the application has no permission to call the API.
749   * @throws { BusinessError } 401 - the parameter check failed.
750   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
751   * @syscap SystemCapability.Security.CertificateManager
752   * @since 11
753   */
754  function update(handle: Uint8Array, data: Uint8Array, callback: AsyncCallback<void>): void;
755
756  /**
757   * Update operation for signing and verifying etc.
758   *
759   * @permission ohos.permission.ACCESS_CERT_MANAGER
760   * @param { Uint8Array } handle - Indicates the handle of the init operation.
761   * @param { Uint8Array } data - Indicates the input value.
762   * @returns { Promise<void> } the promise returned by the function.
763   * @throws { BusinessError } 201 - the application has no permission to call the API.
764   * @throws { BusinessError } 401 - the parameter check failed.
765   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
766   * @syscap SystemCapability.Security.CertificateManager
767   * @since 11
768   */
769  function update(handle: Uint8Array, data: Uint8Array): Promise<void>;
770
771  /**
772   * Finish operation for signing and verifying etc.
773   *
774   * @permission ohos.permission.ACCESS_CERT_MANAGER
775   * @param { Uint8Array } handle - Indicates the handle of the init operation.
776   * @param { AsyncCallback<CMResult> } callback - the callback of finish.
777   * @throws { BusinessError } 201 - the application has no permission to call the API.
778   * @throws { BusinessError } 401 - the parameter check failed.
779   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
780   * @syscap SystemCapability.Security.CertificateManager
781   * @since 11
782   */
783  function finish(handle: Uint8Array, callback: AsyncCallback<CMResult>): void;
784
785  /**
786   * Finish operation for signing and verifying etc.
787   *
788   * @permission ohos.permission.ACCESS_CERT_MANAGER
789   * @param { Uint8Array } handle - Indicates the handle of the init operation.
790   * @param { Uint8Array } signature - Indicates the sign data.
791   * @param { AsyncCallback<CMResult> } callback - the callback of finish.
792   * @throws { BusinessError } 201 - the application has no permission to call the API.
793   * @throws { BusinessError } 401 - the parameter check failed.
794   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
795   * @syscap SystemCapability.Security.CertificateManager
796   * @since 11
797   */
798  function finish(handle: Uint8Array, signature: Uint8Array, callback: AsyncCallback<CMResult>): void;
799
800  /**
801   * Finish operation for signing and verifying etc.
802   *
803   * @permission ohos.permission.ACCESS_CERT_MANAGER
804   * @param { Uint8Array } handle - Indicates the handle of the init operation.
805   * @param { Uint8Array } [options] signature - Indicates the sign data.
806   * @returns { Promise<CMResult> } the promise returned by the function.
807   * @throws { BusinessError } 201 - the application has no permission to call the API.
808   * @throws { BusinessError } 401 - the parameter check failed.
809   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
810   * @syscap SystemCapability.Security.CertificateManager
811   * @since 11
812   */
813  function finish(handle: Uint8Array, signature?: Uint8Array): Promise<CMResult>;
814
815  /**
816   * Abort operation for signing and verifying etc.
817   *
818   * @permission ohos.permission.ACCESS_CERT_MANAGER
819   * @param { Uint8Array } handle - Indicates the handle of the init operation.
820   * @param { AsyncCallback<void> } callback - the callback of abort.
821   * @throws { BusinessError } 201 - the application has no permission to call the API.
822   * @throws { BusinessError } 401 - the parameter check failed.
823   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
824   * @syscap SystemCapability.Security.CertificateManager
825   * @since 11
826   */
827  function abort(handle: Uint8Array, callback: AsyncCallback<void>): void;
828
829  /**
830   * Abort operation for signing and verifying etc.
831   *
832   * @permission ohos.permission.ACCESS_CERT_MANAGER
833   * @param { Uint8Array } handle - Indicates the handle of the init operation.
834   * @returns { Promise<void> } the promise returned by the function.
835   * @throws { BusinessError } 201 - the application has no permission to call the API.
836   * @throws { BusinessError } 401 - the parameter check failed.
837   * @throws { BusinessError } 17500001 - there is an generic error occurred when calling the API.
838   * @syscap SystemCapability.Security.CertificateManager
839   * @since 11
840   */
841  function abort(handle: Uint8Array): Promise<void>;
842}
843
844export default certificateManager;
845