1# JS API Changes of the Security Subsystem 2 3The table below lists the APIs changes of the security subsystem in OpenHarmony 3.2 Beta3 over OpenHarmony 3.2 Beta2. 4 5## API Changes 6 7| Module| Class| Method/Attribute/Enumeration/Constant| Change Type| 8|---|---|---|---| 9| ohos.privacyManager | ActiveChangeResponse | activeStatus: PermissionActiveStatus; | Added| 10| ohos.privacyManager | ActiveChangeResponse | deviceId: string; | Added| 11| ohos.privacyManager | ActiveChangeResponse | permissionName: string; | Added| 12| ohos.privacyManager | ActiveChangeResponse | tokenId: number; | Added| 13| ohos.privacyManager | PermissionActiveStatus | PERM_ACTIVE_IN_BACKGROUND = 2 | Added| 14| ohos.privacyManager | PermissionActiveStatus | PERM_ACTIVE_IN_FOREGROUND = 1 | Added| 15| ohos.privacyManager | PermissionActiveStatus | PERM_INACTIVE = 0 | Added| 16| ohos.privacyManager | privacyManager | off(type: 'activeStateChange', permissionNameList: Array\<string>, callback?: Callback\<ActiveChangeResponse>): void; | Added| 17| ohos.privacyManager | privacyManager | on(type: 'activeStateChange', permissionNameList: Array\<string>, callback: Callback\<ActiveChangeResponse>): void; | Added| 18| ohos.privacyManager | privacyManager | stopUsingPermission(tokenID: number, permissionName: string): Promise\<number>;<br>stopUsingPermission(tokenID: number, permissionName: string, callback: AsyncCallback\<number>): void; | Added| 19| ohos.privacyManager | privacyManager | startUsingPermission(tokenID: number, permissionName: string): Promise\<number>;<br>startUsingPermission(tokenID: number, permissionName: string, callback: AsyncCallback\<number>): void; | Added| 20| ohos.security.cryptoFramework | cryptoFramework | createCertChainValidator(algorithm :string) : CertChainValidator; | Added| 21| ohos.security.cryptoFramework | CertChainValidator | readonly algorithm : string; | Added| 22| ohos.security.cryptoFramework | CertChainValidator | validate(certChain : CertChainData, callback : AsyncCallback\<void>) : void;<br>validate(certChain : CertChainData) : Promise\<void>; | Added| 23| ohos.security.cryptoFramework | cryptoFramework | createX509Crl(inStream : EncodingBlob, callback : AsyncCallback\<X509Crl>) : void;<br>createX509Crl(inStream : EncodingBlob) : Promise\<X509Crl>; | Added| 24| ohos.security.cryptoFramework | X509Crl | getSignatureAlgParams() : DataBlob; | Added| 25| ohos.security.cryptoFramework | X509Crl | getSignatureAlgOid() : string; | Added| 26| ohos.security.cryptoFramework | X509Crl | getSignatureAlgName() : string; | Added| 27| ohos.security.cryptoFramework | X509Crl | getSignature() : DataBlob; | Added| 28| ohos.security.cryptoFramework | X509Crl | getTbsInfo(callback : AsyncCallback\<DataBlob>) : void;<br>getTbsInfo() : Promise\<DataBlob>; | Added| 29| ohos.security.cryptoFramework | X509Crl | getRevokedCerts(callback : AsyncCallback\<Array\<X509CrlEntry>>) : void;<br>getRevokedCerts() : Promise\<Array\<X509CrlEntry>>; | Added| 30| ohos.security.cryptoFramework | X509Crl | getRevokedCertWithCert(cert : X509Cert, callback : AsyncCallback\<X509CrlEntry>) : void;<br>getRevokedCertWithCert(cert : X509Cert) : Promise\<X509CrlEntry>; | Added| 31| ohos.security.cryptoFramework | X509Crl | getRevokedCert(serialNumber : number, callback : AsyncCallback\<X509CrlEntry>) : void;<br>getRevokedCert(serialNumber : number) : Promise\<X509CrlEntry>; | Added| 32| ohos.security.cryptoFramework | X509Crl | getNextUpdate() : string; | Added| 33| ohos.security.cryptoFramework | X509Crl | getLastUpdate() : string; | Added| 34| ohos.security.cryptoFramework | X509Crl | getIssuerName() : DataBlob; | Added| 35| ohos.security.cryptoFramework | X509Crl | getVersion() : number; | Added| 36| ohos.security.cryptoFramework | X509Crl | verify(key : PubKey, callback : AsyncCallback\<void>) : void;<br>verify(key : PubKey) : Promise\<void>; | Added| 37| ohos.security.cryptoFramework | X509Crl | getEncoded(callback : AsyncCallback\<EncodingBlob>) : void;<br>getEncoded() : Promise\<EncodingBlob>; | Added| 38| ohos.security.cryptoFramework | X509Crl | getType() : string; | Added| 39| ohos.security.cryptoFramework | X509Crl | isRevoked(cert : X509Cert, callback : AsyncCallback\<boolean>) : void;<br>isRevoked(cert : X509Cert) : Promise\<boolean>; | Added| 40| ohos.security.cryptoFramework | X509CrlEntry | getRevocationDate(callback : AsyncCallback\<string>) : void;<br>getRevocationDate() : Promise\<string>; | Added| 41| ohos.security.cryptoFramework | X509CrlEntry | getCertIssuer(callback : AsyncCallback\<DataBlob>) : void;<br>getCertIssuer() : Promise\<DataBlob>; | Added| 42| ohos.security.cryptoFramework | X509CrlEntry | getSerialNumber() : number; | Added| 43| ohos.security.cryptoFramework | X509CrlEntry | getEncoded(callback : AsyncCallback\<EncodingBlob>) : void;<br>getEncoded() : Promise\<EncodingBlob>; | Added| 44| ohos.security.cryptoFramework | cryptoFramework | createX509Cert(inStream : EncodingBlob, callback : AsyncCallback\<X509Cert>) : void;<br>createX509Cert(inStream : EncodingBlob) : Promise\<X509Cert>; | Added| 45| ohos.security.cryptoFramework | X509Cert | getIssuerAltNames() : DataArray; | Added| 46| ohos.security.cryptoFramework | X509Cert | getSubjectAltNames() : DataArray; | Added| 47| ohos.security.cryptoFramework | X509Cert | getBasicConstraints() : number; | Added| 48| ohos.security.cryptoFramework | X509Cert | getExtKeyUsage() : DataArray; | Added| 49| ohos.security.cryptoFramework | X509Cert | getKeyUsage() : DataBlob; | Added| 50| ohos.security.cryptoFramework | X509Cert | getSignatureAlgParams() : DataBlob; | Added| 51| ohos.security.cryptoFramework | X509Cert | getSignatureAlgOid() : string; | Added| 52| ohos.security.cryptoFramework | X509Cert | getSignatureAlgName() : string; | Added| 53| ohos.security.cryptoFramework | X509Cert | getSignature() : DataBlob; | Added| 54| ohos.security.cryptoFramework | X509Cert | getNotAfterTime() : string; | Added| 55| ohos.security.cryptoFramework | X509Cert | getNotBeforeTime() : string; | Added| 56| ohos.security.cryptoFramework | X509Cert | getSubjectName() : DataBlob; | Added| 57| ohos.security.cryptoFramework | X509Cert | getIssuerName() : DataBlob; | Added| 58| ohos.security.cryptoFramework | X509Cert | getSerialNumber() : number; | Added| 59| ohos.security.cryptoFramework | X509Cert | getVersion() : number; | Added| 60| ohos.security.cryptoFramework | X509Cert | checkValidityWithDate(date: string, callback : AsyncCallback\<void>) : void;<br>checkValidityWithDate(date: string) : Promise\<void>; | Added| 61| ohos.security.cryptoFramework | X509Cert | getPublicKey(callback : AsyncCallback\<PubKey>) : void;<br>getPublicKey() : Promise\<PubKey>; | Added| 62| ohos.security.cryptoFramework | X509Cert | getEncoded(callback : AsyncCallback\<EncodingBlob>) : void;<br>getEncoded() : Promise\<EncodingBlob>; | Added| 63| ohos.security.cryptoFramework | X509Cert | verify(key : PubKey, callback : AsyncCallback\<void>) : void;<br>verify(key : PubKey) : Promise\<void>; | Added| 64| ohos.security.cryptoFramework | cryptoFramework | createKeyAgreement(algName : string) : KeyAgreement; | Added| 65| ohos.security.cryptoFramework | KeyAgreement | readonly algName : string; | Added| 66| ohos.security.cryptoFramework | KeyAgreement | generateSecret(priKey : PriKey, pubKey : PubKey, callback : AsyncCallback\<DataBlob>) : void;<br>generateSecret(priKey : PriKey, pubKey : PubKey) : Promise\<DataBlob>; | Added| 67| ohos.security.cryptoFramework | cryptoFramework | createVerify(algName : string) : Verify; | Added| 68| ohos.security.cryptoFramework | cryptoFramework | createSign(algName : string) : Sign; | Added| 69| ohos.security.cryptoFramework | Verify | readonly algName : string; | Added| 70| ohos.security.cryptoFramework | Verify | verify(data : DataBlob, signatureData : DataBlob, callback : AsyncCallback\<boolean>) : void;<br>verify(data : DataBlob, signatureData : DataBlob) : Promise\<boolean>; | Added| 71| ohos.security.cryptoFramework | Verify | update(data : DataBlob, callback : AsyncCallback\<void>) : void;<br>update(data : DataBlob) : Promise\<void>; | Added| 72| ohos.security.cryptoFramework | Verify | init(pubKey : PubKey, callback : AsyncCallback\<void>) : void;<br>init(pubKey : PubKey) : Promise\<void>; | Added| 73| ohos.security.cryptoFramework | Sign | readonly algName : string; | Added| 74| ohos.security.cryptoFramework | Sign | sign(data : DataBlob, callback : AsyncCallback\<DataBlob>) : void;<br>sign(data : DataBlob) : Promise\<DataBlob>; | Added| 75| ohos.security.cryptoFramework | Sign | update(data : DataBlob, callback : AsyncCallback\<void>) : void;<br>update(data : DataBlob) : Promise\<void>; | Added| 76| ohos.security.cryptoFramework | Sign | init(priKey : PriKey, callback : AsyncCallback\<void>) : void;<br>init(priKey : PriKey) : Promise\<void>; | Added| 77| ohos.security.cryptoFramework | cryptoFramework | createCipher(transformation : string) : Cipher; | Added| 78| ohos.security.cryptoFramework | Cipher | readonly algName : string; | Added| 79| ohos.security.cryptoFramework | Cipher | doFinal(data : DataBlob, callback : AsyncCallback\<DataBlob>) : void;<br>doFinal(data : DataBlob) : Promise\<DataBlob>; | Added| 80| ohos.security.cryptoFramework | Cipher | update(data : DataBlob, callback : AsyncCallback\<DataBlob>) : void;<br>update(data : DataBlob) : Promise\<DataBlob>; | Added| 81| ohos.security.cryptoFramework | Cipher | init(opMode : CryptoMode, key : Key, params : ParamsSpec, callback : AsyncCallback\<void>) : void;<br>init(opMode : CryptoMode, key : Key, params : ParamsSpec) : Promise\<void>; | Added| 82| ohos.security.cryptoFramework | cryptoFramework | createMd(algName : string) : Md; | Added| 83| ohos.security.cryptoFramework | Md | readonly algName : string; | Added| 84| ohos.security.cryptoFramework | Md | getMdLength() : number; | Added| 85| ohos.security.cryptoFramework | Md | digest(callback : AsyncCallback\<DataBlob>) : void;<br>digest() : Promise\<DataBlob>; | Added| 86| ohos.security.cryptoFramework | Md | update(input : DataBlob, callback : AsyncCallback\<void>) : void;<br>update(input : DataBlob) : Promise\<void>; | Added| 87| ohos.security.cryptoFramework | cryptoFramework | createMac(algName : string) : Mac; | Added| 88| ohos.security.cryptoFramework | Mac | readonly algName : string; | Added| 89| ohos.security.cryptoFramework | Mac | getMacLength() : number; | Added| 90| ohos.security.cryptoFramework | Mac | doFinal(callback : AsyncCallback\<DataBlob>) : void;<br>doFinal() : Promise\<DataBlob>; | Added| 91| ohos.security.cryptoFramework | Mac | update(input : DataBlob, callback : AsyncCallback\<void>) : void;<br>update(input : DataBlob) : Promise\<void>; | Added| 92| ohos.security.cryptoFramework | Mac | init(key : SymKey, callback : AsyncCallback\<void>) : void;<br>init(key : SymKey) : Promise\<void>; | Added| 93| ohos.security.cryptoFramework | cryptoFramework | createSymKeyGenerator(algName : string) : SymKeyGenerator; | Added| 94| ohos.security.cryptoFramework | cryptoFramework | createAsyKeyGenerator(algName : string) : AsyKeyGenerator; | Added| 95| ohos.security.cryptoFramework | SymKeyGenerator | readonly algName : string; | Added| 96| ohos.security.cryptoFramework | SymKeyGenerator | convertKey(key : DataBlob, callback : AsyncCallback\<SymKey>) : void;<br>convertKey(key : DataBlob) : Promise\<SymKey>; | Added| 97| ohos.security.cryptoFramework | SymKeyGenerator | generateSymKey(callback : AsyncCallback\<SymKey>) : void;<br>generateSymKey() : Promise\<SymKey>; | Added| 98| ohos.security.cryptoFramework | AsyKeyGenerator | readonly algName : string; | Added| 99| ohos.security.cryptoFramework | AsyKeyGenerator | convertKey(pubKey : DataBlob, priKey : DataBlob, callback : AsyncCallback\<KeyPair>) : void;<br>convertKey(pubKey : DataBlob, priKey : DataBlob) : Promise\<KeyPair>; | Added| 100| ohos.security.cryptoFramework | AsyKeyGenerator | generateKeyPair(callback : AsyncCallback\<KeyPair>) : void;<br>generateKeyPair() : Promise\<KeyPair>; | Added| 101| ohos.security.cryptoFramework | cryptoFramework | createRandom() : Random; | Added| 102| ohos.security.cryptoFramework | Random | setSeed(seed : DataBlob, callback : AsyncCallback\<void>) : void;<br>setSeed(seed : DataBlob) : Promise\<void>; | Added| 103| ohos.security.cryptoFramework | Random | generateRandom(len : number, callback: AsyncCallback\<DataBlob>) : void;<br>generateRandom(len : number) : Promise\<DataBlob>; | Added| 104| ohos.security.cryptoFramework | KeyPair | readonly pubKey : PubKey; | Added| 105| ohos.security.cryptoFramework | KeyPair | readonly priKey : PriKey; | Added| 106| ohos.security.cryptoFramework | PriKey | clearMem() : void; | Added| 107| ohos.security.cryptoFramework | SymKey | clearMem() : void; | Added| 108| ohos.security.cryptoFramework | Key | readonly algName : string; | Added| 109| ohos.security.cryptoFramework | Key | readonly format : string; | Added| 110| ohos.security.cryptoFramework | Key | getEncoded() : DataBlob; | Added| 111| ohos.security.cryptoFramework | CryptoMode | DECRYPT_MODE = 1 | Added| 112| ohos.security.cryptoFramework | CryptoMode | ENCRYPT_MODE = 0 | Added| 113| ohos.security.cryptoFramework | CcmParamsSpec | authTag : DataBlob; | Added| 114| ohos.security.cryptoFramework | CcmParamsSpec | aad : DataBlob; | Added| 115| ohos.security.cryptoFramework | CcmParamsSpec | iv : DataBlob; | Added| 116| ohos.security.cryptoFramework | GcmParamsSpec | authTag : DataBlob; | Added| 117| ohos.security.cryptoFramework | GcmParamsSpec | aad : DataBlob; | Added| 118| ohos.security.cryptoFramework | GcmParamsSpec | iv : DataBlob; | Added| 119| ohos.security.cryptoFramework | IvParamsSpec | iv : DataBlob; | Added| 120| ohos.security.cryptoFramework | ParamsSpec | algoName : string; | Added| 121| ohos.security.cryptoFramework | CertChainData | encodingFormat: EncodingFormat; | Added| 122| ohos.security.cryptoFramework | CertChainData | count : number; | Added| 123| ohos.security.cryptoFramework | CertChainData | data: Uint8Array; | Added| 124| ohos.security.cryptoFramework | EncodingBlob | encodingFormat : EncodingFormat; | Added| 125| ohos.security.cryptoFramework | EncodingBlob | data : Uint8Array; | Added| 126| ohos.security.cryptoFramework | EncodingFormat | FORMAT_PEM = 1 | Added| 127| ohos.security.cryptoFramework | EncodingFormat | FORMAT_DER = 0 | Added| 128| ohos.security.cryptoFramework | DataArray | data : Array\<Uint8Array>; | Added| 129| ohos.security.cryptoFramework | DataBlob | data : Uint8Array; | Added| 130| ohos.security.cryptoFramework | Result | ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE = 17630007 | Added| 131| ohos.security.cryptoFramework | Result | ERR_KEYUSAGE_NO_CERTSIGN = 17630006 | Added| 132| ohos.security.cryptoFramework | Result | ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 17630005 | Added| 133| ohos.security.cryptoFramework | Result | ERR_CERT_HAS_EXPIRED = 17630004 | Added| 134| ohos.security.cryptoFramework | Result | ERR_CERT_NOT_YET_VALID = 17630003 | Added| 135| ohos.security.cryptoFramework | Result | ERR_CERT_SIGNATURE_FAILURE = 17630002 | Added| 136| ohos.security.cryptoFramework | Result | ERR_CRYPTO_OPERATION = 17630001 | Added| 137| ohos.security.cryptoFramework | Result | ERR_EXTERNAL_ERROR = 17620002 | Added| 138| ohos.security.cryptoFramework | Result | ERR_OUT_OF_MEMORY = 17620001 | Added| 139| ohos.security.cryptoFramework | Result | NOT_SUPPORT = 801 | Added| 140| ohos.security.cryptoFramework | Result | INVALID_PARAMS = 401 | Added| 141| ohos.security.huks | HuksTag | HUKS_TAG_CHALLENGE_POS = HuksTagType.HUKS_TAG_TYPE_UINT | 310 | 142| ohos.security.huks | HuksTag | HUKS_TAG_CHALLENGE_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 309 | 143| ohos.security.huks | HuksTag | HUKS_TAG_KEY_SECURE_SIGN_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 308 | 144| ohos.security.huks | HuksTag | HUKS_TAG_KEY_AUTH_ACCESS_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT | 307 | 145| ohos.security.huks | HuksSecureSignType | HUKS_SECURE_SIGN_WITH_AUTHINFO = 1 | Added| 146| ohos.security.huks | HuksChallengePosition | HUKS_CHALLENGE_POS_3 | Added| 147| ohos.security.huks | HuksChallengePosition | HUKS_CHALLENGE_POS_2 | Added| 148| ohos.security.huks | HuksChallengePosition | HUKS_CHALLENGE_POS_1 | Added| 149| ohos.security.huks | HuksChallengePosition | HUKS_CHALLENGE_POS_0 = 0 | Added| 150| ohos.security.huks | HuksChallengeType | HUKS_CHALLENGE_TYPE_NONE = 2 | Added| 151| ohos.security.huks | HuksChallengeType | HUKS_CHALLENGE_TYPE_CUSTOM = 1 | Added| 152| ohos.security.huks | HuksChallengeType | HUKS_CHALLENGE_TYPE_NORMAL = 0 | Added| 153| ohos.security.huks | HuksAuthAccessType | HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL = 1 \<\< 1 | Added| 154| ohos.security.huks | HuksAuthAccessType | HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD = 1 \<\< 0 | Added| 155| ohos.security.huks | HuksUserAuthType | HUKS_USER_AUTH_TYPE_PIN = 1 \<\< 2 | Added| 156| ohos.security.huks | HuksUserAuthType | HUKS_USER_AUTH_TYPE_FACE = 1 \<\< 1 | Added| 157| ohos.security.huks | HuksUserAuthType | HUKS_USER_AUTH_TYPE_FINGERPRINT = 1 \<\< 0 | Added| 158| ohos.security.huks | HuksErrorCode | HUKS_ERROR_DEVICE_NO_CREDENTIAL = -44 | Added| 159| ohos.security.huks | HuksErrorCode | HUKS_ERROR_KEY_AUTH_FAILED = -43 | Added| 160| ohos.security.huks | HuksErrorCode | HUKS_ERROR_USER_AUTH_TYPE_NOT_SUPPORT = -42 | Added| 161| ohos.security.huks | HuksErrorCode | HUKS_ERROR_GET_USERIAM_AUTHINFO_FAILED = -41 | Added| 162| ohos.security.huks | HuksErrorCode | HUKS_ERROR_GET_USERIAM_SECINFO_FAILED = -40 | Added| 163| ohos.security.huks | huks | attestKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>attestKey(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>; | Added| 164