1 Star 0 Fork 4K

Feng Lin/interface_sdk-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.security.certManager.d.ts 37.98 KB
一键复制 编辑 原始数据 按行查看 历史
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028
/*
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit DeviceCertificateKit
*/
import type { AsyncCallback } from './@ohos.base';
/**
* OpenHarmony Universal CertificateManager
*
* @namespace certificateManager
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
declare namespace certificateManager {
/**
* Enum for result code
*
* @enum { number }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
export enum CMErrorCode {
/**
* Indicates that the application has no permission to call the API.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_ERROR_NO_PERMISSION = 201,
/**
* Indicates that the application is not a system application.
*
* @syscap SystemCapability.Security.CertificateManager
* @systemapi
* @since 11
*/
CM_ERROR_NOT_SYSTEM_APP = 202,
/**
* Indicates that the input parameters are invalid.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_ERROR_INVALID_PARAMS = 401,
/**
* Indicates that internal error.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_ERROR_GENERIC = 17500001,
/**
* Indicates that the certificate does not exist.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_ERROR_NO_FOUND = 17500002,
/**
* Indicates that the keystore is in an invalid format or the keystore password is incorrect.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_ERROR_INCORRECT_FORMAT = 17500003,
/**
* Indicates that the number of certificates or credentials reaches the maximum allowed.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 12
*/
CM_ERROR_MAX_CERT_COUNT_REACHED = 17500004,
/**
* Indicates that the application is not authorized by the user.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 12
*/
CM_ERROR_NO_AUTHORIZATION = 17500005
}
/**
* Provides the CertInfo type.
*
* @typedef CertInfo
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
export interface CertInfo {
/**
* Indicates the uri of certificate.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
uri: string;
/**
* Indicates the alias of certificate.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
certAlias: string;
/**
* Indicates the state of certificate.
*
* @type { boolean }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
state: boolean;
/**
* Indicates the issuer name of certificate.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
issuerName: string;
/**
* Indicates the subject name of certificate.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
subjectName: string;
/**
* Indicates the serial number of certificate.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
serial: string;
/**
* Indicates the not before time of certificate.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
notBefore: string;
/**
* Indicates the not after time of certificate.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
notAfter: string;
/**
* Indicates the fingerprint of certificate.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
fingerprintSha256: string;
/**
* Indicates the certificate binary data.
*
* @type { Uint8Array }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
cert: Uint8Array;
}
/**
* Provides the abstract Cert type.
*
* @typedef CertAbstract
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
export interface CertAbstract {
/**
* Indicates the uri of certificate.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
uri: string;
/**
* Indicates the alias of certificate.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
certAlias: string;
/**
* Indicates the state of certificate.
*
* @type { boolean }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
state: boolean;
/**
* Indicates the subject name of certificate.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
subjectName: string;
}
/**
* Provides the Credential type.
*
* @typedef Credential
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
export interface Credential {
/**
* Indicates the type of Credential.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
type: string;
/**
* Indicates the alias of Credential.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
alias: string;
/**
* Indicates the uri of Credential.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
keyUri: string;
/**
* Indicates the number of certificates included in the credential.
*
* @type { number }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
certNum: number;
/**
* Indicates the number of key included in the credential.
*
* @type { number }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
keyNum: number;
/**
* Indicates the credential binary data.
*
* @type { Uint8Array }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
credentialData: Uint8Array;
}
/**
* Provides the abstract Credential type.
*
* @typedef CredentialAbstract
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
export interface CredentialAbstract {
/**
* Indicates the type of Credential.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
type: string;
/**
* Indicates the alias of Credential.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
alias: string;
/**
* Indicates the uri of Credential.
*
* @type { string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
keyUri: string;
}
/**
* Provides the CMResult type.
*
* @typedef CMResult
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
export interface CMResult {
/**
* Indicates the certificate list of CMResult.
*
* @type { ?Array<CertAbstract> }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
certList?: Array<CertAbstract>;
/**
* Indicates the certificate info of CMResult.
*
* @type { ?CertInfo }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
certInfo?: CertInfo;
/**
* Indicates the credential list of CMResult.
*
* @type { ?Array<CredentialAbstract> }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
credentialList?: Array<CredentialAbstract>;
/**
* Indicates the credential of CMResult.
*
* @type { ?Credential }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
credential?: Credential;
/**
* Indicates the app uid list of CMResult.
*
* @type { ?Array<string> }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
appUidList?: Array<string>;
/**
* Indicates the certificate uri of CMResult.
*
* @type { ?string }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
uri?: string;
/**
* Indicates the outData of CMResult.
*
* @type { ?Uint8Array }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
outData?: Uint8Array;
}
/**
* Enum for Key Purpose
*
* @enum { number }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
export enum CmKeyPurpose {
/**
* Indicates that key for signature.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_KEY_PURPOSE_SIGN = 4,
/**
* Indicates that key for verify.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_KEY_PURPOSE_VERIFY = 8
}
/**
* Enum for Key Digest
*
* @enum { number }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
export enum CmKeyDigest {
/**
* Indicates that key digest is none.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_DIGEST_NONE = 0,
/**
* Indicates that key digest is md5.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_DIGEST_MD5 = 1,
/**
* Indicates that key digest is sha1.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_DIGEST_SHA1 = 2,
/**
* Indicates that key digest is sha224.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_DIGEST_SHA224 = 3,
/**
* Indicates that key digest is sha256.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_DIGEST_SHA256 = 4,
/**
* Indicates that key digest is sha384.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_DIGEST_SHA384 = 5,
/**
* Indicates that key digest is sha512.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_DIGEST_SHA512 = 6
}
/**
* Enum for Key Padding
*
* @enum { number }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
export enum CmKeyPadding {
/**
* Indicates that key padding is none.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_PADDING_NONE = 0,
/**
* Indicates that key padding is PSS.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_PADDING_PSS = 1,
/**
* Indicates that key padding is PKCS1_V1_5.
*
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
CM_PADDING_PKCS1_V1_5 = 2
}
/**
* Provides the CMSignatureSpec type.
*
* @typedef CMSignatureSpec
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
export interface CMSignatureSpec {
/**
* Indicates the key purpose of CMSignatureSpec.
*
* @type { CmKeyPurpose }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
purpose: CmKeyPurpose;
/**
* Indicates the key padding of CMSignatureSpec.
*
* @type { ?CmKeyPadding }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
padding?: CmKeyPadding;
/**
* Indicates the key digest of CMSignatureSpec.
*
* @type { ?CmKeyDigest }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
digest?: CmKeyDigest;
}
/**
* Provides the CMHandle type.
*
* @typedef CMHandle
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
export interface CMHandle {
/**
* Indicates the handle .
*
* @type { Uint8Array }
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
handle: Uint8Array;
}
/**
* Install private application certificate.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { Uint8Array } keystore - Indicates the keystore file with key pair and certificate.
* @param { string } keystorePwd - Indicates the password of keystore file.
* @param { string } certAlias - Indicates the certificate name inputted by the user.
* @param { AsyncCallback<CMResult> } callback - The callback of installPrivateCertificate.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500003 - The keystore is in an invalid format or the keystore password is incorrect.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
/**
* Install private application certificate.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { Uint8Array } keystore - Indicates the keystore file with key pair and certificate.
* @param { string } keystorePwd - Indicates the password of keystore file.
* @param { string } certAlias - Indicates the certificate name inputted by the user.
* @param { AsyncCallback<CMResult> } callback - The callback of installPrivateCertificate.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500003 - The keystore is in an invalid format or the keystore password is incorrect.
* @throws { BusinessError } 17500004 - The number of certificates or credentials reaches the maximum allowed.
* @syscap SystemCapability.Security.CertificateManager
* @since 12
*/
function installPrivateCertificate(
keystore: Uint8Array,
keystorePwd: string,
certAlias: string,
callback: AsyncCallback<CMResult>
): void;
/**
* Install private application certificate.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { Uint8Array } keystore - Indicates the keystore file with key pair and certificate.
* @param { string } keystorePwd - Indicates the password of keystore file.
* @param { string } certAlias - Indicates the certificate name inputted by the user.
* @returns { Promise<CMResult> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500003 - The keystore is in an invalid format or the keystore password is incorrect.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
/**
* Install private application certificate.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { Uint8Array } keystore - Indicates the keystore file with key pair and certificate.
* @param { string } keystorePwd - Indicates the password of keystore file.
* @param { string } certAlias - Indicates the certificate name inputted by the user.
* @returns { Promise<CMResult> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500003 - The keystore is in an invalid format or the keystore password is incorrect.
* @throws { BusinessError } 17500004 - The number of certificates or credentials reaches the maximum allowed.
* @syscap SystemCapability.Security.CertificateManager
* @since 12
*/
function installPrivateCertificate(keystore: Uint8Array, keystorePwd: string, certAlias: string): Promise<CMResult>;
/**
* Uninstall the specified normal application certificate.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { string } keyUri - Indicates key's name.
* @param { AsyncCallback<void> } callback - The callback of uninstallPrivateCertificate.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500002 - The certificate does not exist.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
function uninstallPrivateCertificate(keyUri: string, callback: AsyncCallback<void>): void;
/**
* Uninstall the specified normal application certificate.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { string } keyUri - Indicates key's name.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500002 - The certificate does not exist.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
function uninstallPrivateCertificate(keyUri: string): Promise<void>;
/**
* Get a list of all applications private certificates.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER and ohos.permission.ACCESS_CERT_MANAGER_INTERNAL
* @param { AsyncCallback<CMResult> } callback - The callback of getAllAppPrivateCertificates.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @syscap SystemCapability.Security.CertificateManager
* @systemapi
* @since 11
*/
function getAllAppPrivateCertificates(callback: AsyncCallback<CMResult>): void;
/**
* Get a list of all applications private certificates.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER and ohos.permission.ACCESS_CERT_MANAGER_INTERNAL
* @returns { Promise<CMResult> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 17500001 - Internal error.
* @syscap SystemCapability.Security.CertificateManager
* @systemapi
* @since 11
*/
function getAllAppPrivateCertificates(): Promise<CMResult>;
/**
* Get the detail of private application certificate.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { string } keyUri - Indicates key's name.
* @param { AsyncCallback<CMResult> } callback - The callback of getPrivateCertificate.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500002 - The certificate does not exist.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
function getPrivateCertificate(keyUri: string, callback: AsyncCallback<CMResult>): void;
/**
* Get the detail of private application certificate.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { string } keyUri - Indicates key's name.
* @returns { Promise<CMResult> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500002 - The certificate does not exist.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
function getPrivateCertificate(keyUri: string): Promise<CMResult>;
/**
* Init operation for signing and verifying etc.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { string } authUri - Indicates the authorization relationship between application and application certificate.
* @param { CMSignatureSpec } spec - Indicates the properties of the signature and verification.
* @param { AsyncCallback<CMHandle> } callback - The callback of init.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500002 - The certificate does not exist.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
/**
* Init operation for signing and verifying etc.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { string } authUri - Indicates the authorization relationship between application and application certificate.
* @param { CMSignatureSpec } spec - Indicates the properties of the signature and verification.
* @param { AsyncCallback<CMHandle> } callback - The callback of init.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500002 - The certificate does not exist.
* @throws { BusinessError } 17500005 - The application is not authorized by the user.
* @syscap SystemCapability.Security.CertificateManager
* @since 12
*/
function init(authUri: string, spec: CMSignatureSpec, callback: AsyncCallback<CMHandle>): void;
/**
* Init operation for signing and verifying etc.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { string } authUri - Indicates the authorization relationship between application and application certificate.
* @param { CMSignatureSpec } spec - Indicates the properties of the signature and verification.
* @returns { Promise<CMHandle> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500002 - The certificate does not exist.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
/**
* Init operation for signing and verifying etc.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { string } authUri - Indicates the authorization relationship between application and application certificate.
* @param { CMSignatureSpec } spec - Indicates the properties of the signature and verification.
* @returns { Promise<CMHandle> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500002 - The certificate does not exist.
* @throws { BusinessError } 17500005 - The application is not authorized by the user.
* @syscap SystemCapability.Security.CertificateManager
* @since 12
*/
function init(authUri: string, spec: CMSignatureSpec): Promise<CMHandle>;
/**
* Update operation for signing and verifying etc.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { Uint8Array } handle - Indicates the handle of the init operation.
* @param { Uint8Array } data - Indicates the input value.
* @param { AsyncCallback<void> } callback - The callback of update.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
function update(handle: Uint8Array, data: Uint8Array, callback: AsyncCallback<void>): void;
/**
* Update operation for signing and verifying etc.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { Uint8Array } handle - Indicates the handle of the init operation.
* @param { Uint8Array } data - Indicates the input value.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
function update(handle: Uint8Array, data: Uint8Array): Promise<void>;
/**
* Finish operation for signing and verifying etc.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { Uint8Array } handle - Indicates the handle of the init operation.
* @param { AsyncCallback<CMResult> } callback - The callback of finish.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
function finish(handle: Uint8Array, callback: AsyncCallback<CMResult>): void;
/**
* Finish operation for signing and verifying etc.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { Uint8Array } handle - Indicates the handle of the init operation.
* @param { Uint8Array } signature - Indicates the sign data.
* @param { AsyncCallback<CMResult> } callback - The callback of finish.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
function finish(handle: Uint8Array, signature: Uint8Array, callback: AsyncCallback<CMResult>): void;
/**
* Finish operation for signing and verifying etc.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { Uint8Array } handle - Indicates the handle of the init operation.
* @param { Uint8Array } [options] signature - Indicates the sign data.
* @returns { Promise<CMResult> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
function finish(handle: Uint8Array, signature?: Uint8Array): Promise<CMResult>;
/**
* Abort operation for signing and verifying etc.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { Uint8Array } handle - Indicates the handle of the init operation.
* @param { AsyncCallback<void> } callback - The callback of abort.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
function abort(handle: Uint8Array, callback: AsyncCallback<void>): void;
/**
* Abort operation for signing and verifying etc.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { Uint8Array } handle - Indicates the handle of the init operation.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @syscap SystemCapability.Security.CertificateManager
* @since 11
*/
function abort(handle: Uint8Array): Promise<void>;
/**
* Get the detail of public application certificate.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { string } keyUri - Indicates the key's name.
* @returns { Promise<CMResult> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500002 - The certificate does not exist.
* @throws { BusinessError } 17500005 - The application is not authorized by the user.
* @syscap SystemCapability.Security.CertificateManager
* @since 12
*/
function getPublicCertificate(keyUri: string): Promise<CMResult>;
/**:
* Whether the current application is authorized by the specified public application certificate.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { string } keyUri - Indicates the key's name.
* @returns { Promise<boolean> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @syscap SystemCapability.Security.CertificateManager
* @since 12
*/
function isAuthorizedApp(keyUri: string): Promise<boolean>;
/**
* Get a list of all user trusted CA certificates.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @returns { Promise<CMResult> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 17500001 - Internal error.
* @syscap SystemCapability.Security.CertificateManager
* @since 12
*/
function getAllUserTrustedCertificates(): Promise<CMResult>;
/**
* Get the detail of user trusted CA certificate.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @param { string } certUri - Indicates the certificate's name.
* @returns { Promise<CMResult> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br>2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 17500001 - Internal error.
* @throws { BusinessError } 17500002 - The certificate does not exist.
* @syscap SystemCapability.Security.CertificateManager
* @since 12
*/
function getUserTrustedCertificate(certUri: string): Promise<CMResult>;
/**
* Get a list of all system application certificates, such as WLAN, VPN certificate.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @returns { Promise<CMResult> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 17500001 - Internal error.
* @syscap SystemCapability.Security.CertificateManager
* @systemapi
* @since 12
*/
function getAllSystemAppCertificates(): Promise<CMResult>;
/**
* Get all private certificates installed by the application.
*
* @permission ohos.permission.ACCESS_CERT_MANAGER
* @returns { Promise<CMResult> } The private certificates installed by the application.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 17500001 - Internal error.
* @syscap SystemCapability.Security.CertificateManager
* @since 13
*/
function getPrivateCertificates(): Promise<CMResult>;
}
export default certificateManager;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lffl8796/interface_sdk-js.git
git@gitee.com:lffl8796/interface_sdk-js.git
lffl8796
interface_sdk-js
interface_sdk-js
master

搜索帮助