1/* 2 * Copyright (c) 2022-2025 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 */ 20import type { AsyncCallback } from './@ohos.base'; 21import cryptoFramework from './@ohos.security.cryptoFramework'; 22 23/** 24 * Provides a series of capabilities related to certificates, 25 * which supports parsing, verification, and output of certificates, extensions, and CRLs. 26 * 27 * @namespace cert 28 * @syscap SystemCapability.Security.Cert 29 * @since 9 30 */ 31/** 32 * Provides a series of capabilities related to certificates, 33 * which supports parsing, verification, and output of certificates, extensions, and CRLs. 34 * 35 * @namespace cert 36 * @syscap SystemCapability.Security.Cert 37 * @crossplatform 38 * @since 11 39 */ 40/** 41 * Provides a series of capabilities related to certificates, 42 * which supports parsing, verification, and output of certificates, extensions, and CRLs. 43 * 44 * @namespace cert 45 * @syscap SystemCapability.Security.Cert 46 * @crossplatform 47 * @atomicservice 48 * @since arkts {'1.1':'12','1.2':'20'} 49 * @arkts 1.1&1.2 50 */ 51declare namespace cert { 52 /** 53 * Enum for result code 54 * 55 * @enum { number } 56 * @syscap SystemCapability.Security.Cert 57 * @since 9 58 */ 59 /** 60 * Enum for result code 61 * 62 * @enum { number } 63 * @syscap SystemCapability.Security.Cert 64 * @crossplatform 65 * @since 11 66 */ 67 /** 68 * Enum for result code 69 * 70 * @enum { number } 71 * @syscap SystemCapability.Security.Cert 72 * @crossplatform 73 * @atomicservice 74 * @since 12 75 */ 76 enum CertResult { 77 /** 78 * Indicates that input parameters is invalid. 79 * 80 * @syscap SystemCapability.Security.Cert 81 * @since 9 82 */ 83 /** 84 * Indicates that input parameters is invalid. 85 * 86 * @syscap SystemCapability.Security.Cert 87 * @crossplatform 88 * @since 11 89 */ 90 /** 91 * Indicates that input parameters is invalid. 92 * 93 * @syscap SystemCapability.Security.Cert 94 * @crossplatform 95 * @atomicservice 96 * @since 12 97 */ 98 INVALID_PARAMS = 401, 99 100 /** 101 * Indicates that function or algorithm is not supported. 102 * 103 * @syscap SystemCapability.Security.Cert 104 * @since 9 105 */ 106 /** 107 * Indicates that function or algorithm is not supported. 108 * 109 * @syscap SystemCapability.Security.Cert 110 * @crossplatform 111 * @since 11 112 */ 113 /** 114 * Indicates that function or algorithm is not supported. 115 * 116 * @syscap SystemCapability.Security.Cert 117 * @crossplatform 118 * @atomicservice 119 * @since 12 120 */ 121 NOT_SUPPORT = 801, 122 123 /** 124 * Indicates the memory malloc failed. 125 * 126 * @syscap SystemCapability.Security.Cert 127 * @since 9 128 */ 129 /** 130 * Indicates the memory malloc failed. 131 * 132 * @syscap SystemCapability.Security.Cert 133 * @crossplatform 134 * @since 11 135 */ 136 /** 137 * Indicates the memory malloc failed. 138 * 139 * @syscap SystemCapability.Security.Cert 140 * @crossplatform 141 * @atomicservice 142 * @since 12 143 */ 144 ERR_OUT_OF_MEMORY = 19020001, 145 146 /** 147 * Indicates that runtime error. 148 * 149 * @syscap SystemCapability.Security.Cert 150 * @since 9 151 */ 152 /** 153 * Indicates that runtime error. 154 * 155 * @syscap SystemCapability.Security.Cert 156 * @crossplatform 157 * @since 11 158 */ 159 /** 160 * Indicates that runtime error. 161 * 162 * @syscap SystemCapability.Security.Cert 163 * @crossplatform 164 * @atomicservice 165 * @since 12 166 */ 167 ERR_RUNTIME_ERROR = 19020002, 168 169 /** 170 * Indicates that parameter check failed. 171 * 172 * @syscap SystemCapability.Security.Cert 173 * @crossplatform 174 * @atomicservice 175 * @since 20 176 */ 177 ERR_PARAMETER_CHECK_FAILED = 19020003, 178 179 /** 180 * Indicates the crypto operation error. 181 * 182 * @syscap SystemCapability.Security.Cert 183 * @since 9 184 */ 185 /** 186 * Indicates the crypto operation error. 187 * 188 * @syscap SystemCapability.Security.Cert 189 * @crossplatform 190 * @since 11 191 */ 192 /** 193 * Indicates the crypto operation error. 194 * 195 * @syscap SystemCapability.Security.Cert 196 * @crossplatform 197 * @atomicservice 198 * @since 12 199 */ 200 ERR_CRYPTO_OPERATION = 19030001, 201 202 /** 203 * Indicates that the certificate signature verification failed. 204 * 205 * @syscap SystemCapability.Security.Cert 206 * @since 9 207 */ 208 /** 209 * Indicates that the certificate signature verification failed. 210 * 211 * @syscap SystemCapability.Security.Cert 212 * @crossplatform 213 * @since 11 214 */ 215 /** 216 * Indicates that the certificate signature verification failed. 217 * 218 * @syscap SystemCapability.Security.Cert 219 * @crossplatform 220 * @atomicservice 221 * @since 12 222 */ 223 ERR_CERT_SIGNATURE_FAILURE = 19030002, 224 225 /** 226 * Indicates that the certificate has not taken effect. 227 * 228 * @syscap SystemCapability.Security.Cert 229 * @since 9 230 */ 231 /** 232 * Indicates that the certificate has not taken effect. 233 * 234 * @syscap SystemCapability.Security.Cert 235 * @crossplatform 236 * @since 11 237 */ 238 /** 239 * Indicates that the certificate has not taken effect. 240 * 241 * @syscap SystemCapability.Security.Cert 242 * @crossplatform 243 * @atomicservice 244 * @since 12 245 */ 246 ERR_CERT_NOT_YET_VALID = 19030003, 247 248 /** 249 * Indicates that the certificate has expired. 250 * 251 * @syscap SystemCapability.Security.Cert 252 * @since 9 253 */ 254 /** 255 * Indicates that the certificate has expired. 256 * 257 * @syscap SystemCapability.Security.Cert 258 * @crossplatform 259 * @since 11 260 */ 261 /** 262 * Indicates that the certificate has expired. 263 * 264 * @syscap SystemCapability.Security.Cert 265 * @crossplatform 266 * @atomicservice 267 * @since 12 268 */ 269 ERR_CERT_HAS_EXPIRED = 19030004, 270 271 /** 272 * Indicates a failure to obtain the certificate issuer. 273 * 274 * @syscap SystemCapability.Security.Cert 275 * @since 9 276 */ 277 /** 278 * Indicates a failure to obtain the certificate issuer. 279 * 280 * @syscap SystemCapability.Security.Cert 281 * @crossplatform 282 * @since 11 283 */ 284 /** 285 * Indicates a failure to obtain the certificate issuer. 286 * 287 * @syscap SystemCapability.Security.Cert 288 * @crossplatform 289 * @atomicservice 290 * @since 12 291 */ 292 ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 19030005, 293 294 /** 295 * The key cannot be used for signing a certificate. 296 * 297 * @syscap SystemCapability.Security.Cert 298 * @since 9 299 */ 300 /** 301 * The key cannot be used for signing a certificate. 302 * 303 * @syscap SystemCapability.Security.Cert 304 * @crossplatform 305 * @since 11 306 */ 307 /** 308 * The key cannot be used for signing a certificate. 309 * 310 * @syscap SystemCapability.Security.Cert 311 * @crossplatform 312 * @atomicservice 313 * @since 12 314 */ 315 ERR_KEYUSAGE_NO_CERTSIGN = 19030006, 316 317 /** 318 * The key cannot be used for digital signature. 319 * 320 * @syscap SystemCapability.Security.Cert 321 * @since 9 322 */ 323 /** 324 * The key cannot be used for digital signature. 325 * 326 * @syscap SystemCapability.Security.Cert 327 * @crossplatform 328 * @since 11 329 */ 330 /** 331 * The key cannot be used for digital signature. 332 * 333 * @syscap SystemCapability.Security.Cert 334 * @crossplatform 335 * @atomicservice 336 * @since 12 337 */ 338 ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE = 19030007, 339 340 /** 341 * The password may be wrong. 342 * 343 * @syscap SystemCapability.Security.Cert 344 * @crossplatform 345 * @atomicservice 346 * @since 18 347 */ 348 ERR_MAYBE_WRONG_PASSWORD = 19030008 349 } 350 351 /** 352 * Provides the data blob type. 353 * 354 * @typedef DataBlob 355 * @syscap SystemCapability.Security.Cert 356 * @since 9 357 */ 358 /** 359 * Provides the data blob type. 360 * 361 * @typedef DataBlob 362 * @syscap SystemCapability.Security.Cert 363 * @crossplatform 364 * @since 11 365 */ 366 /** 367 * Provides the data blob type. 368 * 369 * @typedef DataBlob 370 * @syscap SystemCapability.Security.Cert 371 * @crossplatform 372 * @atomicservice 373 * @since 12 374 */ 375 interface DataBlob { 376 /** 377 * Indicates the content of data blob. 378 * 379 * @type { Uint8Array } 380 * @syscap SystemCapability.Security.Cert 381 * @since 9 382 */ 383 /** 384 * Indicates the content of data blob. 385 * 386 * @type { Uint8Array } 387 * @syscap SystemCapability.Security.Cert 388 * @crossplatform 389 * @since 11 390 */ 391 /** 392 * Indicates the content of data blob. 393 * 394 * @type { Uint8Array } 395 * @syscap SystemCapability.Security.Cert 396 * @crossplatform 397 * @atomicservice 398 * @since 12 399 */ 400 data: Uint8Array; 401 } 402 403 /** 404 * Provides the data array type. 405 * 406 * @typedef DataArray 407 * @syscap SystemCapability.Security.Cert 408 * @since 9 409 */ 410 /** 411 * Provides the data array type. 412 * 413 * @typedef DataArray 414 * @syscap SystemCapability.Security.Cert 415 * @crossplatform 416 * @since 11 417 */ 418 /** 419 * Provides the data array type. 420 * 421 * @typedef DataArray 422 * @syscap SystemCapability.Security.Cert 423 * @crossplatform 424 * @atomicservice 425 * @since 12 426 */ 427 interface DataArray { 428 /** 429 * Indicates the content of data array. 430 * 431 * @type { Array<Uint8Array> } 432 * @syscap SystemCapability.Security.Cert 433 * @since 9 434 */ 435 /** 436 * Indicates the content of data array. 437 * 438 * @type { Array<Uint8Array> } 439 * @syscap SystemCapability.Security.Cert 440 * @crossplatform 441 * @since 11 442 */ 443 /** 444 * Indicates the content of data array. 445 * 446 * @type { Array<Uint8Array> } 447 * @syscap SystemCapability.Security.Cert 448 * @crossplatform 449 * @atomicservice 450 * @since 12 451 */ 452 data: Array<Uint8Array>; 453 } 454 455 /** 456 * Enum for supported cert encoding format. 457 * 458 * @enum { number } 459 * @syscap SystemCapability.Security.Cert 460 * @since 9 461 */ 462 /** 463 * Enum for supported cert encoding format. 464 * 465 * @enum { number } 466 * @syscap SystemCapability.Security.Cert 467 * @crossplatform 468 * @since 11 469 */ 470 /** 471 * Enum for supported cert encoding format. 472 * 473 * @enum { number } 474 * @syscap SystemCapability.Security.Cert 475 * @crossplatform 476 * @atomicservice 477 * @since 12 478 */ 479 enum EncodingFormat { 480 /** 481 * The value of cert DER format. 482 * 483 * @syscap SystemCapability.Security.Cert 484 * @since 9 485 */ 486 /** 487 * The value of cert DER format. 488 * 489 * @syscap SystemCapability.Security.Cert 490 * @crossplatform 491 * @since 11 492 */ 493 /** 494 * The value of cert DER format. 495 * 496 * @syscap SystemCapability.Security.Cert 497 * @crossplatform 498 * @atomicservice 499 * @since 12 500 */ 501 FORMAT_DER = 0, 502 503 /** 504 * The value of cert PEM format. 505 * 506 * @syscap SystemCapability.Security.Cert 507 * @since 9 508 */ 509 /** 510 * The value of cert PEM format. 511 * 512 * @syscap SystemCapability.Security.Cert 513 * @crossplatform 514 * @since 11 515 */ 516 /** 517 * The value of cert PEM format. 518 * 519 * @syscap SystemCapability.Security.Cert 520 * @crossplatform 521 * @atomicservice 522 * @since 12 523 */ 524 FORMAT_PEM = 1, 525 526 /** 527 * The value of cert chain PKCS7 format. 528 * 529 * @syscap SystemCapability.Security.Cert 530 * @crossplatform 531 * @since 11 532 */ 533 /** 534 * The value of cert chain PKCS7 format. 535 * 536 * @syscap SystemCapability.Security.Cert 537 * @crossplatform 538 * @atomicservice 539 * @since 12 540 */ 541 FORMAT_PKCS7 = 2 542 } 543 544 /** 545 * Enum for the certificate item type. 546 * 547 * @enum { number } 548 * @syscap SystemCapability.Security.Cert 549 * @since 10 550 */ 551 /** 552 * Enum for the certificate item type. 553 * 554 * @enum { number } 555 * @syscap SystemCapability.Security.Cert 556 * @crossplatform 557 * @since 11 558 */ 559 /** 560 * Enum for the certificate item type. 561 * 562 * @enum { number } 563 * @syscap SystemCapability.Security.Cert 564 * @crossplatform 565 * @atomicservice 566 * @since 12 567 */ 568 enum CertItemType { 569 /** 570 * Indicates to get certificate TBS(to be signed) value. 571 * 572 * @syscap SystemCapability.Security.Cert 573 * @since 10 574 */ 575 /** 576 * Indicates to get certificate TBS(to be signed) value. 577 * 578 * @syscap SystemCapability.Security.Cert 579 * @crossplatform 580 * @since 11 581 */ 582 /** 583 * Indicates to get certificate TBS(to be signed) value. 584 * 585 * @syscap SystemCapability.Security.Cert 586 * @crossplatform 587 * @atomicservice 588 * @since 12 589 */ 590 CERT_ITEM_TYPE_TBS = 0, 591 592 /** 593 * Indicates to get certificate public key. 594 * 595 * @syscap SystemCapability.Security.Cert 596 * @since 10 597 */ 598 /** 599 * Indicates to get certificate public key. 600 * 601 * @syscap SystemCapability.Security.Cert 602 * @crossplatform 603 * @since 11 604 */ 605 /** 606 * Indicates to get certificate public key. 607 * 608 * @syscap SystemCapability.Security.Cert 609 * @crossplatform 610 * @atomicservice 611 * @since 12 612 */ 613 CERT_ITEM_TYPE_PUBLIC_KEY = 1, 614 615 /** 616 * Indicates to get certificate issuer unique id value. 617 * 618 * @syscap SystemCapability.Security.Cert 619 * @since 10 620 */ 621 /** 622 * Indicates to get certificate issuer unique id value. 623 * 624 * @syscap SystemCapability.Security.Cert 625 * @crossplatform 626 * @since 11 627 */ 628 /** 629 * Indicates to get certificate issuer unique id value. 630 * 631 * @syscap SystemCapability.Security.Cert 632 * @crossplatform 633 * @atomicservice 634 * @since 12 635 */ 636 CERT_ITEM_TYPE_ISSUER_UNIQUE_ID = 2, 637 638 /** 639 * Indicates to get certificate subject unique id value. 640 * 641 * @syscap SystemCapability.Security.Cert 642 * @since 10 643 */ 644 /** 645 * Indicates to get certificate subject unique id value. 646 * 647 * @syscap SystemCapability.Security.Cert 648 * @crossplatform 649 * @since 11 650 */ 651 /** 652 * Indicates to get certificate subject unique id value. 653 * 654 * @syscap SystemCapability.Security.Cert 655 * @crossplatform 656 * @atomicservice 657 * @since 12 658 */ 659 CERT_ITEM_TYPE_SUBJECT_UNIQUE_ID = 3, 660 661 /** 662 * Indicates to get certificate extensions value. 663 * 664 * @syscap SystemCapability.Security.Cert 665 * @since 10 666 */ 667 /** 668 * Indicates to get certificate extensions value. 669 * 670 * @syscap SystemCapability.Security.Cert 671 * @crossplatform 672 * @since 11 673 */ 674 /** 675 * Indicates to get certificate extensions value. 676 * 677 * @syscap SystemCapability.Security.Cert 678 * @crossplatform 679 * @atomicservice 680 * @since 12 681 */ 682 CERT_ITEM_TYPE_EXTENSIONS = 4 683 } 684 685 /** 686 * Enumerates for the certificate extension object identifier (OID) types. 687 * 688 * @enum { number } 689 * @syscap SystemCapability.Security.Cert 690 * @since 10 691 */ 692 /** 693 * Enumerates for the certificate extension object identifier (OID) types. 694 * 695 * @enum { number } 696 * @syscap SystemCapability.Security.Cert 697 * @crossplatform 698 * @since 11 699 */ 700 /** 701 * Enumerates for the certificate extension object identifier (OID) types. 702 * 703 * @enum { number } 704 * @syscap SystemCapability.Security.Cert 705 * @crossplatform 706 * @atomicservice 707 * @since 12 708 */ 709 enum ExtensionOidType { 710 /** 711 * Indicates to obtain all types of OIDs, including critical and uncritical types. 712 * 713 * @syscap SystemCapability.Security.Cert 714 * @since 10 715 */ 716 /** 717 * Indicates to obtain all types of OIDs, including critical and uncritical types. 718 * 719 * @syscap SystemCapability.Security.Cert 720 * @crossplatform 721 * @since 11 722 */ 723 /** 724 * Indicates to obtain all types of OIDs, including critical and uncritical types. 725 * 726 * @syscap SystemCapability.Security.Cert 727 * @crossplatform 728 * @atomicservice 729 * @since 12 730 */ 731 EXTENSION_OID_TYPE_ALL = 0, 732 733 /** 734 * Indicates to obtain OIDs of the critical type. 735 * 736 * @syscap SystemCapability.Security.Cert 737 * @since 10 738 */ 739 /** 740 * Indicates to obtain OIDs of the critical type. 741 * 742 * @syscap SystemCapability.Security.Cert 743 * @crossplatform 744 * @since 11 745 */ 746 /** 747 * Indicates to obtain OIDs of the critical type. 748 * 749 * @syscap SystemCapability.Security.Cert 750 * @crossplatform 751 * @atomicservice 752 * @since 12 753 */ 754 EXTENSION_OID_TYPE_CRITICAL = 1, 755 756 /** 757 * Indicates to obtain OIDs of the uncritical type. 758 * 759 * @syscap SystemCapability.Security.Cert 760 * @since 10 761 */ 762 /** 763 * Indicates to obtain OIDs of the uncritical type. 764 * 765 * @syscap SystemCapability.Security.Cert 766 * @crossplatform 767 * @since 11 768 */ 769 /** 770 * Indicates to obtain OIDs of the uncritical type. 771 * 772 * @syscap SystemCapability.Security.Cert 773 * @crossplatform 774 * @atomicservice 775 * @since 12 776 */ 777 EXTENSION_OID_TYPE_UNCRITICAL = 2 778 } 779 780 /** 781 * Enum for the certificate extension entry type. 782 * 783 * @enum { number } 784 * @syscap SystemCapability.Security.Cert 785 * @since 10 786 */ 787 /** 788 * Enum for the certificate extension entry type. 789 * 790 * @enum { number } 791 * @syscap SystemCapability.Security.Cert 792 * @crossplatform 793 * @since 11 794 */ 795 /** 796 * Enum for the certificate extension entry type. 797 * 798 * @enum { number } 799 * @syscap SystemCapability.Security.Cert 800 * @crossplatform 801 * @atomicservice 802 * @since 12 803 */ 804 enum ExtensionEntryType { 805 /** 806 * Indicates to get extension entry. 807 * 808 * @syscap SystemCapability.Security.Cert 809 * @since 10 810 */ 811 /** 812 * Indicates to get extension entry. 813 * 814 * @syscap SystemCapability.Security.Cert 815 * @crossplatform 816 * @since 11 817 */ 818 /** 819 * Indicates to get extension entry. 820 * 821 * @syscap SystemCapability.Security.Cert 822 * @crossplatform 823 * @atomicservice 824 * @since 12 825 */ 826 EXTENSION_ENTRY_TYPE_ENTRY = 0, 827 828 /** 829 * Indicates to get extension entry critical. 830 * 831 * @syscap SystemCapability.Security.Cert 832 * @since 10 833 */ 834 /** 835 * Indicates to get extension entry critical. 836 * 837 * @syscap SystemCapability.Security.Cert 838 * @crossplatform 839 * @since 11 840 */ 841 /** 842 * Indicates to get extension entry critical. 843 * 844 * @syscap SystemCapability.Security.Cert 845 * @crossplatform 846 * @atomicservice 847 * @since 12 848 */ 849 EXTENSION_ENTRY_TYPE_ENTRY_CRITICAL = 1, 850 851 /** 852 * Indicates to get extension entry value. 853 * 854 * @syscap SystemCapability.Security.Cert 855 * @since 10 856 */ 857 /** 858 * Indicates to get extension entry value. 859 * 860 * @syscap SystemCapability.Security.Cert 861 * @crossplatform 862 * @since 11 863 */ 864 /** 865 * Indicates to get extension entry value. 866 * 867 * @syscap SystemCapability.Security.Cert 868 * @crossplatform 869 * @atomicservice 870 * @since 12 871 */ 872 EXTENSION_ENTRY_TYPE_ENTRY_VALUE = 2 873 } 874 875 /** 876 * Provides the cert encoding blob type. 877 * 878 * @typedef EncodingBlob 879 * @syscap SystemCapability.Security.Cert 880 * @since 9 881 */ 882 /** 883 * Provides the cert encoding blob type. 884 * 885 * @typedef EncodingBlob 886 * @syscap SystemCapability.Security.Cert 887 * @crossplatform 888 * @since 11 889 */ 890 /** 891 * Provides the cert encoding blob type. 892 * 893 * @typedef EncodingBlob 894 * @syscap SystemCapability.Security.Cert 895 * @crossplatform 896 * @atomicservice 897 * @since 12 898 */ 899 interface EncodingBlob { 900 /** 901 * The data input. 902 * 903 * @type { Uint8Array } 904 * @syscap SystemCapability.Security.Cert 905 * @since 9 906 */ 907 /** 908 * The data input. 909 * 910 * @type { Uint8Array } 911 * @syscap SystemCapability.Security.Cert 912 * @crossplatform 913 * @since 11 914 */ 915 /** 916 * The data input. 917 * 918 * @type { Uint8Array } 919 * @syscap SystemCapability.Security.Cert 920 * @crossplatform 921 * @atomicservice 922 * @since 12 923 */ 924 data: Uint8Array; 925 /** 926 * The data encoding format. 927 * 928 * @type { EncodingFormat } 929 * @syscap SystemCapability.Security.Cert 930 * @since 9 931 */ 932 /** 933 * The data encoding format. 934 * 935 * @type { EncodingFormat } 936 * @syscap SystemCapability.Security.Cert 937 * @crossplatform 938 * @since 11 939 */ 940 /** 941 * The data encoding format. 942 * 943 * @type { EncodingFormat } 944 * @syscap SystemCapability.Security.Cert 945 * @crossplatform 946 * @atomicservice 947 * @since 12 948 */ 949 encodingFormat: EncodingFormat; 950 } 951 952 /** 953 * Provides the cert chain data type. 954 * 955 * @typedef CertChainData 956 * @syscap SystemCapability.Security.Cert 957 * @since 9 958 */ 959 /** 960 * Provides the cert chain data type. 961 * 962 * @typedef CertChainData 963 * @syscap SystemCapability.Security.Cert 964 * @crossplatform 965 * @since 11 966 */ 967 /** 968 * Provides the cert chain data type. 969 * 970 * @typedef CertChainData 971 * @syscap SystemCapability.Security.Cert 972 * @crossplatform 973 * @atomicservice 974 * @since 12 975 */ 976 interface CertChainData { 977 /** 978 * The data input. 979 * 980 * @type { Uint8Array } 981 * @syscap SystemCapability.Security.Cert 982 * @since 9 983 */ 984 /** 985 * The data input. 986 * 987 * @type { Uint8Array } 988 * @syscap SystemCapability.Security.Cert 989 * @crossplatform 990 * @since 11 991 */ 992 /** 993 * The data input. 994 * 995 * @type { Uint8Array } 996 * @syscap SystemCapability.Security.Cert 997 * @crossplatform 998 * @atomicservice 999 * @since 12 1000 */ 1001 data: Uint8Array; 1002 /** 1003 * The number of certs. 1004 * 1005 * @type { number } 1006 * @syscap SystemCapability.Security.Cert 1007 * @since 9 1008 */ 1009 /** 1010 * The number of certs. 1011 * 1012 * @type { number } 1013 * @syscap SystemCapability.Security.Cert 1014 * @crossplatform 1015 * @since 11 1016 */ 1017 /** 1018 * The number of certs. 1019 * 1020 * @type { number } 1021 * @syscap SystemCapability.Security.Cert 1022 * @crossplatform 1023 * @atomicservice 1024 * @since 12 1025 */ 1026 count: number; 1027 /** 1028 * The data encoding format. 1029 * 1030 * @type { EncodingFormat } 1031 * @syscap SystemCapability.Security.Cert 1032 * @since 9 1033 */ 1034 /** 1035 * The data encoding format. 1036 * 1037 * @type { EncodingFormat } 1038 * @syscap SystemCapability.Security.Cert 1039 * @crossplatform 1040 * @since 11 1041 */ 1042 /** 1043 * The data encoding format. 1044 * 1045 * @type { EncodingFormat } 1046 * @syscap SystemCapability.Security.Cert 1047 * @crossplatform 1048 * @atomicservice 1049 * @since 12 1050 */ 1051 encodingFormat: EncodingFormat; 1052 } 1053 1054 /** 1055 * Enum for Encoding type. 1056 * 1057 * @enum { number } 1058 * @syscap SystemCapability.Security.Cert 1059 * @crossplatform 1060 * @atomicservice 1061 * @since 12 1062 */ 1063 enum EncodingType { 1064 /** 1065 * Indicates to utf8 type. 1066 * 1067 * @syscap SystemCapability.Security.Cert 1068 * @crossplatform 1069 * @atomicservice 1070 * @since 12 1071 */ 1072 ENCODING_UTF8 = 0 1073 } 1074 1075 /** 1076 * Provides the x509 cert type. 1077 * 1078 * @typedef X509Cert 1079 * @syscap SystemCapability.Security.Cert 1080 * @since 9 1081 */ 1082 /** 1083 * Provides the x509 cert type. 1084 * 1085 * @typedef X509Cert 1086 * @syscap SystemCapability.Security.Cert 1087 * @crossplatform 1088 * @since 11 1089 */ 1090 /** 1091 * Provides the x509 cert type. 1092 * 1093 * @typedef X509Cert 1094 * @syscap SystemCapability.Security.Cert 1095 * @crossplatform 1096 * @atomicservice 1097 * @since 12 1098 */ 1099 interface X509Cert { 1100 /** 1101 * Verify the X509 cert. 1102 * 1103 * @param { cryptoFramework.PubKey } key - public key to verify cert. 1104 * @param { AsyncCallback<void> } callback - the callback of verify. 1105 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1106 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1107 * @throws { BusinessError } 19030001 - crypto operation error. 1108 * @syscap SystemCapability.Security.Cert 1109 * @since 9 1110 */ 1111 /** 1112 * Verify the X509 cert. 1113 * 1114 * @param { cryptoFramework.PubKey } key - public key to verify cert. 1115 * @param { AsyncCallback<void> } callback - the callback of verify. 1116 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1117 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1118 * @throws { BusinessError } 19030001 - crypto operation error. 1119 * @syscap SystemCapability.Security.Cert 1120 * @crossplatform 1121 * @since 11 1122 */ 1123 /** 1124 * Verify the X509 cert. 1125 * 1126 * @param { cryptoFramework.PubKey } key - public key to verify cert. 1127 * @param { AsyncCallback<void> } callback - the callback of verify. 1128 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1129 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1130 * @throws { BusinessError } 19030001 - crypto operation error. 1131 * @syscap SystemCapability.Security.Cert 1132 * @crossplatform 1133 * @atomicservice 1134 * @since 12 1135 */ 1136 verify(key: cryptoFramework.PubKey, callback: AsyncCallback<void>): void; 1137 1138 /** 1139 * Verify the X509 cert. 1140 * 1141 * @param { cryptoFramework.PubKey } key - public key to verify cert. 1142 * @returns { Promise<void> } the promise returned by the function. 1143 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1144 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1145 * @throws { BusinessError } 19030001 - crypto operation error. 1146 * @syscap SystemCapability.Security.Cert 1147 * @since 9 1148 */ 1149 /** 1150 * Verify the X509 cert. 1151 * 1152 * @param { cryptoFramework.PubKey } key - public key to verify cert. 1153 * @returns { Promise<void> } the promise returned by the function. 1154 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1155 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1156 * @throws { BusinessError } 19030001 - crypto operation error. 1157 * @syscap SystemCapability.Security.Cert 1158 * @crossplatform 1159 * @since 11 1160 */ 1161 /** 1162 * Verify the X509 cert. 1163 * 1164 * @param { cryptoFramework.PubKey } key - public key to verify cert. 1165 * @returns { Promise<void> } the promise returned by the function. 1166 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1167 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1168 * @throws { BusinessError } 19030001 - crypto operation error. 1169 * @syscap SystemCapability.Security.Cert 1170 * @crossplatform 1171 * @atomicservice 1172 * @since 12 1173 */ 1174 verify(key: cryptoFramework.PubKey): Promise<void>; 1175 1176 /** 1177 * Get X509 cert encoded data. 1178 * 1179 * @param { AsyncCallback<EncodingBlob> } callback - the callback of getEncoded. 1180 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1181 * <br>2. Incorrect parameter types; 1182 * @throws { BusinessError } 19020001 - memory malloc failed. 1183 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1184 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1185 * @throws { BusinessError } 19030001 - crypto operation error. 1186 * @syscap SystemCapability.Security.Cert 1187 * @since 9 1188 */ 1189 /** 1190 * Get X509 cert encoded data. 1191 * 1192 * @param { AsyncCallback<EncodingBlob> } callback - the callback of getEncoded. 1193 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1194 * <br>2. Incorrect parameter types; 1195 * @throws { BusinessError } 19020001 - memory malloc failed. 1196 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1197 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1198 * @throws { BusinessError } 19030001 - crypto operation error. 1199 * @syscap SystemCapability.Security.Cert 1200 * @crossplatform 1201 * @since 11 1202 */ 1203 /** 1204 * Get X509 cert encoded data. 1205 * 1206 * @param { AsyncCallback<EncodingBlob> } callback - the callback of getEncoded. 1207 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1208 * <br>2. Incorrect parameter types; 1209 * @throws { BusinessError } 19020001 - memory malloc failed. 1210 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1211 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1212 * @throws { BusinessError } 19030001 - crypto operation error. 1213 * @syscap SystemCapability.Security.Cert 1214 * @crossplatform 1215 * @atomicservice 1216 * @since 12 1217 */ 1218 getEncoded(callback: AsyncCallback<EncodingBlob>): void; 1219 1220 /** 1221 * Get X509 cert encoded data. 1222 * 1223 * @returns { Promise<EncodingBlob> } the promise of X509 cert encoded data. 1224 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1225 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1226 * @throws { BusinessError } 19020001 - memory malloc failed. 1227 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1228 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1229 * @throws { BusinessError } 19030001 - crypto operation error. 1230 * @syscap SystemCapability.Security.Cert 1231 * @since 9 1232 */ 1233 /** 1234 * Get X509 cert encoded data. 1235 * 1236 * @returns { Promise<EncodingBlob> } the promise of X509 cert encoded data. 1237 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1238 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1239 * @throws { BusinessError } 19020001 - memory malloc failed. 1240 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1241 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1242 * @throws { BusinessError } 19030001 - crypto operation error. 1243 * @syscap SystemCapability.Security.Cert 1244 * @crossplatform 1245 * @since 11 1246 */ 1247 /** 1248 * Get X509 cert encoded data. 1249 * 1250 * @returns { Promise<EncodingBlob> } the promise of X509 cert encoded data. 1251 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1252 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1253 * @throws { BusinessError } 19020001 - memory malloc failed. 1254 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1255 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1256 * @throws { BusinessError } 19030001 - crypto operation error. 1257 * @syscap SystemCapability.Security.Cert 1258 * @crossplatform 1259 * @atomicservice 1260 * @since 12 1261 */ 1262 getEncoded(): Promise<EncodingBlob>; 1263 1264 /** 1265 * Get X509 cert public key. 1266 * 1267 * @returns { cryptoFramework.PubKey } X509 cert pubKey. 1268 * @throws { BusinessError } 19020001 - memory malloc failed. 1269 * @throws { BusinessError } 19030001 - crypto operation error. 1270 * @syscap SystemCapability.Security.Cert 1271 * @since 9 1272 */ 1273 /** 1274 * Get X509 cert public key. 1275 * 1276 * @returns { cryptoFramework.PubKey } X509 cert pubKey. 1277 * @throws { BusinessError } 19020001 - memory malloc failed. 1278 * @throws { BusinessError } 19030001 - crypto operation error. 1279 * @syscap SystemCapability.Security.Cert 1280 * @crossplatform 1281 * @since 11 1282 */ 1283 /** 1284 * Get X509 cert public key. 1285 * 1286 * @returns { cryptoFramework.PubKey } X509 cert pubKey. 1287 * @throws { BusinessError } 19020001 - memory malloc failed. 1288 * @throws { BusinessError } 19030001 - crypto operation error. 1289 * @syscap SystemCapability.Security.Cert 1290 * @crossplatform 1291 * @atomicservice 1292 * @since 12 1293 */ 1294 getPublicKey(): cryptoFramework.PubKey; 1295 1296 /** 1297 * Check the X509 cert validity with date. 1298 * 1299 * @param { string } date - indicates the cert date. 1300 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1301 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1302 * @throws { BusinessError } 19020001 - memory malloc failed. 1303 * @throws { BusinessError } 19030001 - crypto operation error. 1304 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 1305 * @throws { BusinessError } 19030004 - the certificate has expired. 1306 * @syscap SystemCapability.Security.Cert 1307 * @since 9 1308 */ 1309 /** 1310 * Check the X509 cert validity with date. 1311 * 1312 * @param { string } date - indicates the cert date. 1313 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1314 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1315 * @throws { BusinessError } 19020001 - memory malloc failed. 1316 * @throws { BusinessError } 19030001 - crypto operation error. 1317 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 1318 * @throws { BusinessError } 19030004 - the certificate has expired. 1319 * @syscap SystemCapability.Security.Cert 1320 * @crossplatform 1321 * @since 11 1322 */ 1323 /** 1324 * Check the X509 cert validity with date. 1325 * 1326 * @param { string } date - indicates the cert date. 1327 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1328 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1329 * @throws { BusinessError } 19020001 - memory malloc failed. 1330 * @throws { BusinessError } 19030001 - crypto operation error. 1331 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 1332 * @throws { BusinessError } 19030004 - the certificate has expired. 1333 * @syscap SystemCapability.Security.Cert 1334 * @crossplatform 1335 * @atomicservice 1336 * @since 12 1337 */ 1338 checkValidityWithDate(date: string): void; 1339 1340 /** 1341 * Get X509 cert version. 1342 * 1343 * @returns { number } X509 cert version. 1344 * @syscap SystemCapability.Security.Cert 1345 * @since 9 1346 */ 1347 /** 1348 * Get X509 cert version. 1349 * 1350 * @returns { number } X509 cert version. 1351 * @syscap SystemCapability.Security.Cert 1352 * @crossplatform 1353 * @since 11 1354 */ 1355 /** 1356 * Get X509 cert version. 1357 * 1358 * @returns { number } X509 cert version. 1359 * @syscap SystemCapability.Security.Cert 1360 * @crossplatform 1361 * @atomicservice 1362 * @since 12 1363 */ 1364 getVersion(): number; 1365 1366 /** 1367 * Get X509 cert serial number. 1368 * 1369 * @returns { number } X509 cert serial number. 1370 * @syscap SystemCapability.Security.Cert 1371 * @since 9 1372 * @deprecated since 10 1373 * @useinstead ohos.security.cert.X509Cert.getCertSerialNumber 1374 */ 1375 getSerialNumber(): number; 1376 1377 /** 1378 * Get X509 cert serial number. 1379 * 1380 * @returns { bigint } X509 cert serial number. 1381 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1382 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1383 * @syscap SystemCapability.Security.Cert 1384 * @since 10 1385 */ 1386 /** 1387 * Get X509 cert serial number. 1388 * 1389 * @returns { bigint } X509 cert serial number. 1390 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1391 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1392 * @syscap SystemCapability.Security.Cert 1393 * @crossplatform 1394 * @since 11 1395 */ 1396 /** 1397 * Get X509 cert serial number. 1398 * 1399 * @returns { bigint } X509 cert serial number. 1400 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1401 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1402 * @syscap SystemCapability.Security.Cert 1403 * @crossplatform 1404 * @atomicservice 1405 * @since 12 1406 */ 1407 getCertSerialNumber(): bigint; 1408 1409 /** 1410 * Get X509 cert issuer name. 1411 * 1412 * @returns { DataBlob } X509 cert issuer name. 1413 * @throws { BusinessError } 19020001 - memory malloc failed. 1414 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1415 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1416 * @throws { BusinessError } 19030001 - crypto operation error. 1417 * @syscap SystemCapability.Security.Cert 1418 * @since 9 1419 */ 1420 /** 1421 * Get X509 cert issuer name. 1422 * 1423 * @returns { DataBlob } X509 cert issuer name. 1424 * @throws { BusinessError } 19020001 - memory malloc failed. 1425 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1426 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1427 * @throws { BusinessError } 19030001 - crypto operation error. 1428 * @syscap SystemCapability.Security.Cert 1429 * @crossplatform 1430 * @since 11 1431 */ 1432 /** 1433 * Get X509 cert issuer name. 1434 * 1435 * @returns { DataBlob } X509 cert issuer name. 1436 * @throws { BusinessError } 19020001 - memory malloc failed. 1437 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1438 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1439 * @throws { BusinessError } 19030001 - crypto operation error. 1440 * @syscap SystemCapability.Security.Cert 1441 * @crossplatform 1442 * @atomicservice 1443 * @since 12 1444 */ 1445 getIssuerName(): DataBlob; 1446 1447 /** 1448 * Get X509 cert issuer name according to the encoding type. 1449 * 1450 * @param { EncodingType } encodingType indicates the encoding type. 1451 * @returns { string } X509 cert issuer name. 1452 * @throws { BusinessError } 19020001 - memory malloc failed. 1453 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1454 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1455 * @throws { BusinessError } 19020003 - parameter check failed. Possible causes: 1456 * <br>1. The value of encodingType is not in the EncodingType enumeration range. 1457 * @throws { BusinessError } 19030001 - crypto operation error. 1458 * @syscap SystemCapability.Security.Cert 1459 * @crossplatform 1460 * @atomicservice 1461 * @since 20 1462 */ 1463 getIssuerName(encodingType: EncodingType): string; 1464 1465 /** 1466 * Get X509 cert subject name. 1467 * 1468 * @returns { DataBlob } X509 cert subject name. 1469 * @throws { BusinessError } 19020001 - memory malloc failed. 1470 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1471 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1472 * @throws { BusinessError } 19030001 - crypto operation error. 1473 * @syscap SystemCapability.Security.Cert 1474 * @since 9 1475 */ 1476 /** 1477 * Get X509 cert subject name. 1478 * 1479 * @returns { DataBlob } X509 cert subject name. 1480 * @throws { BusinessError } 19020001 - memory malloc failed. 1481 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1482 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1483 * @throws { BusinessError } 19030001 - crypto operation error. 1484 * @syscap SystemCapability.Security.Cert 1485 * @crossplatform 1486 * @since 11 1487 */ 1488 /** 1489 * Get X509 cert subject name. 1490 * 1491 * @param { EncodingType } [encodingType] indicates the encoding type, if the encoding type parameter is not set, 1492 * the default ASCII encoding is used. 1493 * @returns { DataBlob } X509 cert subject name. 1494 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Incorrect parameter types; 1495 * <br>2. Parameter verification failed. 1496 * @throws { BusinessError } 19020001 - memory malloc failed. 1497 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1498 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1499 * @throws { BusinessError } 19030001 - crypto operation error. 1500 * @syscap SystemCapability.Security.Cert 1501 * @crossplatform 1502 * @atomicservice 1503 * @since 12 1504 */ 1505 getSubjectName(encodingType?: EncodingType): DataBlob; 1506 1507 /** 1508 * Get X509 cert not before time. 1509 * 1510 * @returns { string } X509 cert not before time. 1511 * @throws { BusinessError } 19020001 - memory malloc failed. 1512 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1513 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1514 * @throws { BusinessError } 19030001 - crypto operation error. 1515 * @syscap SystemCapability.Security.Cert 1516 * @since 9 1517 */ 1518 /** 1519 * Get X509 cert not before time. 1520 * 1521 * @returns { string } X509 cert not before time. 1522 * @throws { BusinessError } 19020001 - memory malloc failed. 1523 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1524 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1525 * @throws { BusinessError } 19030001 - crypto operation error. 1526 * @syscap SystemCapability.Security.Cert 1527 * @crossplatform 1528 * @since 11 1529 */ 1530 /** 1531 * Get X509 cert not before time. 1532 * 1533 * @returns { string } X509 cert not before time. 1534 * @throws { BusinessError } 19020001 - memory malloc failed. 1535 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1536 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1537 * @throws { BusinessError } 19030001 - crypto operation error. 1538 * @syscap SystemCapability.Security.Cert 1539 * @crossplatform 1540 * @atomicservice 1541 * @since 12 1542 */ 1543 getNotBeforeTime(): string; 1544 1545 /** 1546 * Get X509 cert not after time. 1547 * 1548 * @returns { string } X509 cert not after time. 1549 * @throws { BusinessError } 19020001 - memory malloc failed. 1550 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1551 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1552 * @throws { BusinessError } 19030001 - crypto operation error. 1553 * @syscap SystemCapability.Security.Cert 1554 * @since 9 1555 */ 1556 /** 1557 * Get X509 cert not after time. 1558 * 1559 * @returns { string } X509 cert not after time. 1560 * @throws { BusinessError } 19020001 - memory malloc failed. 1561 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1562 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1563 * @throws { BusinessError } 19030001 - crypto operation error. 1564 * @syscap SystemCapability.Security.Cert 1565 * @crossplatform 1566 * @since 11 1567 */ 1568 /** 1569 * Get X509 cert not after time. 1570 * 1571 * @returns { string } X509 cert not after time. 1572 * @throws { BusinessError } 19020001 - memory malloc failed. 1573 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1574 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1575 * @throws { BusinessError } 19030001 - crypto operation error. 1576 * @syscap SystemCapability.Security.Cert 1577 * @crossplatform 1578 * @atomicservice 1579 * @since 12 1580 */ 1581 getNotAfterTime(): string; 1582 1583 /** 1584 * Get X509 cert signature. 1585 * 1586 * @returns { DataBlob } X509 cert signature. 1587 * @throws { BusinessError } 19020001 - memory malloc failed. 1588 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1589 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1590 * @throws { BusinessError } 19030001 - crypto operation error. 1591 * @syscap SystemCapability.Security.Cert 1592 * @since 9 1593 */ 1594 /** 1595 * Get X509 cert signature. 1596 * 1597 * @returns { DataBlob } X509 cert signature. 1598 * @throws { BusinessError } 19020001 - memory malloc failed. 1599 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1600 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1601 * @throws { BusinessError } 19030001 - crypto operation error. 1602 * @syscap SystemCapability.Security.Cert 1603 * @crossplatform 1604 * @since 11 1605 */ 1606 /** 1607 * Get X509 cert signature. 1608 * 1609 * @returns { DataBlob } X509 cert signature. 1610 * @throws { BusinessError } 19020001 - memory malloc failed. 1611 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1612 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1613 * @throws { BusinessError } 19030001 - crypto operation error. 1614 * @syscap SystemCapability.Security.Cert 1615 * @crossplatform 1616 * @atomicservice 1617 * @since 12 1618 */ 1619 getSignature(): DataBlob; 1620 1621 /** 1622 * Get X509 cert signature's algorithm name. 1623 * 1624 * @returns { string } X509 cert signature's algorithm name. 1625 * @throws { BusinessError } 19020001 - memory malloc failed. 1626 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1627 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1628 * @throws { BusinessError } 19030001 - crypto operation error. 1629 * @syscap SystemCapability.Security.Cert 1630 * @since 9 1631 */ 1632 /** 1633 * Get X509 cert signature's algorithm name. 1634 * 1635 * @returns { string } X509 cert signature's algorithm name. 1636 * @throws { BusinessError } 19020001 - memory malloc failed. 1637 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1638 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1639 * @throws { BusinessError } 19030001 - crypto operation error. 1640 * @syscap SystemCapability.Security.Cert 1641 * @crossplatform 1642 * @since 11 1643 */ 1644 /** 1645 * Get X509 cert signature's algorithm name. 1646 * 1647 * @returns { string } X509 cert signature's algorithm name. 1648 * @throws { BusinessError } 19020001 - memory malloc failed. 1649 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1650 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1651 * @throws { BusinessError } 19030001 - crypto operation error. 1652 * @syscap SystemCapability.Security.Cert 1653 * @crossplatform 1654 * @atomicservice 1655 * @since 12 1656 */ 1657 getSignatureAlgName(): string; 1658 1659 /** 1660 * Get X509 cert signature's algorithm oid. 1661 * 1662 * @returns { string } X509 cert signature's algorithm oid. 1663 * @throws { BusinessError } 19020001 - memory malloc failed. 1664 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1665 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1666 * @throws { BusinessError } 19030001 - crypto operation error. 1667 * @syscap SystemCapability.Security.Cert 1668 * @since 9 1669 */ 1670 /** 1671 * Get X509 cert signature's algorithm oid. 1672 * 1673 * @returns { string } X509 cert signature's algorithm oid. 1674 * @throws { BusinessError } 19020001 - memory malloc failed. 1675 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1676 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1677 * @throws { BusinessError } 19030001 - crypto operation error. 1678 * @syscap SystemCapability.Security.Cert 1679 * @crossplatform 1680 * @since 11 1681 */ 1682 /** 1683 * Get X509 cert signature's algorithm oid. 1684 * 1685 * @returns { string } X509 cert signature's algorithm oid. 1686 * @throws { BusinessError } 19020001 - memory malloc failed. 1687 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1688 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1689 * @throws { BusinessError } 19030001 - crypto operation error. 1690 * @syscap SystemCapability.Security.Cert 1691 * @crossplatform 1692 * @atomicservice 1693 * @since 12 1694 */ 1695 getSignatureAlgOid(): string; 1696 1697 /** 1698 * Get X509 cert signature's algorithm name. 1699 * 1700 * @returns { DataBlob } X509 cert signature's algorithm name. 1701 * @throws { BusinessError } 801 - this operation is not supported. 1702 * @throws { BusinessError } 19020001 - memory malloc failed. 1703 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1704 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1705 * @throws { BusinessError } 19030001 - crypto operation error. 1706 * @syscap SystemCapability.Security.Cert 1707 * @since 9 1708 */ 1709 /** 1710 * Get X509 cert signature's algorithm name. 1711 * 1712 * @returns { DataBlob } X509 cert signature's algorithm name. 1713 * @throws { BusinessError } 801 - this operation is not supported. 1714 * @throws { BusinessError } 19020001 - memory malloc failed. 1715 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1716 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1717 * @throws { BusinessError } 19030001 - crypto operation error. 1718 * @syscap SystemCapability.Security.Cert 1719 * @crossplatform 1720 * @since 11 1721 */ 1722 /** 1723 * Get X509 cert signature's algorithm name. 1724 * 1725 * @returns { DataBlob } X509 cert signature's algorithm name. 1726 * @throws { BusinessError } 801 - this operation is not supported. 1727 * @throws { BusinessError } 19020001 - memory malloc failed. 1728 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1729 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1730 * @throws { BusinessError } 19030001 - crypto operation error. 1731 * @syscap SystemCapability.Security.Cert 1732 * @crossplatform 1733 * @atomicservice 1734 * @since 12 1735 */ 1736 getSignatureAlgParams(): DataBlob; 1737 1738 /** 1739 * Get X509 cert key usage. 1740 * 1741 * @returns { DataBlob } X509 cert key usage. 1742 * @throws { BusinessError } 19020001 - memory malloc failed. 1743 * @throws { BusinessError } 19030001 - crypto operation error. 1744 * @syscap SystemCapability.Security.Cert 1745 * @since 9 1746 */ 1747 /** 1748 * Get X509 cert key usage. 1749 * 1750 * @returns { DataBlob } X509 cert key usage. 1751 * @throws { BusinessError } 19020001 - memory malloc failed. 1752 * @throws { BusinessError } 19030001 - crypto operation error. 1753 * @syscap SystemCapability.Security.Cert 1754 * @crossplatform 1755 * @since 11 1756 */ 1757 /** 1758 * Get X509 cert key usage. 1759 * 1760 * @returns { DataBlob } X509 cert key usage. 1761 * @throws { BusinessError } 19020001 - memory malloc failed. 1762 * @throws { BusinessError } 19030001 - crypto operation error. 1763 * @syscap SystemCapability.Security.Cert 1764 * @crossplatform 1765 * @atomicservice 1766 * @since 12 1767 */ 1768 getKeyUsage(): DataBlob; 1769 1770 /** 1771 * Get X509 cert extended key usage. 1772 * 1773 * @returns { DataArray } X509 cert extended key usage. 1774 * @throws { BusinessError } 19020001 - memory malloc failed. 1775 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1776 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1777 * @throws { BusinessError } 19030001 - crypto operation error. 1778 * @syscap SystemCapability.Security.Cert 1779 * @since 9 1780 */ 1781 /** 1782 * Get X509 cert extended key usage. 1783 * 1784 * @returns { DataArray } X509 cert extended key usage. 1785 * @throws { BusinessError } 19020001 - memory malloc failed. 1786 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1787 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1788 * @throws { BusinessError } 19030001 - crypto operation error. 1789 * @syscap SystemCapability.Security.Cert 1790 * @crossplatform 1791 * @since 11 1792 */ 1793 /** 1794 * Get X509 cert extended key usage. 1795 * 1796 * @returns { DataArray } X509 cert extended key usage. 1797 * @throws { BusinessError } 19020001 - memory malloc failed. 1798 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1799 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1800 * @throws { BusinessError } 19030001 - crypto operation error. 1801 * @syscap SystemCapability.Security.Cert 1802 * @crossplatform 1803 * @atomicservice 1804 * @since 12 1805 */ 1806 getExtKeyUsage(): DataArray; 1807 1808 /** 1809 * Get X509 cert basic constraints path len. 1810 * 1811 * @returns { number } X509 cert basic constraints path len. 1812 * @syscap SystemCapability.Security.Cert 1813 * @since 9 1814 */ 1815 /** 1816 * Get X509 cert basic constraints path len. 1817 * 1818 * @returns { number } X509 cert basic constraints path len. 1819 * @syscap SystemCapability.Security.Cert 1820 * @crossplatform 1821 * @since 11 1822 */ 1823 /** 1824 * Get X509 cert basic constraints path len. 1825 * 1826 * @returns { number } X509 cert basic constraints path len. 1827 * @syscap SystemCapability.Security.Cert 1828 * @crossplatform 1829 * @atomicservice 1830 * @since 12 1831 */ 1832 getBasicConstraints(): number; 1833 1834 /** 1835 * Get X509 cert subject alternative name. 1836 * 1837 * @returns { DataArray } X509 cert subject alternative name. 1838 * @throws { BusinessError } 19020001 - memory malloc failed. 1839 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1840 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1841 * @throws { BusinessError } 19030001 - crypto operation error. 1842 * @syscap SystemCapability.Security.Cert 1843 * @since 9 1844 */ 1845 /** 1846 * Get X509 cert subject alternative name. 1847 * 1848 * @returns { DataArray } X509 cert subject alternative name. 1849 * @throws { BusinessError } 19020001 - memory malloc failed. 1850 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1851 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1852 * @throws { BusinessError } 19030001 - crypto operation error. 1853 * @syscap SystemCapability.Security.Cert 1854 * @crossplatform 1855 * @since 11 1856 */ 1857 /** 1858 * Get X509 cert subject alternative name. 1859 * 1860 * @returns { DataArray } X509 cert subject alternative name. 1861 * @throws { BusinessError } 19020001 - memory malloc failed. 1862 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1863 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1864 * @throws { BusinessError } 19030001 - crypto operation error. 1865 * @syscap SystemCapability.Security.Cert 1866 * @crossplatform 1867 * @atomicservice 1868 * @since 12 1869 */ 1870 getSubjectAltNames(): DataArray; 1871 1872 /** 1873 * Get X509 cert issuer alternative name. 1874 * 1875 * @returns { DataArray } X509 cert issuer alternative name. 1876 * @throws { BusinessError } 19020001 - memory malloc failed. 1877 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1878 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1879 * @throws { BusinessError } 19030001 - crypto operation error. 1880 * @syscap SystemCapability.Security.Cert 1881 * @since 9 1882 */ 1883 /** 1884 * Get X509 cert issuer alternative name. 1885 * 1886 * @returns { DataArray } X509 cert issuer alternative name. 1887 * @throws { BusinessError } 19020001 - memory malloc failed. 1888 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1889 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1890 * @throws { BusinessError } 19030001 - crypto operation error. 1891 * @syscap SystemCapability.Security.Cert 1892 * @crossplatform 1893 * @since 11 1894 */ 1895 /** 1896 * Get X509 cert issuer alternative name. 1897 * 1898 * @returns { DataArray } X509 cert issuer alternative name. 1899 * @throws { BusinessError } 19020001 - memory malloc failed. 1900 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1901 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1902 * @throws { BusinessError } 19030001 - crypto operation error. 1903 * @syscap SystemCapability.Security.Cert 1904 * @crossplatform 1905 * @atomicservice 1906 * @since 12 1907 */ 1908 getIssuerAltNames(): DataArray; 1909 1910 /** 1911 * Get certificate item value. 1912 * 1913 * @param { CertItemType } itemType 1914 * @returns { DataBlob } cert item value. 1915 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1916 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1917 * @throws { BusinessError } 19020001 - memory malloc failed. 1918 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1919 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1920 * @throws { BusinessError } 19030001 - crypto operation error. 1921 * @syscap SystemCapability.Security.Cert 1922 * @since 10 1923 */ 1924 /** 1925 * Get certificate item value. 1926 * 1927 * @param { CertItemType } itemType 1928 * @returns { DataBlob } cert item value. 1929 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1930 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1931 * @throws { BusinessError } 19020001 - memory malloc failed. 1932 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1933 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1934 * @throws { BusinessError } 19030001 - crypto operation error. 1935 * @syscap SystemCapability.Security.Cert 1936 * @crossplatform 1937 * @since 11 1938 */ 1939 /** 1940 * Get certificate item value. 1941 * 1942 * @param { CertItemType } itemType 1943 * @returns { DataBlob } cert item value. 1944 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1945 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1946 * @throws { BusinessError } 19020001 - memory malloc failed. 1947 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1948 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1949 * @throws { BusinessError } 19030001 - crypto operation error. 1950 * @syscap SystemCapability.Security.Cert 1951 * @crossplatform 1952 * @atomicservice 1953 * @since 12 1954 */ 1955 getItem(itemType: CertItemType): DataBlob; 1956 1957 /** 1958 * Check the X509 cert if match the parameters. 1959 * 1960 * @param { X509CertMatchParameters } param - indicate the match parameters. 1961 * @returns { boolean } true - match X509Cert, false - not match. 1962 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1963 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1964 * @throws { BusinessError } 19020001 - memory malloc failed. 1965 * @throws { BusinessError } 19030001 - crypto operation error. 1966 * @syscap SystemCapability.Security.Cert 1967 * @crossplatform 1968 * @since 11 1969 */ 1970 /** 1971 * Check the X509 cert if match the parameters. 1972 * 1973 * @param { X509CertMatchParameters } param - indicate the match parameters. 1974 * @returns { boolean } true - match X509Cert, false - not match. 1975 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 1976 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1977 * @throws { BusinessError } 19020001 - memory malloc failed. 1978 * @throws { BusinessError } 19030001 - crypto operation error. 1979 * @syscap SystemCapability.Security.Cert 1980 * @crossplatform 1981 * @atomicservice 1982 * @since 12 1983 */ 1984 match(param: X509CertMatchParameters): boolean; 1985 1986 /** 1987 * Obtain CRL distribution points. 1988 * 1989 * @returns { DataArray } X509 cert CRL distribution points. 1990 * @throws { BusinessError } 19020001 - memory malloc failed. 1991 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 1992 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 1993 * @throws { BusinessError } 19030001 - crypto operation error. 1994 * @syscap SystemCapability.Security.Cert 1995 * @crossplatform 1996 * @atomicservice 1997 * @since 12 1998 */ 1999 getCRLDistributionPoint(): DataArray; 2000 2001 /** 2002 * Get X500 distinguished name of the issuer. 2003 * 2004 * @returns { X500DistinguishedName } X500 distinguished name object. 2005 * @throws { BusinessError } 19020001 - memory malloc failed. 2006 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2007 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2008 * @throws { BusinessError } 19030001 - crypto operation error. 2009 * @syscap SystemCapability.Security.Cert 2010 * @crossplatform 2011 * @atomicservice 2012 * @since 12 2013 */ 2014 getIssuerX500DistinguishedName(): X500DistinguishedName; 2015 2016 /** 2017 * Get X500 distinguished name of the subject. 2018 * 2019 * @returns { X500DistinguishedName } X500 distinguished name object. 2020 * @throws { BusinessError } 19020001 - memory malloc failed. 2021 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2022 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2023 * @throws { BusinessError } 19030001 - crypto operation error. 2024 * @syscap SystemCapability.Security.Cert 2025 * @crossplatform 2026 * @atomicservice 2027 * @since 12 2028 */ 2029 getSubjectX500DistinguishedName(): X500DistinguishedName; 2030 2031 /** 2032 * Get the string type data of the object. 2033 * 2034 * @returns { string } the string type data of the object. 2035 * @throws { BusinessError } 19020001 - memory malloc failed. 2036 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2037 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2038 * @throws { BusinessError } 19030001 - crypto operation error. 2039 * @syscap SystemCapability.Security.Cert 2040 * @crossplatform 2041 * @atomicservice 2042 * @since 12 2043 */ 2044 toString(): string; 2045 2046 /** 2047 * Get the string type data of the object according to the encoding type. 2048 * 2049 * @param { EncodingType } encodingType indicates the encoding type. 2050 * @returns { string } the string type data of the object. 2051 * @throws { BusinessError } 19020001 - memory malloc failed. 2052 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2053 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2054 * @throws { BusinessError } 19020003 - parameter check failed. Possible causes: 2055 * <br>1. The value of encodingType is not in the EncodingType enumeration range. 2056 * @throws { BusinessError } 19030001 - crypto operation error. 2057 * @syscap SystemCapability.Security.Cert 2058 * @crossplatform 2059 * @atomicservice 2060 * @since 20 2061 */ 2062 toString(encodingType: EncodingType): string; 2063 2064 /** 2065 * Get the hash value of DER format data. 2066 * 2067 * @returns { Uint8Array } the hash value of DER format data. 2068 * @throws { BusinessError } 19020001 - memory malloc failed. 2069 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2070 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2071 * @throws { BusinessError } 19030001 - crypto operation error. 2072 * @syscap SystemCapability.Security.Cert 2073 * @crossplatform 2074 * @atomicservice 2075 * @since 12 2076 */ 2077 hashCode(): Uint8Array; 2078 2079 /** 2080 * Get the extension der encoding data for the corresponding entity. 2081 * 2082 * @returns { CertExtension } the certExtension object. 2083 * @throws { BusinessError } 19020001 - memory malloc failed. 2084 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2085 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2086 * @throws { BusinessError } 19030001 - crypto operation error. 2087 * @syscap SystemCapability.Security.Cert 2088 * @crossplatform 2089 * @atomicservice 2090 * @since 12 2091 */ 2092 getExtensionsObject(): CertExtension; 2093 } 2094 2095 /** 2096 * Provides to create X509 certificate object. 2097 * The returned object provides the data parsing or verification capability. 2098 * 2099 * @param { EncodingBlob } inStream - indicate the input cert data. 2100 * @param { AsyncCallback<X509Cert> } callback - the callback of createX509Cert. 2101 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2102 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2103 * @throws { BusinessError } 801 - this operation is not supported. 2104 * @throws { BusinessError } 19020001 - memory malloc failed. 2105 * @throws { BusinessError } 19030001 - crypto operation error. 2106 * @syscap SystemCapability.Security.Cert 2107 * @since 9 2108 */ 2109 /** 2110 * Provides to create X509 certificate object. 2111 * The returned object provides the data parsing or verification capability. 2112 * 2113 * @param { EncodingBlob } inStream - indicate the input cert data. 2114 * @param { AsyncCallback<X509Cert> } callback - the callback of createX509Cert. 2115 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2116 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2117 * @throws { BusinessError } 801 - this operation is not supported. 2118 * @throws { BusinessError } 19020001 - memory malloc failed. 2119 * @throws { BusinessError } 19030001 - crypto operation error. 2120 * @syscap SystemCapability.Security.Cert 2121 * @crossplatform 2122 * @since 11 2123 */ 2124 /** 2125 * Provides to create X509 certificate object. 2126 * The returned object provides the data parsing or verification capability. 2127 * 2128 * @param { EncodingBlob } inStream - indicate the input cert data. 2129 * @param { AsyncCallback<X509Cert> } callback - the callback of createX509Cert. 2130 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2131 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2132 * @throws { BusinessError } 801 - this operation is not supported. 2133 * @throws { BusinessError } 19020001 - memory malloc failed. 2134 * @throws { BusinessError } 19030001 - crypto operation error. 2135 * @syscap SystemCapability.Security.Cert 2136 * @crossplatform 2137 * @atomicservice 2138 * @since 12 2139 */ 2140 function createX509Cert(inStream: EncodingBlob, callback: AsyncCallback<X509Cert>): void; 2141 2142 /** 2143 * Provides to create X509 certificate object. 2144 * The returned object provides the data parsing or verification capability. 2145 * 2146 * @param { EncodingBlob } inStream - indicate the input cert data. 2147 * @returns { Promise<X509Cert> } the promise of X509 cert instance. 2148 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2149 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2150 * @throws { BusinessError } 801 - this operation is not supported. 2151 * @throws { BusinessError } 19020001 - memory malloc failed. 2152 * @throws { BusinessError } 19030001 - crypto operation error. 2153 * @syscap SystemCapability.Security.Cert 2154 * @since 9 2155 */ 2156 /** 2157 * Provides to create X509 certificate object. 2158 * The returned object provides the data parsing or verification capability. 2159 * 2160 * @param { EncodingBlob } inStream - indicate the input cert data. 2161 * @returns { Promise<X509Cert> } the promise of X509 cert instance. 2162 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2163 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2164 * @throws { BusinessError } 801 - this operation is not supported. 2165 * @throws { BusinessError } 19020001 - memory malloc failed. 2166 * @throws { BusinessError } 19030001 - crypto operation error. 2167 * @syscap SystemCapability.Security.Cert 2168 * @crossplatform 2169 * @since 11 2170 */ 2171 /** 2172 * Provides to create X509 certificate object. 2173 * The returned object provides the data parsing or verification capability. 2174 * 2175 * @param { EncodingBlob } inStream - indicate the input cert data. 2176 * @returns { Promise<X509Cert> } the promise of X509 cert instance. 2177 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2178 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2179 * @throws { BusinessError } 801 - this operation is not supported. 2180 * @throws { BusinessError } 19020001 - memory malloc failed. 2181 * @throws { BusinessError } 19030001 - crypto operation error. 2182 * @syscap SystemCapability.Security.Cert 2183 * @crossplatform 2184 * @atomicservice 2185 * @since 12 2186 */ 2187 function createX509Cert(inStream: EncodingBlob): Promise<X509Cert>; 2188 2189 /** 2190 * The CertExtension interface is used to parse and verify certificate extension. 2191 * 2192 * @typedef CertExtension 2193 * @syscap SystemCapability.Security.Cert 2194 * @since 10 2195 */ 2196 /** 2197 * The CertExtension interface is used to parse and verify certificate extension. 2198 * 2199 * @typedef CertExtension 2200 * @syscap SystemCapability.Security.Cert 2201 * @crossplatform 2202 * @since 11 2203 */ 2204 /** 2205 * The CertExtension interface is used to parse and verify certificate extension. 2206 * 2207 * @typedef CertExtension 2208 * @syscap SystemCapability.Security.Cert 2209 * @crossplatform 2210 * @atomicservice 2211 * @since 12 2212 */ 2213 interface CertExtension { 2214 /** 2215 * Get certificate extension encoded data. 2216 * 2217 * @returns { EncodingBlob } cert extension encoded data. 2218 * @throws { BusinessError } 19020001 - memory malloc failed. 2219 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2220 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2221 * @throws { BusinessError } 19030001 - crypto operation error. 2222 * @syscap SystemCapability.Security.Cert 2223 * @since 10 2224 */ 2225 /** 2226 * Get certificate extension encoded data. 2227 * 2228 * @returns { EncodingBlob } cert extension encoded data. 2229 * @throws { BusinessError } 19020001 - memory malloc failed. 2230 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2231 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2232 * @throws { BusinessError } 19030001 - crypto operation error. 2233 * @syscap SystemCapability.Security.Cert 2234 * @crossplatform 2235 * @since 11 2236 */ 2237 /** 2238 * Get certificate extension encoded data. 2239 * 2240 * @returns { EncodingBlob } cert extension encoded data. 2241 * @throws { BusinessError } 19020001 - memory malloc failed. 2242 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2243 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2244 * @throws { BusinessError } 19030001 - crypto operation error. 2245 * @syscap SystemCapability.Security.Cert 2246 * @crossplatform 2247 * @atomicservice 2248 * @since 12 2249 */ 2250 getEncoded(): EncodingBlob; 2251 2252 /** 2253 * Get certificate extension oid list. 2254 * 2255 * @param { ExtensionOidType } valueType 2256 * @returns { DataArray } cert extension OID list value. 2257 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2258 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2259 * @throws { BusinessError } 19020001 - memory malloc failed. 2260 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2261 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2262 * @throws { BusinessError } 19030001 - crypto operation error. 2263 * @syscap SystemCapability.Security.Cert 2264 * @since 10 2265 */ 2266 /** 2267 * Get certificate extension oid list. 2268 * 2269 * @param { ExtensionOidType } valueType 2270 * @returns { DataArray } cert extension OID list value. 2271 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2272 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2273 * @throws { BusinessError } 19020001 - memory malloc failed. 2274 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2275 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2276 * @throws { BusinessError } 19030001 - crypto operation error. 2277 * @syscap SystemCapability.Security.Cert 2278 * @crossplatform 2279 * @since 11 2280 */ 2281 /** 2282 * Get certificate extension oid list. 2283 * 2284 * @param { ExtensionOidType } valueType 2285 * @returns { DataArray } cert extension OID list value. 2286 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2287 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2288 * @throws { BusinessError } 19020001 - memory malloc failed. 2289 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2290 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2291 * @throws { BusinessError } 19030001 - crypto operation error. 2292 * @syscap SystemCapability.Security.Cert 2293 * @crossplatform 2294 * @atomicservice 2295 * @since 12 2296 */ 2297 getOidList(valueType: ExtensionOidType): DataArray; 2298 2299 /** 2300 * Get certificate extension entry. 2301 * 2302 * @param { ExtensionEntryType } valueType 2303 * @param { DataBlob } oid 2304 * @returns { DataBlob } cert extension entry value. 2305 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2306 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2307 * @throws { BusinessError } 19020001 - memory malloc failed. 2308 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2309 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2310 * @throws { BusinessError } 19030001 - crypto operation error. 2311 * @syscap SystemCapability.Security.Cert 2312 * @since 10 2313 */ 2314 /** 2315 * Get certificate extension entry. 2316 * 2317 * @param { ExtensionEntryType } valueType 2318 * @param { DataBlob } oid 2319 * @returns { DataBlob } cert extension entry value. 2320 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2321 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2322 * @throws { BusinessError } 19020001 - memory malloc failed. 2323 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2324 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2325 * @throws { BusinessError } 19030001 - crypto operation error. 2326 * @syscap SystemCapability.Security.Cert 2327 * @crossplatform 2328 * @since 11 2329 */ 2330 /** 2331 * Get certificate extension entry. 2332 * 2333 * @param { ExtensionEntryType } valueType 2334 * @param { DataBlob } oid 2335 * @returns { DataBlob } cert extension entry value. 2336 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2337 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2338 * @throws { BusinessError } 19020001 - memory malloc failed. 2339 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2340 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2341 * @throws { BusinessError } 19030001 - crypto operation error. 2342 * @syscap SystemCapability.Security.Cert 2343 * @crossplatform 2344 * @atomicservice 2345 * @since 12 2346 */ 2347 getEntry(valueType: ExtensionEntryType, oid: DataBlob): DataBlob; 2348 2349 /** 2350 * Check whether the certificate is a CA(The keyusage contains signature usage and the value of cA in BasicConstraints is true). 2351 * If not a CA, return -1, otherwise return the path length constraint in BasicConstraints. 2352 * If the certificate is a CA and the path length constraint does not appear, then return -2 to indicate that there is no limit to path length. 2353 * 2354 * @returns { number } path length constraint. 2355 * @throws { BusinessError } 19020001 - memory malloc failed. 2356 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2357 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2358 * @throws { BusinessError } 19030001 - crypto operation error. 2359 * @syscap SystemCapability.Security.Cert 2360 * @since 10 2361 */ 2362 /** 2363 * Check whether the certificate is a CA(The keyusage contains signature usage and the value of cA in BasicConstraints is true). 2364 * If not a CA, return -1, otherwise return the path length constraint in BasicConstraints. 2365 * If the certificate is a CA and the path length constraint does not appear, then return -2 to indicate that there is no limit to path length. 2366 * 2367 * @returns { number } path length constraint. 2368 * @throws { BusinessError } 19020001 - memory malloc failed. 2369 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2370 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2371 * @throws { BusinessError } 19030001 - crypto operation error. 2372 * @syscap SystemCapability.Security.Cert 2373 * @crossplatform 2374 * @since 11 2375 */ 2376 /** 2377 * Check whether the certificate is a CA(The keyusage contains signature usage and the value of cA in BasicConstraints is true). 2378 * If not a CA, return -1, otherwise return the path length constraint in BasicConstraints. 2379 * If the certificate is a CA and the path length constraint does not appear, then return -2 to indicate that there is no limit to path length. 2380 * 2381 * @returns { number } path length constraint. 2382 * @throws { BusinessError } 19020001 - memory malloc failed. 2383 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2384 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2385 * @throws { BusinessError } 19030001 - crypto operation error. 2386 * @syscap SystemCapability.Security.Cert 2387 * @crossplatform 2388 * @atomicservice 2389 * @since 12 2390 */ 2391 checkCA(): number; 2392 2393 /** 2394 * Check if exists Unsupported critical extension. 2395 * 2396 * @returns { boolean } true - exists unsupported critical extension, false - else. 2397 * @throws { BusinessError } 19020001 - memory malloc failed. 2398 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2399 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2400 * @throws { BusinessError } 19030001 - crypto operation error. 2401 * @syscap SystemCapability.Security.Cert 2402 * @crossplatform 2403 * @since 11 2404 */ 2405 /** 2406 * Check if exists Unsupported critical extension. 2407 * 2408 * @returns { boolean } true - exists unsupported critical extension, false - else. 2409 * @throws { BusinessError } 19020001 - memory malloc failed. 2410 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2411 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2412 * @throws { BusinessError } 19030001 - crypto operation error. 2413 * @syscap SystemCapability.Security.Cert 2414 * @crossplatform 2415 * @atomicservice 2416 * @since 12 2417 */ 2418 hasUnsupportedCriticalExtension(): boolean; 2419 } 2420 2421 /** 2422 * Provides to create certificate extension object. 2423 * The returned object provides the data parsing or verification capability. 2424 * 2425 * @param { EncodingBlob } inStream - indicate the input cert extensions data. 2426 * @param { AsyncCallback<CertExtension> } callback - the callback of of certificate extension instance. 2427 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2428 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2429 * @throws { BusinessError } 801 - this operation is not supported. 2430 * @throws { BusinessError } 19020001 - memory malloc failed. 2431 * @throws { BusinessError } 19030001 - crypto operation error. 2432 * @syscap SystemCapability.Security.Cert 2433 * @since 10 2434 */ 2435 /** 2436 * Provides to create certificate extension object. 2437 * The returned object provides the data parsing or verification capability. 2438 * 2439 * @param { EncodingBlob } inStream - indicate the input cert extensions data. 2440 * @param { AsyncCallback<CertExtension> } callback - the callback of of certificate extension instance. 2441 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2442 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2443 * @throws { BusinessError } 801 - this operation is not supported. 2444 * @throws { BusinessError } 19020001 - memory malloc failed. 2445 * @throws { BusinessError } 19030001 - crypto operation error. 2446 * @syscap SystemCapability.Security.Cert 2447 * @crossplatform 2448 * @since 11 2449 */ 2450 /** 2451 * Provides to create certificate extension object. 2452 * The returned object provides the data parsing or verification capability. 2453 * 2454 * @param { EncodingBlob } inStream - indicate the input cert extensions data. 2455 * @param { AsyncCallback<CertExtension> } callback - the callback of of certificate extension instance. 2456 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2457 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2458 * @throws { BusinessError } 801 - this operation is not supported. 2459 * @throws { BusinessError } 19020001 - memory malloc failed. 2460 * @throws { BusinessError } 19030001 - crypto operation error. 2461 * @syscap SystemCapability.Security.Cert 2462 * @crossplatform 2463 * @atomicservice 2464 * @since 12 2465 */ 2466 function createCertExtension(inStream: EncodingBlob, callback: AsyncCallback<CertExtension>): void; 2467 2468 /** 2469 * Provides to create certificate extension object. 2470 * The returned object provides the data parsing or verification capability. 2471 * 2472 * @param { EncodingBlob } inStream - indicate the input cert extensions data. 2473 * @returns { Promise<CertExtension> } the promise of certificate extension instance. 2474 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2475 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2476 * @throws { BusinessError } 801 - this operation is not supported. 2477 * @throws { BusinessError } 19020001 - memory malloc failed. 2478 * @throws { BusinessError } 19030001 - crypto operation error. 2479 * @syscap SystemCapability.Security.Cert 2480 * @since 10 2481 */ 2482 /** 2483 * Provides to create certificate extension object. 2484 * The returned object provides the data parsing or verification capability. 2485 * 2486 * @param { EncodingBlob } inStream - indicate the input cert extensions data. 2487 * @returns { Promise<CertExtension> } the promise of certificate extension instance. 2488 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2489 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2490 * @throws { BusinessError } 801 - this operation is not supported. 2491 * @throws { BusinessError } 19020001 - memory malloc failed. 2492 * @throws { BusinessError } 19030001 - crypto operation error. 2493 * @syscap SystemCapability.Security.Cert 2494 * @crossplatform 2495 * @since 11 2496 */ 2497 /** 2498 * Provides to create certificate extension object. 2499 * The returned object provides the data parsing or verification capability. 2500 * 2501 * @param { EncodingBlob } inStream - indicate the input cert extensions data. 2502 * @returns { Promise<CertExtension> } the promise of certificate extension instance. 2503 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2504 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2505 * @throws { BusinessError } 801 - this operation is not supported. 2506 * @throws { BusinessError } 19020001 - memory malloc failed. 2507 * @throws { BusinessError } 19030001 - crypto operation error. 2508 * @syscap SystemCapability.Security.Cert 2509 * @crossplatform 2510 * @atomicservice 2511 * @since 12 2512 */ 2513 function createCertExtension(inStream: EncodingBlob): Promise<CertExtension>; 2514 2515 /** 2516 * Interface of X509CrlEntry. 2517 * 2518 * @typedef X509CrlEntry 2519 * @syscap SystemCapability.Security.Cert 2520 * @since 9 2521 * @deprecated since 11 2522 * @useinstead ohos.security.cert.X509CRLEntry 2523 */ 2524 interface X509CrlEntry { 2525 /** 2526 * Returns the ASN of this CRL entry 1 der coding form, i.e. internal sequence. 2527 * 2528 * @param { AsyncCallback<EncodingBlob> } callback - the callback of getEncoded. 2529 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2530 * <br>2. Incorrect parameter types; 2531 * @throws { BusinessError } 19020001 - memory malloc failed. 2532 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2533 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2534 * @throws { BusinessError } 19030001 - crypto operation error. 2535 * @syscap SystemCapability.Security.Cert 2536 * @since 9 2537 * @deprecated since 11 2538 * @useinstead ohos.security.cert.X509CRLEntry#getEncoded 2539 */ 2540 getEncoded(callback: AsyncCallback<EncodingBlob>): void; 2541 2542 /** 2543 * Returns the ASN of this CRL entry 1 der coding form, i.e. internal sequence. 2544 * 2545 * @returns { Promise<EncodingBlob> } the promise of crl entry blob data. 2546 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2547 * <br>2. Incorrect parameter types; 2548 * @throws { BusinessError } 19020001 - memory malloc failed. 2549 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2550 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2551 * @throws { BusinessError } 19030001 - crypto operation error. 2552 * @syscap SystemCapability.Security.Cert 2553 * @since 9 2554 * @deprecated since 11 2555 * @useinstead ohos.security.cert.X509CRLEntry#getEncoded 2556 */ 2557 getEncoded(): Promise<EncodingBlob>; 2558 2559 /** 2560 * Get the serial number from this x509crl entry. 2561 * 2562 * @returns { number } serial number of crl entry. 2563 * @syscap SystemCapability.Security.Cert 2564 * @since 9 2565 * @deprecated since 11 2566 * @useinstead ohos.security.cert.X509CRLEntry#getSerialNumber 2567 */ 2568 getSerialNumber(): number; 2569 2570 /** 2571 * Get the issuer of the x509 certificate described by this entry. 2572 * 2573 * @returns { DataBlob } DataBlob of issuer. 2574 * @throws { BusinessError } 801 - this operation is not supported. 2575 * @throws { BusinessError } 19020001 - memory malloc failed. 2576 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2577 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2578 * @syscap SystemCapability.Security.Cert 2579 * @since 9 2580 * @deprecated since 11 2581 * @useinstead ohos.security.cert.X509CRLEntry#getCertIssuer 2582 */ 2583 getCertIssuer(): DataBlob; 2584 2585 /** 2586 * Get the revocation date from x509crl entry. 2587 * 2588 * @returns { string } string of revocation date. 2589 * @throws { BusinessError } 19020001 - memory malloc failed. 2590 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2591 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2592 * @throws { BusinessError } 19030001 - crypto operation error. 2593 * @syscap SystemCapability.Security.Cert 2594 * @since 9 2595 * @deprecated since 11 2596 * @useinstead ohos.security.cert.X509CRLEntry#getRevocationDate 2597 */ 2598 getRevocationDate(): string; 2599 } 2600 2601 /** 2602 * Interface of X509CRLEntry. 2603 * 2604 * @typedef X509CRLEntry 2605 * @syscap SystemCapability.Security.Cert 2606 * @crossplatform 2607 * @since 11 2608 */ 2609 /** 2610 * Interface of X509CRLEntry. 2611 * 2612 * @typedef X509CRLEntry 2613 * @syscap SystemCapability.Security.Cert 2614 * @crossplatform 2615 * @atomicservice 2616 * @since 12 2617 */ 2618 interface X509CRLEntry { 2619 /** 2620 * Returns the ASN of this CRL entry 1 der coding form, i.e. internal sequence. 2621 * 2622 * @param { AsyncCallback<EncodingBlob> } callback - the callback of getEncoded. 2623 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2624 * <br>2. Incorrect parameter types; 2625 * @throws { BusinessError } 19020001 - memory malloc failed. 2626 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2627 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2628 * @throws { BusinessError } 19030001 - crypto operation error. 2629 * @syscap SystemCapability.Security.Cert 2630 * @crossplatform 2631 * @since 11 2632 */ 2633 /** 2634 * Returns the ASN of this CRL entry 1 der coding form, i.e. internal sequence. 2635 * 2636 * @param { AsyncCallback<EncodingBlob> } callback - the callback of getEncoded. 2637 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2638 * <br>2. Incorrect parameter types; 2639 * @throws { BusinessError } 19020001 - memory malloc failed. 2640 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2641 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2642 * @throws { BusinessError } 19030001 - crypto operation error. 2643 * @syscap SystemCapability.Security.Cert 2644 * @crossplatform 2645 * @atomicservice 2646 * @since 12 2647 */ 2648 getEncoded(callback: AsyncCallback<EncodingBlob>): void; 2649 2650 /** 2651 * Returns the ASN of this CRL entry 1 der coding form, i.e. internal sequence. 2652 * 2653 * @returns { Promise<EncodingBlob> } the promise of CRL entry blob data. 2654 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2655 * <br>2. Incorrect parameter types; 2656 * @throws { BusinessError } 19020001 - memory malloc failed. 2657 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2658 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2659 * @throws { BusinessError } 19030001 - crypto operation error. 2660 * @syscap SystemCapability.Security.Cert 2661 * @crossplatform 2662 * @since 11 2663 */ 2664 /** 2665 * Returns the ASN of this CRL entry 1 der coding form, i.e. internal sequence. 2666 * 2667 * @returns { Promise<EncodingBlob> } the promise of CRL entry blob data. 2668 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2669 * <br>2. Incorrect parameter types; 2670 * @throws { BusinessError } 19020001 - memory malloc failed. 2671 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2672 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2673 * @throws { BusinessError } 19030001 - crypto operation error. 2674 * @syscap SystemCapability.Security.Cert 2675 * @crossplatform 2676 * @atomicservice 2677 * @since 12 2678 */ 2679 getEncoded(): Promise<EncodingBlob>; 2680 2681 /** 2682 * Get the serial number from this x509CRL entry. 2683 * 2684 * @returns { bigint } serial number of CRL entry. 2685 * @throws { BusinessError } 19020001 - memory malloc failed. 2686 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2687 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2688 * @throws { BusinessError } 19030001 - crypto operation error. 2689 * @syscap SystemCapability.Security.Cert 2690 * @crossplatform 2691 * @since 11 2692 */ 2693 /** 2694 * Get the serial number from this x509CRL entry. 2695 * 2696 * @returns { bigint } serial number of CRL entry. 2697 * @throws { BusinessError } 19020001 - memory malloc failed. 2698 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2699 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2700 * @throws { BusinessError } 19030001 - crypto operation error. 2701 * @syscap SystemCapability.Security.Cert 2702 * @crossplatform 2703 * @atomicservice 2704 * @since 12 2705 */ 2706 getSerialNumber(): bigint; 2707 2708 /** 2709 * Get the issuer of the x509 certificate described by this entry. 2710 * 2711 * @returns { DataBlob } DataBlob of issuer. 2712 * @throws { BusinessError } 801 - this operation is not supported. 2713 * @throws { BusinessError } 19020001 - memory malloc failed. 2714 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2715 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2716 * @throws { BusinessError } 19030001 - crypto operation error. 2717 * @syscap SystemCapability.Security.Cert 2718 * @crossplatform 2719 * @since 11 2720 */ 2721 /** 2722 * Get the issuer of the x509 certificate described by this entry. 2723 * 2724 * @returns { DataBlob } DataBlob of issuer. 2725 * @throws { BusinessError } 801 - this operation is not supported. 2726 * @throws { BusinessError } 19020001 - memory malloc failed. 2727 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2728 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2729 * @throws { BusinessError } 19030001 - crypto operation error. 2730 * @syscap SystemCapability.Security.Cert 2731 * @crossplatform 2732 * @atomicservice 2733 * @since 12 2734 */ 2735 getCertIssuer(): DataBlob; 2736 2737 /** 2738 * Get the issuer name of the x509 certificate described by this entry according to the encoding type. 2739 * 2740 * @param { EncodingType } encodingType indicates the encoding type. 2741 * @returns { string } issuer name. 2742 * @throws { BusinessError } 801 - this operation is not supported. 2743 * @throws { BusinessError } 19020001 - memory malloc failed. 2744 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2745 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2746 * @throws { BusinessError } 19020003 - parameter check failed. Possible causes: 2747 * <br>1. The value of encodingType is not in the EncodingType enumeration range. 2748 * @throws { BusinessError } 19030001 - crypto operation error. 2749 * @syscap SystemCapability.Security.Cert 2750 * @crossplatform 2751 * @atomicservice 2752 * @since 20 2753 */ 2754 getCertIssuer(encodingType: EncodingType): string; 2755 2756 /** 2757 * Get the revocation date from x509CRL entry. 2758 * 2759 * @returns { string } string of revocation date. 2760 * @throws { BusinessError } 19020001 - memory malloc failed. 2761 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2762 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2763 * @throws { BusinessError } 19030001 - crypto operation error. 2764 * @syscap SystemCapability.Security.Cert 2765 * @crossplatform 2766 * @since 11 2767 */ 2768 /** 2769 * Get the revocation date from x509CRL entry. 2770 * 2771 * @returns { string } string of revocation date. 2772 * @throws { BusinessError } 19020001 - memory malloc failed. 2773 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2774 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2775 * @throws { BusinessError } 19030001 - crypto operation error. 2776 * @syscap SystemCapability.Security.Cert 2777 * @crossplatform 2778 * @atomicservice 2779 * @since 12 2780 */ 2781 getRevocationDate(): string; 2782 2783 /** 2784 * Get Extensions of CRL Entry. 2785 * 2786 * @returns { DataBlob } DataBlob of extensions 2787 * @throws { BusinessError } 19020001 - memory malloc failed. 2788 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2789 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2790 * @throws { BusinessError } 19030001 - crypto operation error. 2791 * @syscap SystemCapability.Security.Cert 2792 * @crossplatform 2793 * @since 11 2794 */ 2795 /** 2796 * Get Extensions of CRL Entry. 2797 * 2798 * @returns { DataBlob } DataBlob of extensions 2799 * @throws { BusinessError } 19020001 - memory malloc failed. 2800 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2801 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2802 * @throws { BusinessError } 19030001 - crypto operation error. 2803 * @syscap SystemCapability.Security.Cert 2804 * @crossplatform 2805 * @atomicservice 2806 * @since 12 2807 */ 2808 getExtensions(): DataBlob; 2809 2810 /** 2811 * Check if CRL Entry has extension . 2812 * 2813 * @returns { boolean } true - CRL Entry has extension, false - else. 2814 * @throws { BusinessError } 19020001 - memory malloc failed. 2815 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2816 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2817 * @throws { BusinessError } 19030001 - crypto operation error. 2818 * @syscap SystemCapability.Security.Cert 2819 * @crossplatform 2820 * @since 11 2821 */ 2822 /** 2823 * Check if CRL Entry has extension . 2824 * 2825 * @returns { boolean } true - CRL Entry has extension, false - else. 2826 * @throws { BusinessError } 19020001 - memory malloc failed. 2827 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2828 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2829 * @throws { BusinessError } 19030001 - crypto operation error. 2830 * @syscap SystemCapability.Security.Cert 2831 * @crossplatform 2832 * @atomicservice 2833 * @since 12 2834 */ 2835 hasExtensions(): boolean; 2836 2837 /** 2838 * Get X500 distinguished name of the issuer. 2839 * 2840 * @returns { X500DistinguishedName } X500 distinguished name object. 2841 * @throws { BusinessError } 19020001 - memory malloc failed. 2842 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2843 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2844 * @throws { BusinessError } 19030001 - crypto operation error. 2845 * @syscap SystemCapability.Security.Cert 2846 * @crossplatform 2847 * @atomicservice 2848 * @since 12 2849 */ 2850 getCertIssuerX500DistinguishedName(): X500DistinguishedName; 2851 2852 /** 2853 * Get the string type data of the object. 2854 * 2855 * @returns { string } the string type data of the object. 2856 * @throws { BusinessError } 19020001 - memory malloc failed. 2857 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2858 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2859 * @throws { BusinessError } 19030001 - crypto operation error. 2860 * @syscap SystemCapability.Security.Cert 2861 * @crossplatform 2862 * @atomicservice 2863 * @since 12 2864 */ 2865 toString(): string; 2866 2867 /** 2868 * Get the hash value of DER format data. 2869 * 2870 * @returns { Uint8Array } the hash value of DER format data. 2871 * @throws { BusinessError } 19020001 - memory malloc failed. 2872 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2873 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2874 * @throws { BusinessError } 19030001 - crypto operation error. 2875 * @syscap SystemCapability.Security.Cert 2876 * @crossplatform 2877 * @atomicservice 2878 * @since 12 2879 */ 2880 hashCode(): Uint8Array; 2881 2882 /** 2883 * Get the extension der encoding data for the corresponding entity. 2884 * 2885 * @returns { CertExtension } the certExtension object. 2886 * @throws { BusinessError } 19020001 - memory malloc failed. 2887 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2888 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2889 * @throws { BusinessError } 19030001 - crypto operation error. 2890 * @syscap SystemCapability.Security.Cert 2891 * @crossplatform 2892 * @atomicservice 2893 * @since 12 2894 */ 2895 getExtensionsObject(): CertExtension; 2896 } 2897 2898 /** 2899 * Interface of X509Crl. 2900 * 2901 * @typedef X509Crl 2902 * @syscap SystemCapability.Security.Cert 2903 * @since 9 2904 * @deprecated since 11 2905 * @useinstead ohos.security.cert.X509CRL 2906 */ 2907 interface X509Crl { 2908 /** 2909 * Check if the given certificate is on this CRL. 2910 * 2911 * @param { X509Cert } cert - input cert data. 2912 * @returns { boolean } result of Check cert is revoked or not. 2913 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2914 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2915 * @syscap SystemCapability.Security.Cert 2916 * @since 9 2917 * @deprecated since 11 2918 * @useinstead ohos.security.cert.X509CRL#isRevoked 2919 */ 2920 isRevoked(cert: X509Cert): boolean; 2921 2922 /** 2923 * Returns the type of this CRL. 2924 * 2925 * @returns { string } string of crl type. 2926 * @syscap SystemCapability.Security.Cert 2927 * @since 9 2928 * @deprecated since 11 2929 * @useinstead ohos.security.cert.X509CRL#getType 2930 */ 2931 getType(): string; 2932 2933 /** 2934 * Get the der coding format. 2935 * 2936 * @param { AsyncCallback<EncodingBlob> } callback - the callback of getEncoded. 2937 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2938 * <br>2. Incorrect parameter types; 2939 * @throws { BusinessError } 19020001 - memory malloc failed. 2940 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2941 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2942 * @throws { BusinessError } 19030001 - crypto operation error. 2943 * @syscap SystemCapability.Security.Cert 2944 * @since 9 2945 * @deprecated since 11 2946 * @useinstead ohos.security.cert.X509CRL#getEncoded 2947 */ 2948 getEncoded(callback: AsyncCallback<EncodingBlob>): void; 2949 2950 /** 2951 * Get the der coding format. 2952 * 2953 * @returns { Promise<EncodingBlob> } the promise of crl blob data. 2954 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2955 * <br>2. Incorrect parameter types; 2956 * @throws { BusinessError } 19020001 - memory malloc failed. 2957 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 2958 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 2959 * @throws { BusinessError } 19030001 - crypto operation error. 2960 * @syscap SystemCapability.Security.Cert 2961 * @since 9 2962 * @deprecated since 11 2963 * @useinstead ohos.security.cert.X509CRL#getEncoded 2964 */ 2965 getEncoded(): Promise<EncodingBlob>; 2966 2967 /** 2968 * Use the public key to verify the signature of CRL. 2969 * 2970 * @param { cryptoFramework.PubKey } key - input public Key. 2971 * @param { AsyncCallback<void> } callback - the callback of getEncoded. 2972 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2973 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2974 * @throws { BusinessError } 19030001 - crypto operation error. 2975 * @syscap SystemCapability.Security.Cert 2976 * @since 9 2977 * @deprecated since 11 2978 * @useinstead ohos.security.cert.X509CRL#verify 2979 */ 2980 verify(key: cryptoFramework.PubKey, callback: AsyncCallback<void>): void; 2981 2982 /** 2983 * Use the public key to verify the signature of CRL. 2984 * 2985 * @param { cryptoFramework.PubKey } key - input public Key. 2986 * @returns { Promise<void> } the promise returned by the function. 2987 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 2988 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 2989 * @throws { BusinessError } 19030001 - crypto operation error. 2990 * @syscap SystemCapability.Security.Cert 2991 * @since 9 2992 * @deprecated since 11 2993 * @useinstead ohos.security.cert.X509CRL#verify 2994 */ 2995 verify(key: cryptoFramework.PubKey): Promise<void>; 2996 2997 /** 2998 * Get version number from CRL. 2999 * 3000 * @returns { number } version of crl. 3001 * @syscap SystemCapability.Security.Cert 3002 * @since 9 3003 * @deprecated since 11 3004 * @useinstead ohos.security.cert.X509CRL#getVersion 3005 */ 3006 getVersion(): number; 3007 3008 /** 3009 * Get the issuer name from CRL. Issuer means the entity that signs and publishes the CRL. 3010 * 3011 * @returns { DataBlob } issuer name of crl. 3012 * @throws { BusinessError } 19020001 - memory malloc failed. 3013 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3014 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3015 * @throws { BusinessError } 19030001 - crypto operation error. 3016 * @syscap SystemCapability.Security.Cert 3017 * @since 9 3018 * @deprecated since 11 3019 * @useinstead ohos.security.cert.X509CRL#getIssuerName 3020 */ 3021 getIssuerName(): DataBlob; 3022 3023 /** 3024 * Get lastUpdate value from CRL. 3025 * 3026 * @returns { string } last update of crl. 3027 * @throws { BusinessError } 19020001 - memory malloc failed. 3028 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3029 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3030 * @throws { BusinessError } 19030001 - crypto operation error. 3031 * @syscap SystemCapability.Security.Cert 3032 * @since 9 3033 * @deprecated since 11 3034 * @useinstead ohos.security.cert.X509CRL#getLastUpdate 3035 */ 3036 getLastUpdate(): string; 3037 3038 /** 3039 * Get nextUpdate value from CRL. 3040 * 3041 * @returns { string } next update of crl. 3042 * @throws { BusinessError } 19020001 - memory malloc failed. 3043 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3044 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3045 * @throws { BusinessError } 19030001 - crypto operation error. 3046 * @syscap SystemCapability.Security.Cert 3047 * @since 9 3048 * @deprecated since 11 3049 * @useinstead ohos.security.cert.X509CRL#getNextUpdate 3050 */ 3051 getNextUpdate(): string; 3052 3053 /** 3054 * This method can be used to find CRL entries in specified CRLs. 3055 * 3056 * @param { number } serialNumber - serial number of crl. 3057 * @returns { X509CrlEntry } next update of crl. 3058 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3059 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3060 * @throws { BusinessError } 19020001 - memory malloc failed. 3061 * @throws { BusinessError } 19030001 - crypto operation error. 3062 * @syscap SystemCapability.Security.Cert 3063 * @since 9 3064 * @deprecated since 11 3065 * @useinstead ohos.security.cert.X509CRL#getRevokedCert 3066 */ 3067 getRevokedCert(serialNumber: number): X509CrlEntry; 3068 3069 /** 3070 * This method can be used to find CRL entries in specified cert. 3071 * 3072 * @param { X509Cert } cert - cert of x509. 3073 * @returns { X509CrlEntry } X509CrlEntry instance. 3074 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3075 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3076 * @throws { BusinessError } 19020001 - memory malloc failed. 3077 * @throws { BusinessError } 19030001 - crypto operation error. 3078 * @syscap SystemCapability.Security.Cert 3079 * @since 9 3080 * @deprecated since 11 3081 * @useinstead ohos.security.cert.X509CRL#getRevokedCertWithCert 3082 */ 3083 getRevokedCertWithCert(cert: X509Cert): X509CrlEntry; 3084 3085 /** 3086 * Get all entries in this CRL. 3087 * 3088 * @param { AsyncCallback<Array<X509CrlEntry>> } callback - the callback of getRevokedCerts. 3089 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3090 * <br>2. Incorrect parameter types; 3091 * @throws { BusinessError } 19020001 - memory malloc failed. 3092 * @throws { BusinessError } 19030001 - crypto operation error. 3093 * @syscap SystemCapability.Security.Cert 3094 * @since 9 3095 * @deprecated since 11 3096 * @useinstead ohos.security.cert.X509CRL#getRevokedCerts 3097 */ 3098 getRevokedCerts(callback: AsyncCallback<Array<X509CrlEntry>>): void; 3099 3100 /** 3101 * Get all entries in this CRL. 3102 * 3103 * @returns { Promise<Array<X509CrlEntry>> } the promise of X509CrlEntry instance. 3104 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3105 * <br>2. Incorrect parameter types; 3106 * @throws { BusinessError } 19020001 - memory malloc failed. 3107 * @throws { BusinessError } 19030001 - crypto operation error. 3108 * @syscap SystemCapability.Security.Cert 3109 * @since 9 3110 * @deprecated since 11 3111 * @useinstead ohos.security.cert.X509CRL#getRevokedCerts 3112 */ 3113 getRevokedCerts(): Promise<Array<X509CrlEntry>>; 3114 3115 /** 3116 * Get the CRL information encoded by Der from this CRL. 3117 * 3118 * @returns { DataBlob } DataBlob of tbs info. 3119 * @throws { BusinessError } 19020001 - memory malloc failed. 3120 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3121 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3122 * @throws { BusinessError } 19030001 - crypto operation error. 3123 * @syscap SystemCapability.Security.Cert 3124 * @since 9 3125 * @deprecated since 11 3126 * @useinstead ohos.security.cert.X509CRL#getTBSInfo 3127 */ 3128 getTbsInfo(): DataBlob; 3129 3130 /** 3131 * Get signature value from CRL. 3132 * 3133 * @returns { DataBlob } DataBlob of signature. 3134 * @throws { BusinessError } 19020001 - memory malloc failed. 3135 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3136 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3137 * @throws { BusinessError } 19030001 - crypto operation error. 3138 * @syscap SystemCapability.Security.Cert 3139 * @since 9 3140 * @deprecated since 11 3141 * @useinstead ohos.security.cert.X509CRL#getSignature 3142 */ 3143 getSignature(): DataBlob; 3144 3145 /** 3146 * Get the signature algorithm name of the CRL signature algorithm. 3147 * 3148 * @returns { string } string of signature algorithm name. 3149 * @throws { BusinessError } 19020001 - memory malloc failed. 3150 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3151 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3152 * @throws { BusinessError } 19030001 - crypto operation error. 3153 * @syscap SystemCapability.Security.Cert 3154 * @since 9 3155 * @deprecated since 11 3156 * @useinstead ohos.security.cert.X509CRL#getSignatureAlgName 3157 */ 3158 getSignatureAlgName(): string; 3159 3160 /** 3161 * Get the signature algorithm oid string from CRL. 3162 * 3163 * @returns { string } string of signature algorithm oid. 3164 * @throws { BusinessError } 19020001 - memory malloc failed. 3165 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3166 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3167 * @throws { BusinessError } 19030001 - crypto operation error. 3168 * @syscap SystemCapability.Security.Cert 3169 * @since 9 3170 * @deprecated since 11 3171 * @useinstead ohos.security.cert.X509CRL#getSignatureAlgOid 3172 */ 3173 getSignatureAlgOid(): string; 3174 3175 /** 3176 * Get the der encoded signature algorithm parameters from the CRL signature algorithm. 3177 * 3178 * @returns { DataBlob } DataBlob of signature algorithm params. 3179 * @throws { BusinessError } 801 - this operation is not supported. 3180 * @throws { BusinessError } 19020001 - memory malloc failed. 3181 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3182 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3183 * @throws { BusinessError } 19030001 - crypto operation error. 3184 * @syscap SystemCapability.Security.Cert 3185 * @since 9 3186 * @deprecated since 11 3187 * @useinstead ohos.security.cert.X509CRL#getSignatureAlgParams 3188 */ 3189 getSignatureAlgParams(): DataBlob; 3190 } 3191 3192 /** 3193 * Provides to create X509 CRL object. 3194 * The returned object provides the data parsing or verification capability. 3195 * 3196 * @param { EncodingBlob } inStream - indicates the input CRL data. 3197 * @param { AsyncCallback<X509Crl> } callback - the callback of createX509Crl to return x509 CRL instance. 3198 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3199 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3200 * @throws { BusinessError } 801 - this operation is not supported. 3201 * @throws { BusinessError } 19020001 - memory malloc failed. 3202 * @syscap SystemCapability.Security.Cert 3203 * @since 9 3204 * @deprecated since 11 3205 * @useinstead ohos.security.cert#createX509CRL 3206 */ 3207 function createX509Crl(inStream: EncodingBlob, callback: AsyncCallback<X509Crl>): void; 3208 3209 /** 3210 * Provides to create X509 CRL object. 3211 * The returned object provides the data parsing or verification capability. 3212 * 3213 * @param { EncodingBlob } inStream - indicates the input CRL data. 3214 * @returns { Promise<X509Crl> } the promise of x509 CRL instance. 3215 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3216 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3217 * @throws { BusinessError } 801 - this operation is not supported. 3218 * @throws { BusinessError } 19020001 - memory malloc failed. 3219 * @syscap SystemCapability.Security.Cert 3220 * @since 9 3221 * @deprecated since 11 3222 * @useinstead ohos.security.cert#createX509CRL 3223 */ 3224 function createX509Crl(inStream: EncodingBlob): Promise<X509Crl>; 3225 3226 /** 3227 * Interface of X509CRL. 3228 * 3229 * @typedef X509CRL 3230 * @syscap SystemCapability.Security.Cert 3231 * @crossplatform 3232 * @since 11 3233 */ 3234 /** 3235 * Interface of X509CRL. 3236 * 3237 * @typedef X509CRL 3238 * @syscap SystemCapability.Security.Cert 3239 * @crossplatform 3240 * @atomicservice 3241 * @since 12 3242 */ 3243 interface X509CRL { 3244 /** 3245 * Check if the given certificate is on this CRL. 3246 * 3247 * @param { X509Cert } cert - input cert data. 3248 * @returns { boolean } result of Check cert is revoked or not. 3249 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3250 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3251 * @syscap SystemCapability.Security.Cert 3252 * @crossplatform 3253 * @since 11 3254 */ 3255 /** 3256 * Check if the given certificate is on this CRL. 3257 * 3258 * @param { X509Cert } cert - input cert data. 3259 * @returns { boolean } result of Check cert is revoked or not. 3260 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3261 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3262 * @syscap SystemCapability.Security.Cert 3263 * @crossplatform 3264 * @atomicservice 3265 * @since 12 3266 */ 3267 isRevoked(cert: X509Cert): boolean; 3268 3269 /** 3270 * Returns the type of this CRL. 3271 * 3272 * @returns { string } string of CRL type. 3273 * @syscap SystemCapability.Security.Cert 3274 * @crossplatform 3275 * @since 11 3276 */ 3277 /** 3278 * Returns the type of this CRL. 3279 * 3280 * @returns { string } string of CRL type. 3281 * @syscap SystemCapability.Security.Cert 3282 * @crossplatform 3283 * @atomicservice 3284 * @since 12 3285 */ 3286 getType(): string; 3287 3288 /** 3289 * Get the der coding format. 3290 * 3291 * @param { AsyncCallback<EncodingBlob> } callback - the callback of getEncoded. 3292 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3293 * <br>2. Incorrect parameter types; 3294 * @throws { BusinessError } 19020001 - memory malloc failed. 3295 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3296 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3297 * @throws { BusinessError } 19030001 - crypto operation error. 3298 * @syscap SystemCapability.Security.Cert 3299 * @crossplatform 3300 * @since 11 3301 */ 3302 /** 3303 * Get the der coding format. 3304 * 3305 * @param { AsyncCallback<EncodingBlob> } callback - the callback of getEncoded. 3306 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3307 * <br>2. Incorrect parameter types; 3308 * @throws { BusinessError } 19020001 - memory malloc failed. 3309 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3310 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3311 * @throws { BusinessError } 19030001 - crypto operation error. 3312 * @syscap SystemCapability.Security.Cert 3313 * @crossplatform 3314 * @atomicservice 3315 * @since 12 3316 */ 3317 getEncoded(callback: AsyncCallback<EncodingBlob>): void; 3318 3319 /** 3320 * Get the der coding format. 3321 * 3322 * @returns { Promise<EncodingBlob> } the promise of CRL blob data. 3323 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3324 * <br>2. Incorrect parameter types; 3325 * @throws { BusinessError } 19020001 - memory malloc failed. 3326 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3327 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3328 * @throws { BusinessError } 19030001 - crypto operation error. 3329 * @syscap SystemCapability.Security.Cert 3330 * @crossplatform 3331 * @since 11 3332 */ 3333 /** 3334 * Get the der coding format. 3335 * 3336 * @returns { Promise<EncodingBlob> } the promise of CRL blob data. 3337 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3338 * <br>2. Incorrect parameter types; 3339 * @throws { BusinessError } 19020001 - memory malloc failed. 3340 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3341 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3342 * @throws { BusinessError } 19030001 - crypto operation error. 3343 * @syscap SystemCapability.Security.Cert 3344 * @crossplatform 3345 * @atomicservice 3346 * @since 12 3347 */ 3348 getEncoded(): Promise<EncodingBlob>; 3349 3350 /** 3351 * Use the public key to verify the signature of CRL. 3352 * 3353 * @param { cryptoFramework.PubKey } key - input public Key. 3354 * @param { AsyncCallback<void> } callback - the callback of getEncoded. 3355 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3356 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3357 * @throws { BusinessError } 19030001 - crypto operation error. 3358 * @syscap SystemCapability.Security.Cert 3359 * @crossplatform 3360 * @since 11 3361 */ 3362 /** 3363 * Use the public key to verify the signature of CRL. 3364 * 3365 * @param { cryptoFramework.PubKey } key - input public Key. 3366 * @param { AsyncCallback<void> } callback - the callback of getEncoded. 3367 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3368 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3369 * @throws { BusinessError } 19030001 - crypto operation error. 3370 * @syscap SystemCapability.Security.Cert 3371 * @crossplatform 3372 * @atomicservice 3373 * @since 12 3374 */ 3375 verify(key: cryptoFramework.PubKey, callback: AsyncCallback<void>): void; 3376 3377 /** 3378 * Use the public key to verify the signature of CRL. 3379 * 3380 * @param { cryptoFramework.PubKey } key - input public Key. 3381 * @returns { Promise<void> } the promise returned by the function. 3382 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3383 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3384 * @throws { BusinessError } 19030001 - crypto operation error. 3385 * @syscap SystemCapability.Security.Cert 3386 * @crossplatform 3387 * @since 11 3388 */ 3389 /** 3390 * Use the public key to verify the signature of CRL. 3391 * 3392 * @param { cryptoFramework.PubKey } key - input public Key. 3393 * @returns { Promise<void> } the promise returned by the function. 3394 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3395 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3396 * @throws { BusinessError } 19030001 - crypto operation error. 3397 * @syscap SystemCapability.Security.Cert 3398 * @crossplatform 3399 * @atomicservice 3400 * @since 12 3401 */ 3402 verify(key: cryptoFramework.PubKey): Promise<void>; 3403 3404 /** 3405 * Get version number from CRL. 3406 * 3407 * @returns { number } version of CRL. 3408 * @syscap SystemCapability.Security.Cert 3409 * @crossplatform 3410 * @since 11 3411 */ 3412 /** 3413 * Get version number from CRL. 3414 * 3415 * @returns { number } version of CRL. 3416 * @syscap SystemCapability.Security.Cert 3417 * @crossplatform 3418 * @atomicservice 3419 * @since 12 3420 */ 3421 getVersion(): number; 3422 3423 /** 3424 * Get the issuer name from CRL. Issuer means the entity that signs and publishes the CRL. 3425 * 3426 * @returns { DataBlob } issuer name of CRL. 3427 * @throws { BusinessError } 19020001 - memory malloc failed. 3428 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3429 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3430 * @throws { BusinessError } 19030001 - crypto operation error. 3431 * @syscap SystemCapability.Security.Cert 3432 * @crossplatform 3433 * @since 11 3434 */ 3435 /** 3436 * Get the issuer name from CRL. Issuer means the entity that signs and publishes the CRL. 3437 * 3438 * @returns { DataBlob } issuer name of CRL. 3439 * @throws { BusinessError } 19020001 - memory malloc failed. 3440 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3441 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3442 * @throws { BusinessError } 19030001 - crypto operation error. 3443 * @syscap SystemCapability.Security.Cert 3444 * @crossplatform 3445 * @atomicservice 3446 * @since 12 3447 */ 3448 getIssuerName(): DataBlob; 3449 3450 /** 3451 * Get the issuer name from CRL according to the encoding type. 3452 * 3453 * @param { EncodingType } encodingType indicates the encoding type. 3454 * @returns { string } issuer name of CRL. 3455 * @throws { BusinessError } 19020001 - memory malloc failed. 3456 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3457 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3458 * @throws { BusinessError } 19020003 - parameter check failed. Possible causes: 3459 * <br>1. The value of encodingType is not in the EncodingType enumeration range. 3460 * @throws { BusinessError } 19030001 - crypto operation error. 3461 * @syscap SystemCapability.Security.Cert 3462 * @crossplatform 3463 * @atomicservice 3464 * @since 20 3465 */ 3466 getIssuerName(encodingType: EncodingType): string; 3467 3468 /** 3469 * Get lastUpdate value from CRL. 3470 * 3471 * @returns { string } last update of CRL. 3472 * @throws { BusinessError } 19020001 - memory malloc failed. 3473 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3474 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3475 * @throws { BusinessError } 19030001 - crypto operation error. 3476 * @syscap SystemCapability.Security.Cert 3477 * @crossplatform 3478 * @since 11 3479 */ 3480 /** 3481 * Get lastUpdate value from CRL. 3482 * 3483 * @returns { string } last update of CRL. 3484 * @throws { BusinessError } 19020001 - memory malloc failed. 3485 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3486 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3487 * @throws { BusinessError } 19030001 - crypto operation error. 3488 * @syscap SystemCapability.Security.Cert 3489 * @crossplatform 3490 * @atomicservice 3491 * @since 12 3492 */ 3493 getLastUpdate(): string; 3494 3495 /** 3496 * Get nextUpdate value from CRL. 3497 * 3498 * @returns { string } next update of CRL. 3499 * @throws { BusinessError } 19020001 - memory malloc failed. 3500 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3501 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3502 * @throws { BusinessError } 19030001 - crypto operation error. 3503 * @syscap SystemCapability.Security.Cert 3504 * @crossplatform 3505 * @since 11 3506 */ 3507 /** 3508 * Get nextUpdate value from CRL. 3509 * 3510 * @returns { string } next update of CRL. 3511 * @throws { BusinessError } 19020001 - memory malloc failed. 3512 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3513 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3514 * @throws { BusinessError } 19030001 - crypto operation error. 3515 * @syscap SystemCapability.Security.Cert 3516 * @crossplatform 3517 * @atomicservice 3518 * @since 12 3519 */ 3520 getNextUpdate(): string; 3521 3522 /** 3523 * This method can be used to find CRL entries in specified CRLs. 3524 * 3525 * @param { bigint } serialNumber - serial number of CRL. 3526 * @returns { X509CRLEntry } next update of CRL. 3527 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3528 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3529 * @throws { BusinessError } 19020001 - memory malloc failed. 3530 * @throws { BusinessError } 19030001 - crypto operation error. 3531 * @syscap SystemCapability.Security.Cert 3532 * @crossplatform 3533 * @since 11 3534 */ 3535 /** 3536 * This method can be used to find CRL entries in specified CRLs. 3537 * 3538 * @param { bigint } serialNumber - serial number of CRL. 3539 * @returns { X509CRLEntry } next update of CRL. 3540 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3541 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3542 * @throws { BusinessError } 19020001 - memory malloc failed. 3543 * @throws { BusinessError } 19030001 - crypto operation error. 3544 * @syscap SystemCapability.Security.Cert 3545 * @crossplatform 3546 * @atomicservice 3547 * @since 12 3548 */ 3549 getRevokedCert(serialNumber: bigint): X509CRLEntry; 3550 3551 /** 3552 * This method can be used to find CRL entries in specified cert. 3553 * 3554 * @param { X509Cert } cert - cert of x509. 3555 * @returns { X509CRLEntry } X509CRLEntry instance. 3556 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3557 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3558 * @throws { BusinessError } 19020001 - memory malloc failed. 3559 * @throws { BusinessError } 19030001 - crypto operation error. 3560 * @syscap SystemCapability.Security.Cert 3561 * @crossplatform 3562 * @since 11 3563 */ 3564 /** 3565 * This method can be used to find CRL entries in specified cert. 3566 * 3567 * @param { X509Cert } cert - cert of x509. 3568 * @returns { X509CRLEntry } X509CRLEntry instance. 3569 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3570 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3571 * @throws { BusinessError } 19020001 - memory malloc failed. 3572 * @throws { BusinessError } 19030001 - crypto operation error. 3573 * @syscap SystemCapability.Security.Cert 3574 * @crossplatform 3575 * @atomicservice 3576 * @since 12 3577 */ 3578 getRevokedCertWithCert(cert: X509Cert): X509CRLEntry; 3579 3580 /** 3581 * Get all entries in this CRL. 3582 * 3583 * @param { AsyncCallback<Array<X509CRLEntry>> } callback - the callback of getRevokedCerts. 3584 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3585 * <br>2. Incorrect parameter types; 3586 * @throws { BusinessError } 19020001 - memory malloc failed. 3587 * @throws { BusinessError } 19030001 - crypto operation error. 3588 * @syscap SystemCapability.Security.Cert 3589 * @crossplatform 3590 * @since 11 3591 */ 3592 /** 3593 * Get all entries in this CRL. 3594 * 3595 * @param { AsyncCallback<Array<X509CRLEntry>> } callback - the callback of getRevokedCerts. 3596 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3597 * <br>2. Incorrect parameter types; 3598 * @throws { BusinessError } 19020001 - memory malloc failed. 3599 * @throws { BusinessError } 19030001 - crypto operation error. 3600 * @syscap SystemCapability.Security.Cert 3601 * @crossplatform 3602 * @atomicservice 3603 * @since 12 3604 */ 3605 getRevokedCerts(callback: AsyncCallback<Array<X509CRLEntry>>): void; 3606 3607 /** 3608 * Get all entries in this CRL. 3609 * 3610 * @returns { Promise<Array<X509CRLEntry>> } the promise of X509CRLEntry instance. 3611 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3612 * <br>2. Incorrect parameter types; 3613 * @throws { BusinessError } 19020001 - memory malloc failed. 3614 * @throws { BusinessError } 19030001 - crypto operation error. 3615 * @syscap SystemCapability.Security.Cert 3616 * @crossplatform 3617 * @since 11 3618 */ 3619 /** 3620 * Get all entries in this CRL. 3621 * 3622 * @returns { Promise<Array<X509CRLEntry>> } the promise of X509CRLEntry instance. 3623 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3624 * <br>2. Incorrect parameter types; 3625 * @throws { BusinessError } 19020001 - memory malloc failed. 3626 * @throws { BusinessError } 19030001 - crypto operation error. 3627 * @syscap SystemCapability.Security.Cert 3628 * @crossplatform 3629 * @atomicservice 3630 * @since 12 3631 */ 3632 getRevokedCerts(): Promise<Array<X509CRLEntry>>; 3633 3634 /** 3635 * Get the CRL information encoded by Der from this CRL. 3636 * 3637 * @returns { DataBlob } DataBlob of tbs info. 3638 * @throws { BusinessError } 19020001 - memory malloc failed. 3639 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3640 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3641 * @throws { BusinessError } 19030001 - crypto operation error. 3642 * @syscap SystemCapability.Security.Cert 3643 * @crossplatform 3644 * @since 11 3645 */ 3646 /** 3647 * Get the CRL information encoded by Der from this CRL. 3648 * 3649 * @returns { DataBlob } DataBlob of tbs info. 3650 * @throws { BusinessError } 19020001 - memory malloc failed. 3651 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3652 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3653 * @throws { BusinessError } 19030001 - crypto operation error. 3654 * @syscap SystemCapability.Security.Cert 3655 * @crossplatform 3656 * @atomicservice 3657 * @since 12 3658 */ 3659 getTBSInfo(): DataBlob; 3660 3661 /** 3662 * Get signature value from CRL. 3663 * 3664 * @returns { DataBlob } DataBlob of signature. 3665 * @throws { BusinessError } 19020001 - memory malloc failed. 3666 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3667 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3668 * @throws { BusinessError } 19030001 - crypto operation error. 3669 * @syscap SystemCapability.Security.Cert 3670 * @crossplatform 3671 * @since 11 3672 */ 3673 /** 3674 * Get signature value from CRL. 3675 * 3676 * @returns { DataBlob } DataBlob of signature. 3677 * @throws { BusinessError } 19020001 - memory malloc failed. 3678 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3679 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3680 * @throws { BusinessError } 19030001 - crypto operation error. 3681 * @syscap SystemCapability.Security.Cert 3682 * @crossplatform 3683 * @atomicservice 3684 * @since 12 3685 */ 3686 getSignature(): DataBlob; 3687 3688 /** 3689 * Get the signature algorithm name of the CRL signature algorithm. 3690 * 3691 * @returns { string } string of signature algorithm name. 3692 * @throws { BusinessError } 19020001 - memory malloc failed. 3693 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3694 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3695 * @throws { BusinessError } 19030001 - crypto operation error. 3696 * @syscap SystemCapability.Security.Cert 3697 * @crossplatform 3698 * @since 11 3699 */ 3700 /** 3701 * Get the signature algorithm name of the CRL signature algorithm. 3702 * 3703 * @returns { string } string of signature algorithm name. 3704 * @throws { BusinessError } 19020001 - memory malloc failed. 3705 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3706 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3707 * @throws { BusinessError } 19030001 - crypto operation error. 3708 * @syscap SystemCapability.Security.Cert 3709 * @crossplatform 3710 * @atomicservice 3711 * @since 12 3712 */ 3713 getSignatureAlgName(): string; 3714 3715 /** 3716 * Get the signature algorithm oid string from CRL. 3717 * 3718 * @returns { string } string of signature algorithm oid. 3719 * @throws { BusinessError } 19020001 - memory malloc failed. 3720 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3721 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3722 * @throws { BusinessError } 19030001 - crypto operation error. 3723 * @syscap SystemCapability.Security.Cert 3724 * @crossplatform 3725 * @since 11 3726 */ 3727 /** 3728 * Get the signature algorithm oid string from CRL. 3729 * 3730 * @returns { string } string of signature algorithm oid. 3731 * @throws { BusinessError } 19020001 - memory malloc failed. 3732 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3733 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3734 * @throws { BusinessError } 19030001 - crypto operation error. 3735 * @syscap SystemCapability.Security.Cert 3736 * @crossplatform 3737 * @atomicservice 3738 * @since 12 3739 */ 3740 getSignatureAlgOid(): string; 3741 3742 /** 3743 * Get the der encoded signature algorithm parameters from the CRL signature algorithm. 3744 * 3745 * @returns { DataBlob } DataBlob of signature algorithm params. 3746 * @throws { BusinessError } 801 - this operation is not supported. 3747 * @throws { BusinessError } 19020001 - memory malloc failed. 3748 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3749 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3750 * @throws { BusinessError } 19030001 - crypto operation error. 3751 * @syscap SystemCapability.Security.Cert 3752 * @crossplatform 3753 * @since 11 3754 */ 3755 /** 3756 * Get the der encoded signature algorithm parameters from the CRL signature algorithm. 3757 * 3758 * @returns { DataBlob } DataBlob of signature algorithm params. 3759 * @throws { BusinessError } 801 - this operation is not supported. 3760 * @throws { BusinessError } 19020001 - memory malloc failed. 3761 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3762 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3763 * @throws { BusinessError } 19030001 - crypto operation error. 3764 * @syscap SystemCapability.Security.Cert 3765 * @crossplatform 3766 * @atomicservice 3767 * @since 12 3768 */ 3769 getSignatureAlgParams(): DataBlob; 3770 3771 /** 3772 * Get Extensions of CRL Entry. 3773 * 3774 * @returns { DataBlob } DataBlob of extensions 3775 * @throws { BusinessError } 19020001 - memory malloc failed. 3776 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3777 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3778 * @throws { BusinessError } 19030001 - crypto operation error. 3779 * @syscap SystemCapability.Security.Cert 3780 * @crossplatform 3781 * @since 11 3782 */ 3783 /** 3784 * Get Extensions of CRL Entry. 3785 * 3786 * @returns { DataBlob } DataBlob of extensions 3787 * @throws { BusinessError } 19020001 - memory malloc failed. 3788 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3789 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3790 * @throws { BusinessError } 19030001 - crypto operation error. 3791 * @syscap SystemCapability.Security.Cert 3792 * @crossplatform 3793 * @atomicservice 3794 * @since 12 3795 */ 3796 getExtensions(): DataBlob; 3797 3798 /** 3799 * Check if the X509 CRL match the parameters. 3800 * 3801 * @param { X509CRLMatchParameters } param - indicate the X509CRLMatchParameters object. 3802 * @returns { boolean } true - match X509CRL, false - not match. 3803 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3804 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3805 * @throws { BusinessError } 19020001 - memory malloc failed. 3806 * @throws { BusinessError } 19030001 - crypto operation error. 3807 * @syscap SystemCapability.Security.Cert 3808 * @crossplatform 3809 * @since 11 3810 */ 3811 /** 3812 * Check if the X509 CRL match the parameters. 3813 * 3814 * @param { X509CRLMatchParameters } param - indicate the X509CRLMatchParameters object. 3815 * @returns { boolean } true - match X509CRL, false - not match. 3816 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3817 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3818 * @throws { BusinessError } 19020001 - memory malloc failed. 3819 * @throws { BusinessError } 19030001 - crypto operation error. 3820 * @syscap SystemCapability.Security.Cert 3821 * @crossplatform 3822 * @atomicservice 3823 * @since 12 3824 */ 3825 match(param: X509CRLMatchParameters): boolean; 3826 3827 /** 3828 * Get X500 distinguished name of the issuer. 3829 * 3830 * @returns { X500DistinguishedName } X500 distinguished name object. 3831 * @throws { BusinessError } 19020001 - memory malloc failed. 3832 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3833 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3834 * @throws { BusinessError } 19030001 - crypto operation error. 3835 * @syscap SystemCapability.Security.Cert 3836 * @crossplatform 3837 * @atomicservice 3838 * @since 12 3839 */ 3840 getIssuerX500DistinguishedName(): X500DistinguishedName; 3841 3842 /** 3843 * Get the string type data of the object. 3844 * 3845 * @returns { string } the string type data of the object. 3846 * @throws { BusinessError } 19020001 - memory malloc failed. 3847 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3848 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3849 * @throws { BusinessError } 19030001 - crypto operation error. 3850 * @syscap SystemCapability.Security.Cert 3851 * @crossplatform 3852 * @atomicservice 3853 * @since 12 3854 */ 3855 toString(): string; 3856 3857 /** 3858 * Get the string type data of the object according to the encoding type. 3859 * 3860 * @param { EncodingType } encodingType indicates the encoding type. 3861 * @returns { string } the string type data of the object. 3862 * @throws { BusinessError } 19020001 - memory malloc failed. 3863 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3864 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3865 * @throws { BusinessError } 19020003 - parameter check failed. Possible causes: 3866 * <br>1. The value of encodingType is not in the EncodingType enumeration range. 3867 * @throws { BusinessError } 19030001 - crypto operation error. 3868 * @syscap SystemCapability.Security.Cert 3869 * @crossplatform 3870 * @atomicservice 3871 * @since 20 3872 */ 3873 toString(encodingType: EncodingType): string; 3874 3875 /** 3876 * Get the hash value of DER format data. 3877 * 3878 * @returns { Uint8Array } the hash value of DER format data. 3879 * @throws { BusinessError } 19020001 - memory malloc failed. 3880 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3881 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3882 * @throws { BusinessError } 19030001 - crypto operation error. 3883 * @syscap SystemCapability.Security.Cert 3884 * @crossplatform 3885 * @atomicservice 3886 * @since 12 3887 */ 3888 hashCode(): Uint8Array; 3889 3890 /** 3891 * Get the extension der encoding data for the corresponding entity. 3892 * 3893 * @returns { CertExtension } the certExtension object. 3894 * @throws { BusinessError } 19020001 - memory malloc failed. 3895 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 3896 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 3897 * @throws { BusinessError } 19030001 - crypto operation error. 3898 * @syscap SystemCapability.Security.Cert 3899 * @crossplatform 3900 * @atomicservice 3901 * @since 12 3902 */ 3903 getExtensionsObject(): CertExtension; 3904 } 3905 3906 /** 3907 * Provides to create X509 CRL object. 3908 * The returned object provides the data parsing or verification capability. 3909 * 3910 * @param { EncodingBlob } inStream - indicates the input CRL data. 3911 * @param { AsyncCallback<X509CRL> } callback - the callback of createX509CRL to return x509 CRL instance. 3912 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3913 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3914 * @throws { BusinessError } 801 - this operation is not supported. 3915 * @throws { BusinessError } 19020001 - memory malloc failed. 3916 * @syscap SystemCapability.Security.Cert 3917 * @crossplatform 3918 * @since 11 3919 */ 3920 /** 3921 * Provides to create X509 CRL object. 3922 * The returned object provides the data parsing or verification capability. 3923 * 3924 * @param { EncodingBlob } inStream - indicates the input CRL data. 3925 * @param { AsyncCallback<X509CRL> } callback - the callback of createX509CRL to return x509 CRL instance. 3926 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3927 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3928 * @throws { BusinessError } 801 - this operation is not supported. 3929 * @throws { BusinessError } 19020001 - memory malloc failed. 3930 * @syscap SystemCapability.Security.Cert 3931 * @crossplatform 3932 * @atomicservice 3933 * @since 12 3934 */ 3935 function createX509CRL(inStream: EncodingBlob, callback: AsyncCallback<X509CRL>): void; 3936 3937 /** 3938 * Provides to create X509 CRL object. 3939 * The returned object provides the data parsing or verification capability. 3940 * 3941 * @param { EncodingBlob } inStream - indicates the input CRL data. 3942 * @returns { Promise<X509CRL> } the promise of x509 CRL instance. 3943 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3944 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3945 * @throws { BusinessError } 801 - this operation is not supported. 3946 * @throws { BusinessError } 19020001 - memory malloc failed. 3947 * @syscap SystemCapability.Security.Cert 3948 * @crossplatform 3949 * @since 11 3950 */ 3951 /** 3952 * Provides to create X509 CRL object. 3953 * The returned object provides the data parsing or verification capability. 3954 * 3955 * @param { EncodingBlob } inStream - indicates the input CRL data. 3956 * @returns { Promise<X509CRL> } the promise of x509 CRL instance. 3957 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3958 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 3959 * @throws { BusinessError } 801 - this operation is not supported. 3960 * @throws { BusinessError } 19020001 - memory malloc failed. 3961 * @syscap SystemCapability.Security.Cert 3962 * @crossplatform 3963 * @atomicservice 3964 * @since 12 3965 */ 3966 function createX509CRL(inStream: EncodingBlob): Promise<X509CRL>; 3967 3968 /** 3969 * Certification chain validator. 3970 * 3971 * @typedef CertChainValidator 3972 * @syscap SystemCapability.Security.Cert 3973 * @since 9 3974 */ 3975 /** 3976 * Certification chain validator. 3977 * 3978 * @typedef CertChainValidator 3979 * @syscap SystemCapability.Security.Cert 3980 * @crossplatform 3981 * @since 11 3982 */ 3983 /** 3984 * Certification chain validator. 3985 * 3986 * @typedef CertChainValidator 3987 * @syscap SystemCapability.Security.Cert 3988 * @crossplatform 3989 * @atomicservice 3990 * @since 12 3991 */ 3992 interface CertChainValidator { 3993 /** 3994 * Validate the cert chain. 3995 * 3996 * @param { CertChainData } certChain - indicate the cert chain validator data. 3997 * @param { AsyncCallback<void> } callback - the callback of validate. 3998 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 3999 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4000 * @throws { BusinessError } 19020001 - memory malloc failed. 4001 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 4002 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 4003 * @throws { BusinessError } 19030001 - crypto operation error. 4004 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 4005 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 4006 * @throws { BusinessError } 19030004 - the certificate has expired. 4007 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 4008 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 4009 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 4010 * @syscap SystemCapability.Security.Cert 4011 * @since 9 4012 */ 4013 /** 4014 * Validate the cert chain. 4015 * 4016 * @param { CertChainData } certChain - indicate the cert chain validator data. 4017 * @param { AsyncCallback<void> } callback - the callback of validate. 4018 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4019 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4020 * @throws { BusinessError } 19020001 - memory malloc failed. 4021 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 4022 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 4023 * @throws { BusinessError } 19030001 - crypto operation error. 4024 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 4025 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 4026 * @throws { BusinessError } 19030004 - the certificate has expired. 4027 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 4028 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 4029 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 4030 * @syscap SystemCapability.Security.Cert 4031 * @crossplatform 4032 * @since 11 4033 */ 4034 /** 4035 * Validate the cert chain. 4036 * 4037 * @param { CertChainData } certChain - indicate the cert chain validator data. 4038 * @param { AsyncCallback<void> } callback - the callback of validate. 4039 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4040 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4041 * @throws { BusinessError } 19020001 - memory malloc failed. 4042 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 4043 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 4044 * @throws { BusinessError } 19030001 - crypto operation error. 4045 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 4046 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 4047 * @throws { BusinessError } 19030004 - the certificate has expired. 4048 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 4049 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 4050 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 4051 * @syscap SystemCapability.Security.Cert 4052 * @crossplatform 4053 * @atomicservice 4054 * @since 12 4055 */ 4056 validate(certChain: CertChainData, callback: AsyncCallback<void>): void; 4057 4058 /** 4059 * Validate the cert chain. 4060 * 4061 * @param { CertChainData } certChain - indicate the cert chain validator data. 4062 * @returns { Promise<void> } the promise returned by the function. 4063 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4064 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4065 * @throws { BusinessError } 19020001 - memory malloc failed. 4066 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 4067 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 4068 * @throws { BusinessError } 19030001 - crypto operation error. 4069 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 4070 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 4071 * @throws { BusinessError } 19030004 - the certificate has expired. 4072 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 4073 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 4074 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 4075 * @syscap SystemCapability.Security.Cert 4076 * @since 9 4077 */ 4078 /** 4079 * Validate the cert chain. 4080 * 4081 * @param { CertChainData } certChain - indicate the cert chain validator data. 4082 * @returns { Promise<void> } the promise returned by the function. 4083 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4084 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4085 * @throws { BusinessError } 19020001 - memory malloc failed. 4086 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 4087 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 4088 * @throws { BusinessError } 19030001 - crypto operation error. 4089 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 4090 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 4091 * @throws { BusinessError } 19030004 - the certificate has expired. 4092 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 4093 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 4094 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 4095 * @syscap SystemCapability.Security.Cert 4096 * @crossplatform 4097 * @since 11 4098 */ 4099 /** 4100 * Validate the cert chain. 4101 * 4102 * @param { CertChainData } certChain - indicate the cert chain validator data. 4103 * @returns { Promise<void> } the promise returned by the function. 4104 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4105 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4106 * @throws { BusinessError } 19020001 - memory malloc failed. 4107 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 4108 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 4109 * @throws { BusinessError } 19030001 - crypto operation error. 4110 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 4111 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 4112 * @throws { BusinessError } 19030004 - the certificate has expired. 4113 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 4114 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 4115 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 4116 * @syscap SystemCapability.Security.Cert 4117 * @crossplatform 4118 * @atomicservice 4119 * @since 12 4120 */ 4121 validate(certChain: CertChainData): Promise<void>; 4122 4123 /** 4124 * The cert chain related algorithm. 4125 * 4126 * @type { string } 4127 * @readonly 4128 * @syscap SystemCapability.Security.Cert 4129 * @since 9 4130 */ 4131 /** 4132 * The cert chain related algorithm. 4133 * 4134 * @type { string } 4135 * @readonly 4136 * @syscap SystemCapability.Security.Cert 4137 * @crossplatform 4138 * @since 11 4139 */ 4140 /** 4141 * The cert chain related algorithm. 4142 * 4143 * @type { string } 4144 * @readonly 4145 * @syscap SystemCapability.Security.Cert 4146 * @crossplatform 4147 * @atomicservice 4148 * @since 12 4149 */ 4150 readonly algorithm: string; 4151 } 4152 4153 /** 4154 * Provides to create certificate chain object. The returned object provides the verification capability. 4155 * 4156 * @param { string } algorithm - indicates the cert chain validator type. 4157 * @returns { CertChainValidator } the cert chain validator instance. 4158 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4159 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4160 * @throws { BusinessError } 801 - this operation is not supported. 4161 * @throws { BusinessError } 19020001 - memory malloc failed. 4162 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 4163 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 4164 * @throws { BusinessError } 19030001 - crypto operation error. 4165 * @syscap SystemCapability.Security.Cert 4166 * @since 9 4167 */ 4168 /** 4169 * Provides to create certificate chain object. The returned object provides the verification capability. 4170 * 4171 * @param { string } algorithm - indicates the cert chain validator type. 4172 * @returns { CertChainValidator } the cert chain validator instance. 4173 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4174 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4175 * @throws { BusinessError } 801 - this operation is not supported. 4176 * @throws { BusinessError } 19020001 - memory malloc failed. 4177 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 4178 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 4179 * @throws { BusinessError } 19030001 - crypto operation error. 4180 * @syscap SystemCapability.Security.Cert 4181 * @crossplatform 4182 * @since 11 4183 */ 4184 /** 4185 * Provides to create certificate chain object. The returned object provides the verification capability. 4186 * 4187 * @param { string } algorithm - indicates the cert chain validator type. 4188 * @returns { CertChainValidator } the cert chain validator instance. 4189 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4190 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4191 * @throws { BusinessError } 801 - this operation is not supported. 4192 * @throws { BusinessError } 19020001 - memory malloc failed. 4193 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 4194 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 4195 * @throws { BusinessError } 19030001 - crypto operation error. 4196 * @syscap SystemCapability.Security.Cert 4197 * @crossplatform 4198 * @atomicservice 4199 * @since 12 4200 */ 4201 function createCertChainValidator(algorithm: string): CertChainValidator; 4202 4203 /** 4204 * Enum for general name use type. 4205 * 4206 * @enum { number } 4207 * @syscap SystemCapability.Security.Cert 4208 * @crossplatform 4209 * @atomicservice 4210 * @since 12 4211 */ 4212 enum GeneralNameType { 4213 /** 4214 * Indicates the name used for other. 4215 * 4216 * @syscap SystemCapability.Security.Cert 4217 * @crossplatform 4218 * @atomicservice 4219 * @since 12 4220 */ 4221 GENERAL_NAME_TYPE_OTHER_NAME = 0, 4222 4223 /** 4224 * Indicates the name used for RFC822. 4225 * 4226 * @syscap SystemCapability.Security.Cert 4227 * @crossplatform 4228 * @atomicservice 4229 * @since 12 4230 */ 4231 GENERAL_NAME_TYPE_RFC822_NAME = 1, 4232 4233 /** 4234 * Indicates the name used for DNS. 4235 * 4236 * @syscap SystemCapability.Security.Cert 4237 * @crossplatform 4238 * @atomicservice 4239 * @since 12 4240 */ 4241 GENERAL_NAME_TYPE_DNS_NAME = 2, 4242 4243 /** 4244 * Indicates the name used for X.400 address. 4245 * 4246 * @syscap SystemCapability.Security.Cert 4247 * @crossplatform 4248 * @atomicservice 4249 * @since 12 4250 */ 4251 GENERAL_NAME_TYPE_X400_ADDRESS = 3, 4252 4253 /** 4254 * Indicates the name used for X.500 directory. 4255 * 4256 * @syscap SystemCapability.Security.Cert 4257 * @crossplatform 4258 * @atomicservice 4259 * @since 12 4260 */ 4261 GENERAL_NAME_TYPE_DIRECTORY_NAME = 4, 4262 4263 /** 4264 * Indicates the name used for EDI. 4265 * 4266 * @syscap SystemCapability.Security.Cert 4267 * @crossplatform 4268 * @atomicservice 4269 * @since 12 4270 */ 4271 GENERAL_NAME_TYPE_EDI_PARTY_NAME = 5, 4272 4273 /** 4274 * Indicates the name used for URI. 4275 * 4276 * @syscap SystemCapability.Security.Cert 4277 * @crossplatform 4278 * @atomicservice 4279 * @since 12 4280 */ 4281 GENERAL_NAME_TYPE_UNIFORM_RESOURCE_ID = 6, 4282 4283 /** 4284 * Indicates the name used for IP address. 4285 * 4286 * @syscap SystemCapability.Security.Cert 4287 * @crossplatform 4288 * @atomicservice 4289 * @since 12 4290 */ 4291 GENERAL_NAME_TYPE_IP_ADDRESS = 7, 4292 4293 /** 4294 * Indicates the name used for registered ID. 4295 * 4296 * @syscap SystemCapability.Security.Cert 4297 * @crossplatform 4298 * @atomicservice 4299 * @since 12 4300 */ 4301 GENERAL_NAME_TYPE_REGISTERED_ID = 8 4302 } 4303 4304 /** 4305 * GeneralName object 4306 * 4307 * @typedef GeneralName 4308 * @syscap SystemCapability.Security.Cert 4309 * @crossplatform 4310 * @atomicservice 4311 * @since 12 4312 */ 4313 interface GeneralName { 4314 /** 4315 * The general name type. 4316 * 4317 * @type { GeneralNameType } 4318 * @syscap SystemCapability.Security.Cert 4319 * @crossplatform 4320 * @atomicservice 4321 * @since 12 4322 */ 4323 type: GeneralNameType; 4324 4325 /** 4326 * The general name in DER format 4327 * 4328 * @type { ?Uint8Array } 4329 * @syscap SystemCapability.Security.Cert 4330 * @crossplatform 4331 * @atomicservice 4332 * @since 12 4333 */ 4334 name?: Uint8Array; 4335 } 4336 4337 /** 4338 * X509 Cert match parameters 4339 * 4340 * @typedef X509CertMatchParameters 4341 * @syscap SystemCapability.Security.Cert 4342 * @crossplatform 4343 * @since 11 4344 */ 4345 /** 4346 * X509 Cert match parameters 4347 * 4348 * @typedef X509CertMatchParameters 4349 * @syscap SystemCapability.Security.Cert 4350 * @crossplatform 4351 * @atomicservice 4352 * @since 12 4353 */ 4354 interface X509CertMatchParameters { 4355 /** 4356 * To match SubjectAlternativeNames of cert extensions: 4357 * [Rule] 4358 * null : Do not match. 4359 * NOT null : match after [matchAllSubjectAltNames] 4360 * 4361 * @type { ?Array<GeneralName> } SubjectAlternativeNames is in DER encoding format 4362 * @syscap SystemCapability.Security.Cert 4363 * @crossplatform 4364 * @atomicservice 4365 * @since 12 4366 */ 4367 subjectAlternativeNames?: Array<GeneralName>; 4368 4369 /** 4370 * Indicate if match all subject alternate name: 4371 * [Rule] 4372 * true : match if [subjectAlternativeNames] is equal with all of [SubjectAlternativeNames of cert extensions] 4373 * false : match if [subjectAlternativeNames] is only equal with one of [SubjectAlternativeNames of cert extensions] 4374 * 4375 * @type { ?boolean } 4376 * @syscap SystemCapability.Security.Cert 4377 * @crossplatform 4378 * @atomicservice 4379 * @since 12 4380 */ 4381 matchAllSubjectAltNames?: boolean; 4382 4383 /** 4384 * To match AuthorityKeyIdentifier of cert extensions in DER encoding: 4385 * [Rule] 4386 * null : Do not match. 4387 * NOT null : match if it is equal with [AuthorityKeyIdentifier of cert extensions] in DER encoding 4388 * 4389 * @type { ?Uint8Array } the key identifier 4390 * @syscap SystemCapability.Security.Cert 4391 * @crossplatform 4392 * @atomicservice 4393 * @since 12 4394 */ 4395 authorityKeyIdentifier?: Uint8Array; 4396 4397 /** 4398 * To match BaseConstraints.pathLenConstraint of cert extensions: 4399 * [Rule] 4400 * >=0 : The certificate must contain BaseConstraints extension, and the cA field in the extension takes. 4401 * -2 : The cA field in the BaseConstraints extension of the certificate must be set to false or the certificate does not contain BaseConstraints extension. 4402 * other : Do not match. 4403 * 4404 * @type { ?number } 4405 * @syscap SystemCapability.Security.Cert 4406 * @crossplatform 4407 * @atomicservice 4408 * @since 12 4409 */ 4410 minPathLenConstraint?: number; 4411 4412 /** 4413 * To match X509Cert: 4414 * [Rule] 4415 * null : Do not match. 4416 * NOT null : match if x509Cert.getEncoding is equal. 4417 * 4418 * @type { ?X509Cert } 4419 * @syscap SystemCapability.Security.Cert 4420 * @crossplatform 4421 * @since 11 4422 */ 4423 /** 4424 * To match X509Cert: 4425 * [Rule] 4426 * null : Do not match. 4427 * NOT null : match if x509Cert.getEncoding is equal. 4428 * 4429 * @type { ?X509Cert } 4430 * @syscap SystemCapability.Security.Cert 4431 * @crossplatform 4432 * @atomicservice 4433 * @since 12 4434 */ 4435 x509Cert?: X509Cert; 4436 4437 /** 4438 * To match the validDate of cert: 4439 * [Rule] 4440 * null : Do not match. 4441 * NOT null : match if [notBefore of cert] <= [validDate] <= [notAfter of cert]. 4442 * 4443 * @type { ?string } format is YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ. 4444 * @syscap SystemCapability.Security.Cert 4445 * @crossplatform 4446 * @since 11 4447 */ 4448 /** 4449 * To match the validDate of cert: 4450 * [Rule] 4451 * null : Do not match. 4452 * NOT null : match if [notBefore of cert] <= [validDate] <= [notAfter of cert]. 4453 * 4454 * @type { ?string } format is YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ. 4455 * @syscap SystemCapability.Security.Cert 4456 * @crossplatform 4457 * @atomicservice 4458 * @since 12 4459 */ 4460 validDate?: string; 4461 4462 /** 4463 * To match the issuer of cert: 4464 * [Rule] 4465 * null : Do not match. 4466 * NOT null : match if it is equal with [issuer of cert] in DER encoding. 4467 * 4468 * @type { ?Uint8Array } 4469 * @syscap SystemCapability.Security.Cert 4470 * @crossplatform 4471 * @since 11 4472 */ 4473 /** 4474 * To match the issuer of cert: 4475 * [Rule] 4476 * null : Do not match. 4477 * NOT null : match if it is equal with [issuer of cert] in DER encoding. 4478 * 4479 * @type { ?Uint8Array } 4480 * @syscap SystemCapability.Security.Cert 4481 * @crossplatform 4482 * @atomicservice 4483 * @since 12 4484 */ 4485 issuer?: Uint8Array; 4486 4487 /** 4488 * To match the ExtendedKeyUsage of cert extensions: 4489 * [Rule] 4490 * null : Do not match. 4491 * NOT null : match ok if [ExtendedKeyUsage of cert extensions] is null, or 4492 * [ExtendedKeyUsage of cert extensions] include [extendedKeyUsage]. 4493 * 4494 * @type { ?Array<string> } array of oIDs. 4495 * @syscap SystemCapability.Security.Cert 4496 * @crossplatform 4497 * @atomicservice 4498 * @since 12 4499 */ 4500 extendedKeyUsage?: Array<string>; 4501 4502 /** 4503 * The X509Certificate must have subject and subject alternative names that meet the specified name constraints: 4504 * [Rule] 4505 * null : Do not match. 4506 * NOT null : match ok if [NameConstraints of cert extensions] is null, or 4507 * [NameConstraints of cert extensions] include [nameConstraints]. 4508 * 4509 * @type { ?Uint8Array } ASN.1 DER encoded form of nameConstraints 4510 * @syscap SystemCapability.Security.Cert 4511 * @crossplatform 4512 * @atomicservice 4513 * @since 12 4514 */ 4515 nameConstraints?: Uint8Array; 4516 4517 /** 4518 * The X509Certificate must have subject and subject alternative names that meet the specified name constraints: 4519 * [Rule] 4520 * null : Do not match. 4521 * NOT null : match ok if [Certificate Policies of cert extensions] is null, or 4522 * [Certificate Policies of cert extensions] include [certPolicy]. 4523 * 4524 * @type { ?Array<string> } array of oIDs. 4525 * @syscap SystemCapability.Security.Cert 4526 * @crossplatform 4527 * @atomicservice 4528 * @since 12 4529 */ 4530 certPolicy?: Array<string>; 4531 4532 /** 4533 * The specified date must fall within the private key validity period for the X509Certificate: 4534 * [Rule] 4535 * null : Do not match. 4536 * NOT null : match ok if [Private Key Valid Period of cert extensions] is null, or 4537 * [privateKeyValid] fall in [Private Key Valid Period of cert extensions]. 4538 * 4539 * @type { ?string } format is YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ 4540 * @syscap SystemCapability.Security.Cert 4541 * @crossplatform 4542 * @atomicservice 4543 * @since 12 4544 */ 4545 privateKeyValid?: string; 4546 4547 /** 4548 * To match the KeyUsage of cert extensions: 4549 * [Rule] 4550 * null : Do not match. 4551 * NOT null : match ok if [KeyUsage of cert extensions] is null, or 4552 * [KeyUsage of cert extensions] include [keyUsage]. 4553 * 4554 * @type { ?Array<boolean> } 4555 * @syscap SystemCapability.Security.Cert 4556 * @crossplatform 4557 * @since 11 4558 */ 4559 /** 4560 * To match the KeyUsage of cert extensions: 4561 * [Rule] 4562 * null : Do not match. 4563 * NOT null : match ok if [KeyUsage of cert extensions] is null, or 4564 * [KeyUsage of cert extensions] include [keyUsage]. 4565 * 4566 * @type { ?Array<boolean> } 4567 * @syscap SystemCapability.Security.Cert 4568 * @crossplatform 4569 * @atomicservice 4570 * @since 12 4571 */ 4572 keyUsage?: Array<boolean>; 4573 4574 /** 4575 * The specified serial number must match the serialnumber for the X509Certificate: 4576 * [Rule] 4577 * null : Do not match. 4578 * NOT null : match ok if it is equal with [serialNumber of cert]. 4579 * 4580 * @type { ?bigint } 4581 * @syscap SystemCapability.Security.Cert 4582 * @crossplatform 4583 * @since 11 4584 */ 4585 /** 4586 * The specified serial number must match the serialnumber for the X509Certificate: 4587 * [Rule] 4588 * null : Do not match. 4589 * NOT null : match ok if it is equal with [serialNumber of cert]. 4590 * 4591 * @type { ?bigint } 4592 * @syscap SystemCapability.Security.Cert 4593 * @crossplatform 4594 * @atomicservice 4595 * @since 12 4596 */ 4597 serialNumber?: bigint; 4598 4599 /** 4600 * The specified value must match the subject for the X509Certificate: 4601 * [Rule] 4602 * null : Do not match. 4603 * NOT null : match ok if it is equal with [subject of cert]. 4604 * 4605 * @type { ?Uint8Array } subject in DER encoding format 4606 * @syscap SystemCapability.Security.Cert 4607 * @crossplatform 4608 * @since 11 4609 */ 4610 /** 4611 * The specified value must match the subject for the X509Certificate: 4612 * [Rule] 4613 * null : Do not match. 4614 * NOT null : match ok if it is equal with [subject of cert]. 4615 * 4616 * @type { ?Uint8Array } subject in DER encoding format 4617 * @syscap SystemCapability.Security.Cert 4618 * @crossplatform 4619 * @atomicservice 4620 * @since 12 4621 */ 4622 subject?: Uint8Array; 4623 4624 /** 4625 * The specified value must match the Subject Key Identifier extension for the X509Certificate: 4626 * [Rule] 4627 * null : Do not match. 4628 * NOT null : match ok if it is equal with [Subject Key Identifier of cert extensions]. 4629 * 4630 * @type { ?Uint8Array } subjectKeyIdentifier in DER encoding format ?? 4631 * @syscap SystemCapability.Security.Cert 4632 * @crossplatform 4633 * @atomicservice 4634 * @since 12 4635 */ 4636 subjectKeyIdentifier?: Uint8Array; 4637 4638 /** 4639 * The specified value must match the publicKey for the X509Certificate: 4640 * [Rule] 4641 * null : Do not match. 4642 * NOT null : match ok if it is equal with [publicKey of cert]. 4643 * 4644 * @type { ?DataBlob } publicKey 4645 * @syscap SystemCapability.Security.Cert 4646 * @crossplatform 4647 * @since 11 4648 */ 4649 /** 4650 * The specified value must match the publicKey for the X509Certificate: 4651 * [Rule] 4652 * null : Do not match. 4653 * NOT null : match ok if it is equal with [publicKey of cert]. 4654 * 4655 * @type { ?DataBlob } publicKey 4656 * @syscap SystemCapability.Security.Cert 4657 * @crossplatform 4658 * @atomicservice 4659 * @since 12 4660 */ 4661 publicKey?: DataBlob; 4662 4663 /** 4664 * The specified value must match the publicKey for the X509Certificate: 4665 * [Rule] 4666 * null : Do not match. 4667 * NOT null : match ok if it is equal with [publicKey of cert]. 4668 * 4669 * @type { ?string } the object identifier (OID) of the signature algorithm to check. 4670 * @syscap SystemCapability.Security.Cert 4671 * @crossplatform 4672 * @since 11 4673 */ 4674 /** 4675 * The specified value must match the publicKey for the X509Certificate: 4676 * [Rule] 4677 * null : Do not match. 4678 * NOT null : match ok if it is equal with [publicKey of cert]. 4679 * 4680 * @type { ?string } the object identifier (OID) of the signature algorithm to check. 4681 * @syscap SystemCapability.Security.Cert 4682 * @crossplatform 4683 * @atomicservice 4684 * @since 12 4685 */ 4686 publicKeyAlgID?: string; 4687 } 4688 4689 /** 4690 * X509 CRL match parameters 4691 * 4692 * @typedef X509CRLMatchParameters 4693 * @syscap SystemCapability.Security.Cert 4694 * @crossplatform 4695 * @since 11 4696 */ 4697 /** 4698 * X509 CRL match parameters 4699 * 4700 * @typedef X509CRLMatchParameters 4701 * @syscap SystemCapability.Security.Cert 4702 * @crossplatform 4703 * @atomicservice 4704 * @since 12 4705 */ 4706 interface X509CRLMatchParameters { 4707 /** 4708 * To match the issuer of cert: 4709 * [Rule] 4710 * null : Do not match. 4711 * NOT null : match if it is equal with [issuer of cert] in DER encoding. 4712 * 4713 * @type { ?Array<Uint8Array> } 4714 * @syscap SystemCapability.Security.Cert 4715 * @crossplatform 4716 * @since 11 4717 */ 4718 /** 4719 * To match the issuer of cert: 4720 * [Rule] 4721 * null : Do not match. 4722 * NOT null : match if it is equal with [issuer of cert] in DER encoding. 4723 * 4724 * @type { ?Array<Uint8Array> } 4725 * @syscap SystemCapability.Security.Cert 4726 * @crossplatform 4727 * @atomicservice 4728 * @since 12 4729 */ 4730 issuer?: Array<Uint8Array>; 4731 4732 /** 4733 * To match X509Cert: 4734 * [Rule] 4735 * null : Do not match. 4736 * NOT null : match if x509Cert.getEncoding is equal. 4737 * 4738 * @type { ?X509Cert } 4739 * @syscap SystemCapability.Security.Cert 4740 * @crossplatform 4741 * @since 11 4742 */ 4743 /** 4744 * To match X509Cert: 4745 * [Rule] 4746 * null : Do not match. 4747 * NOT null : match if x509Cert.getEncoding is equal. 4748 * 4749 * @type { ?X509Cert } 4750 * @syscap SystemCapability.Security.Cert 4751 * @crossplatform 4752 * @atomicservice 4753 * @since 12 4754 */ 4755 x509Cert?: X509Cert; 4756 4757 /** 4758 * To match updateDateTime of CRL: 4759 * [Rule] 4760 * null : Do not verify. 4761 * NOT null : verify if [thisUpdate in CRL] <= updateDateTime <= [nextUpdate in CRL] 4762 * 4763 * @type { ?string } 4764 * @syscap SystemCapability.Security.Cert 4765 * @crossplatform 4766 * @atomicservice 4767 * @since 12 4768 */ 4769 updateDateTime?: string; 4770 4771 /** 4772 * To match the maximum of CRL number extension: 4773 * [Rule] 4774 * null : Do not verify. 4775 * NOT null : verify if [CRL number extension] <= maxCRL. 4776 * 4777 * @type { ?bigint } 4778 * @syscap SystemCapability.Security.Cert 4779 * @crossplatform 4780 * @atomicservice 4781 * @since 12 4782 */ 4783 maxCRL?: bigint; 4784 4785 /** 4786 * To match the minimum of CRL number extension: 4787 * [Rule] 4788 * null : Do not verify. 4789 * NOT null : verify if [CRL number extension] >= minCRL. 4790 * 4791 * @type { ?bigint } 4792 * @syscap SystemCapability.Security.Cert 4793 * @crossplatform 4794 * @atomicservice 4795 * @since 12 4796 */ 4797 minCRL?: bigint; 4798 } 4799 4800 /** 4801 * The certificate and CRL collection object. 4802 * 4803 * @typedef CertCRLCollection 4804 * @syscap SystemCapability.Security.Cert 4805 * @crossplatform 4806 * @since 11 4807 */ 4808 /** 4809 * The certificate and CRL collection object. 4810 * 4811 * @typedef CertCRLCollection 4812 * @syscap SystemCapability.Security.Cert 4813 * @crossplatform 4814 * @atomicservice 4815 * @since 12 4816 */ 4817 interface CertCRLCollection { 4818 /** 4819 * return all Array<X509Cert> which match X509CertMatchParameters 4820 * 4821 * @param { X509CertMatchParameters } param - indicate the X509CertMatchParameters object. 4822 * @returns { Promise<Array<X509Cert>> } 4823 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4824 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4825 * @throws { BusinessError } 19020001 - memory malloc failed. 4826 * @throws { BusinessError } 19030001 - crypto operation error. 4827 * @syscap SystemCapability.Security.Cert 4828 * @crossplatform 4829 * @since 11 4830 */ 4831 /** 4832 * return all Array<X509Cert> which match X509CertMatchParameters 4833 * 4834 * @param { X509CertMatchParameters } param - indicate the X509CertMatchParameters object. 4835 * @returns { Promise<Array<X509Cert>> } 4836 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4837 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4838 * @throws { BusinessError } 19020001 - memory malloc failed. 4839 * @throws { BusinessError } 19030001 - crypto operation error. 4840 * @syscap SystemCapability.Security.Cert 4841 * @crossplatform 4842 * @atomicservice 4843 * @since 12 4844 */ 4845 selectCerts(param: X509CertMatchParameters): Promise<Array<X509Cert>>; 4846 4847 /** 4848 * return the X509 Cert which match X509CertMatchParameters 4849 * 4850 * @param { X509CertMatchParameters } param - indicate the X509CertMatchParameters object. 4851 * @param { AsyncCallback<Array<X509Cert>> } callback - the callback of select cert. 4852 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4853 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4854 * @throws { BusinessError } 19020001 - memory malloc failed. 4855 * @throws { BusinessError } 19030001 - crypto operation error. 4856 * @syscap SystemCapability.Security.Cert 4857 * @crossplatform 4858 * @since 11 4859 */ 4860 /** 4861 * return the X509 Cert which match X509CertMatchParameters 4862 * 4863 * @param { X509CertMatchParameters } param - indicate the X509CertMatchParameters object. 4864 * @param { AsyncCallback<Array<X509Cert>> } callback - the callback of select cert. 4865 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4866 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4867 * @throws { BusinessError } 19020001 - memory malloc failed. 4868 * @throws { BusinessError } 19030001 - crypto operation error. 4869 * @syscap SystemCapability.Security.Cert 4870 * @crossplatform 4871 * @atomicservice 4872 * @since 12 4873 */ 4874 selectCerts(param: X509CertMatchParameters, callback: AsyncCallback<Array<X509Cert>>): void; 4875 4876 /** 4877 * return all X509 CRL which match X509CRLMatchParameters 4878 * 4879 * @param { X509CRLMatchParameters } param - indicate the X509CRLMatchParameters object. 4880 * @returns { Promise<Array<X509CRL>> } 4881 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4882 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4883 * @throws { BusinessError } 19020001 - memory malloc failed. 4884 * @throws { BusinessError } 19030001 - crypto operation error. 4885 * @syscap SystemCapability.Security.Cert 4886 * @crossplatform 4887 * @since 11 4888 */ 4889 /** 4890 * return all X509 CRL which match X509CRLMatchParameters 4891 * 4892 * @param { X509CRLMatchParameters } param - indicate the X509CRLMatchParameters object. 4893 * @returns { Promise<Array<X509CRL>> } 4894 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4895 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4896 * @throws { BusinessError } 19020001 - memory malloc failed. 4897 * @throws { BusinessError } 19030001 - crypto operation error. 4898 * @syscap SystemCapability.Security.Cert 4899 * @crossplatform 4900 * @atomicservice 4901 * @since 12 4902 */ 4903 selectCRLs(param: X509CRLMatchParameters): Promise<Array<X509CRL>>; 4904 4905 /** 4906 * return all X509 CRL which match X509CRLMatchParameters 4907 * 4908 * @param { X509CRLMatchParameters } param - indicate the X509CRLMatchParameters object. 4909 * @param { AsyncCallback<Array<X509CRL>> } callback - the callback of select CRL. 4910 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4911 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4912 * @throws { BusinessError } 19020001 - memory malloc failed. 4913 * @throws { BusinessError } 19030001 - crypto operation error. 4914 * @syscap SystemCapability.Security.Cert 4915 * @crossplatform 4916 * @since 11 4917 */ 4918 /** 4919 * return all X509 CRL which match X509CRLMatchParameters 4920 * 4921 * @param { X509CRLMatchParameters } param - indicate the X509CRLMatchParameters object. 4922 * @param { AsyncCallback<Array<X509CRL>> } callback - the callback of select CRL. 4923 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4924 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4925 * @throws { BusinessError } 19020001 - memory malloc failed. 4926 * @throws { BusinessError } 19030001 - crypto operation error. 4927 * @syscap SystemCapability.Security.Cert 4928 * @crossplatform 4929 * @atomicservice 4930 * @since 12 4931 */ 4932 selectCRLs(param: X509CRLMatchParameters, callback: AsyncCallback<Array<X509CRL>>): void; 4933 } 4934 4935 /** 4936 * create object CertCRLCollection 4937 * 4938 * @param { Array<X509Cert> } certs - array of X509Cert. 4939 * @param { Array<X509CRL> } [options] crls - array of X509CRL. 4940 * @returns { CertCRLCollection } 4941 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4942 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4943 * @throws { BusinessError } 19020001 - memory malloc failed. 4944 * @syscap SystemCapability.Security.Cert 4945 * @crossplatform 4946 * @since 11 4947 */ 4948 /** 4949 * create object CertCRLCollection 4950 * 4951 * @param { Array<X509Cert> } certs - array of X509Cert. 4952 * @param { Array<X509CRL> } [crls] - array of X509CRL. 4953 * @returns { CertCRLCollection } 4954 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4955 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4956 * @throws { BusinessError } 19020001 - memory malloc failed. 4957 * @syscap SystemCapability.Security.Cert 4958 * @crossplatform 4959 * @atomicservice 4960 * @since 12 4961 */ 4962 function createCertCRLCollection(certs: Array<X509Cert>, crls?: Array<X509CRL>): CertCRLCollection; 4963 4964 /** 4965 * X509 Certification chain object. 4966 * 4967 * @typedef X509CertChain 4968 * @syscap SystemCapability.Security.Cert 4969 * @crossplatform 4970 * @since 11 4971 */ 4972 /** 4973 * X509 Certification chain object. 4974 * 4975 * @typedef X509CertChain 4976 * @syscap SystemCapability.Security.Cert 4977 * @crossplatform 4978 * @atomicservice 4979 * @since 12 4980 */ 4981 interface X509CertChain { 4982 /** 4983 * Get the X509 certificate list. 4984 * 4985 * @returns { Array<X509Cert> } the X509 certificate list. 4986 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4987 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 4988 * @throws { BusinessError } 19020001 - memory malloc failed. 4989 * @throws { BusinessError } 19030001 - crypto operation error. 4990 * @syscap SystemCapability.Security.Cert 4991 * @crossplatform 4992 * @since 11 4993 */ 4994 /** 4995 * Get the X509 certificate list. 4996 * 4997 * @returns { Array<X509Cert> } the X509 certificate list. 4998 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 4999 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5000 * @throws { BusinessError } 19020001 - memory malloc failed. 5001 * @throws { BusinessError } 19030001 - crypto operation error. 5002 * @syscap SystemCapability.Security.Cert 5003 * @crossplatform 5004 * @atomicservice 5005 * @since 12 5006 */ 5007 getCertList(): Array<X509Cert>; 5008 5009 /** 5010 * Validate the cert chain with validate parameters. 5011 * 5012 * @param { CertChainValidationParameters } param - indicate the cert chain Validate parameters. 5013 * @returns { Promise<CertChainValidationResult> } the promise returned by the function. 5014 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5015 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5016 * @throws { BusinessError } 19020001 - memory malloc failed. 5017 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5018 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5019 * @throws { BusinessError } 19030001 - crypto operation error. 5020 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 5021 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 5022 * @throws { BusinessError } 19030004 - the certificate has expired. 5023 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 5024 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 5025 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 5026 * @syscap SystemCapability.Security.Cert 5027 * @crossplatform 5028 * @since 11 5029 */ 5030 /** 5031 * Validate the cert chain with validate parameters. 5032 * 5033 * @param { CertChainValidationParameters } param - indicate the cert chain Validate parameters. 5034 * @returns { Promise<CertChainValidationResult> } the promise returned by the function. 5035 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5036 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5037 * @throws { BusinessError } 19020001 - memory malloc failed. 5038 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5039 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5040 * @throws { BusinessError } 19030001 - crypto operation error. 5041 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 5042 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 5043 * @throws { BusinessError } 19030004 - the certificate has expired. 5044 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 5045 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 5046 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 5047 * @syscap SystemCapability.Security.Cert 5048 * @crossplatform 5049 * @atomicservice 5050 * @since 12 5051 */ 5052 validate(param: CertChainValidationParameters): Promise<CertChainValidationResult>; 5053 5054 /** 5055 * Validate the cert chain with validate parameters. 5056 * 5057 * @param { CertChainValidationParameters } param - indicate the cert chain validate parameters. 5058 * @param { AsyncCallback<CertChainValidationResult> } callback - indicate the cert chain validate result. 5059 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5060 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5061 * @throws { BusinessError } 19020001 - memory malloc failed. 5062 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5063 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5064 * @throws { BusinessError } 19030001 - crypto operation error. 5065 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 5066 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 5067 * @throws { BusinessError } 19030004 - the certificate has expired. 5068 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 5069 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 5070 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 5071 * @syscap SystemCapability.Security.Cert 5072 * @crossplatform 5073 * @since 11 5074 */ 5075 /** 5076 * Validate the cert chain with validate parameters. 5077 * 5078 * @param { CertChainValidationParameters } param - indicate the cert chain validate parameters. 5079 * @param { AsyncCallback<CertChainValidationResult> } callback - indicate the cert chain validate result. 5080 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5081 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5082 * @throws { BusinessError } 19020001 - memory malloc failed. 5083 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5084 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5085 * @throws { BusinessError } 19030001 - crypto operation error. 5086 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 5087 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 5088 * @throws { BusinessError } 19030004 - the certificate has expired. 5089 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 5090 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 5091 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 5092 * @syscap SystemCapability.Security.Cert 5093 * @crossplatform 5094 * @atomicservice 5095 * @since 12 5096 */ 5097 validate(param: CertChainValidationParameters, callback: AsyncCallback<CertChainValidationResult>): void; 5098 5099 /** 5100 * Get the string type data of the object. 5101 * 5102 * @returns { string } the string type data of the object. 5103 * @throws { BusinessError } 19020001 - memory malloc failed. 5104 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5105 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5106 * @throws { BusinessError } 19030001 - crypto operation error. 5107 * @syscap SystemCapability.Security.Cert 5108 * @crossplatform 5109 * @atomicservice 5110 * @since 12 5111 */ 5112 toString(): string; 5113 5114 /** 5115 * Get the hash value of DER format data. 5116 * 5117 * @returns { Uint8Array } the hash value of DER format data. 5118 * @throws { BusinessError } 19020001 - memory malloc failed. 5119 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5120 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5121 * @throws { BusinessError } 19030001 - crypto operation error. 5122 * @syscap SystemCapability.Security.Cert 5123 * @crossplatform 5124 * @atomicservice 5125 * @since 12 5126 */ 5127 hashCode(): Uint8Array; 5128 } 5129 5130 /** 5131 * Provides to create X509 certificate chain object. 5132 * The returned object provides the data parsing or verification capability. 5133 * 5134 * @param { EncodingBlob } inStream - indicate the input cert data. 5135 * @returns { Promise<X509CertChain> } 5136 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5137 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5138 * @throws { BusinessError } 19020001 - memory malloc failed. 5139 * @throws { BusinessError } 19030001 - crypto operation error. 5140 * @syscap SystemCapability.Security.Cert 5141 * @crossplatform 5142 * @since 11 5143 */ 5144 /** 5145 * Provides to create X509 certificate chain object. 5146 * The returned object provides the data parsing or verification capability. 5147 * 5148 * @param { EncodingBlob } inStream - indicate the input cert data. 5149 * @returns { Promise<X509CertChain> } 5150 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5151 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5152 * @throws { BusinessError } 19020001 - memory malloc failed. 5153 * @throws { BusinessError } 19030001 - crypto operation error. 5154 * @syscap SystemCapability.Security.Cert 5155 * @crossplatform 5156 * @atomicservice 5157 * @since 12 5158 */ 5159 function createX509CertChain(inStream: EncodingBlob): Promise<X509CertChain>; 5160 5161 /** 5162 * Provides to create X509 certificate chain object. 5163 * The returned object provides the data parsing or verification capability. 5164 * 5165 * @param { EncodingBlob } inStream - indicate the input cert data. 5166 * @param { AsyncCallback<X509CertChain> } callback 5167 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5168 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5169 * @throws { BusinessError } 19020001 - memory malloc failed. 5170 * @throws { BusinessError } 19030001 - crypto operation error. 5171 * @syscap SystemCapability.Security.Cert 5172 * @crossplatform 5173 * @since 11 5174 */ 5175 /** 5176 * Provides to create X509 certificate chain object. 5177 * The returned object provides the data parsing or verification capability. 5178 * 5179 * @param { EncodingBlob } inStream - indicate the input cert data. 5180 * @param { AsyncCallback<X509CertChain> } callback 5181 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5182 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5183 * @throws { BusinessError } 19020001 - memory malloc failed. 5184 * @throws { BusinessError } 19030001 - crypto operation error. 5185 * @syscap SystemCapability.Security.Cert 5186 * @crossplatform 5187 * @atomicservice 5188 * @since 12 5189 */ 5190 function createX509CertChain(inStream: EncodingBlob, callback: AsyncCallback<X509CertChain>): void; 5191 5192 /** 5193 * Create certificate chain object with certificate array. 5194 * 5195 * @param { Array<X509Cert> } certs - indicate the certificate array. 5196 * @returns { X509CertChain } the certificate chain object. 5197 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5198 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5199 * @throws { BusinessError } 19020001 - memory malloc failed. 5200 * @throws { BusinessError } 19030001 - crypto operation error. 5201 * @syscap SystemCapability.Security.Cert 5202 * @crossplatform 5203 * @since 11 5204 */ 5205 /** 5206 * Create certificate chain object with certificate array. 5207 * 5208 * @param { Array<X509Cert> } certs - indicate the certificate array. 5209 * @returns { X509CertChain } the certificate chain object. 5210 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5211 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5212 * @throws { BusinessError } 19020001 - memory malloc failed. 5213 * @throws { BusinessError } 19030001 - crypto operation error. 5214 * @syscap SystemCapability.Security.Cert 5215 * @crossplatform 5216 * @atomicservice 5217 * @since 12 5218 */ 5219 function createX509CertChain(certs: Array<X509Cert>): X509CertChain; 5220 5221 /** 5222 * Create and validate a certificate chain with the build parameters. 5223 * 5224 * @param { CertChainBuildParameters } param - indicate the certificate chain build parameters. 5225 * @returns { Promise<CertChainBuildResult> } the promise returned by the function. 5226 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5227 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5228 * @throws { BusinessError } 19020001 - memory malloc failed. 5229 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5230 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5231 * @throws { BusinessError } 19030001 - crypto operation error. 5232 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 5233 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 5234 * @throws { BusinessError } 19030004 - the certificate has expired. 5235 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 5236 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 5237 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 5238 * @syscap SystemCapability.Security.Cert 5239 * @crossplatform 5240 * @atomicservice 5241 * @since 12 5242 */ 5243 function buildX509CertChain(param: CertChainBuildParameters): Promise<CertChainBuildResult>; 5244 5245 /** 5246 * The encoding base format. 5247 * 5248 * @enum { number } 5249 * @syscap SystemCapability.Security.Cert 5250 * @crossplatform 5251 * @atomicservice 5252 * @since 18 5253 */ 5254 enum EncodingBaseFormat { 5255 /** 5256 * PEM format. 5257 * 5258 * @syscap SystemCapability.Security.Cert 5259 * @crossplatform 5260 * @atomicservice 5261 * @since 18 5262 */ 5263 PEM = 0, 5264 5265 /** 5266 * DER format. 5267 * 5268 * @syscap SystemCapability.Security.Cert 5269 * @crossplatform 5270 * @atomicservice 5271 * @since 18 5272 */ 5273 DER = 1, 5274 } 5275 5276 /** 5277 * PKCS12 data. 5278 * 5279 * @typedef Pkcs12Data 5280 * @syscap SystemCapability.Security.Cert 5281 * @crossplatform 5282 * @atomicservice 5283 * @since 18 5284 */ 5285 interface Pkcs12Data { 5286 /** 5287 * The private key. 5288 * 5289 * @type { ?(string | Uint8Array) } 5290 * @syscap SystemCapability.Security.Cert 5291 * @crossplatform 5292 * @atomicservice 5293 * @since 18 5294 */ 5295 privateKey?: string | Uint8Array; 5296 5297 /** 5298 * The certificate corresponding to the private key. 5299 * 5300 * @type { ?X509Cert } 5301 * @syscap SystemCapability.Security.Cert 5302 * @crossplatform 5303 * @atomicservice 5304 * @since 18 5305 */ 5306 cert?: X509Cert; 5307 5308 /** 5309 * The other certificates. 5310 * 5311 * @type { ?Array<X509Cert> } 5312 * @syscap SystemCapability.Security.Cert 5313 * @crossplatform 5314 * @atomicservice 5315 * @since 18 5316 */ 5317 otherCerts?: Array<X509Cert>; 5318 } 5319 5320 /** 5321 * PKCS12 parsing config. 5322 * 5323 * @typedef Pkcs12ParsingConfig 5324 * @syscap SystemCapability.Security.Cert 5325 * @crossplatform 5326 * @atomicservice 5327 * @since 18 5328 */ 5329 interface Pkcs12ParsingConfig { 5330 /** 5331 * The password of the PKCS12. 5332 * 5333 * @type { string } 5334 * @syscap SystemCapability.Security.Cert 5335 * @crossplatform 5336 * @atomicservice 5337 * @since 18 5338 */ 5339 password: string; 5340 5341 /** 5342 * Whether to get the private key. 5343 * 5344 * @type { ?boolean } 5345 * @default true 5346 * @syscap SystemCapability.Security.Cert 5347 * @crossplatform 5348 * @atomicservice 5349 * @since 18 5350 */ 5351 needsPrivateKey?: boolean; 5352 5353 /** 5354 * The output format of the private key. 5355 * 5356 * @type { ?EncodingBaseFormat } 5357 * @default EncodingBaseFormat.PEM 5358 * @syscap SystemCapability.Security.Cert 5359 * @crossplatform 5360 * @atomicservice 5361 * @since 18 5362 */ 5363 privateKeyFormat?: EncodingBaseFormat; 5364 5365 /** 5366 * Whether to get the certificate corresponding to the private key. 5367 * 5368 * @type { ?boolean } 5369 * @default true 5370 * @syscap SystemCapability.Security.Cert 5371 * @crossplatform 5372 * @atomicservice 5373 * @since 18 5374 */ 5375 needsCert?: boolean; 5376 5377 /** 5378 * Whether to get other certificates. 5379 * 5380 * @type { ?boolean } 5381 * @default false 5382 * @syscap SystemCapability.Security.Cert 5383 * @crossplatform 5384 * @atomicservice 5385 * @since 18 5386 */ 5387 needsOtherCerts?: boolean; 5388 } 5389 5390 /** 5391 * Parse PKCS12. 5392 * 5393 * @param { Uint8Array } data - the PKCS12 data. 5394 * @param { Pkcs12ParsingConfig } config - the configuration for parsing PKCS12. 5395 * @returns { Pkcs12Data } the Pkcs12Data. 5396 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5397 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5398 * @throws { BusinessError } 19020001 - memory malloc failed. 5399 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5400 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5401 * @throws { BusinessError } 19030001 - crypto operation error. 5402 * @throws { BusinessError } 19030008 - maybe wrong password. 5403 * @syscap SystemCapability.Security.Cert 5404 * @crossplatform 5405 * @atomicservice 5406 * @since 18 5407 */ 5408 function parsePkcs12(data: Uint8Array, config: Pkcs12ParsingConfig): Pkcs12Data; 5409 5410 /** 5411 * Get trust anchor array from specified P12. 5412 * 5413 * @param { Uint8Array } keystore - the file path of the P12. 5414 * @param { string } pwd - the password of the P12. 5415 * @returns { Promise<Array<X509TrustAnchor>> } the promise returned by the function. 5416 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5417 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5418 * @throws { BusinessError } 19020001 - memory malloc failed. 5419 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5420 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5421 * @throws { BusinessError } 19030001 - crypto operation error. 5422 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 5423 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 5424 * @throws { BusinessError } 19030004 - the certificate has expired. 5425 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 5426 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 5427 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 5428 * @syscap SystemCapability.Security.Cert 5429 * @crossplatform 5430 * @atomicservice 5431 * @since 12 5432 */ 5433 function createTrustAnchorsWithKeyStore(keystore: Uint8Array, pwd: string): Promise<Array<X509TrustAnchor>>; 5434 5435 /** 5436 * Create X500DistinguishedName object with the name in string format. 5437 * 5438 * @param { string } nameStr - the string format of the Name type defined by X509. 5439 * @returns { Promise<X500DistinguishedName> } the promise returned by the function. 5440 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5441 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5442 * @throws { BusinessError } 19020001 - memory malloc failed. 5443 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5444 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5445 * @throws { BusinessError } 19030001 - crypto operation error. 5446 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 5447 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 5448 * @throws { BusinessError } 19030004 - the certificate has expired. 5449 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 5450 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 5451 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 5452 * @syscap SystemCapability.Security.Cert 5453 * @crossplatform 5454 * @atomicservice 5455 * @since 12 5456 */ 5457 function createX500DistinguishedName(nameStr: string): Promise<X500DistinguishedName>; 5458 5459 /** 5460 * Create X500DistinguishedName object with the name in DER format. 5461 * 5462 * @param { Uint8Array } nameDer - the DER format of the Name type defined by X509. 5463 * @returns { Promise<X500DistinguishedName> } the promise returned by the function. 5464 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5465 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5466 * @throws { BusinessError } 19020001 - memory malloc failed. 5467 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5468 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5469 * @throws { BusinessError } 19030001 - crypto operation error. 5470 * @throws { BusinessError } 19030002 - the certificate signature verification failed. 5471 * @throws { BusinessError } 19030003 - the certificate has not taken effect. 5472 * @throws { BusinessError } 19030004 - the certificate has expired. 5473 * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. 5474 * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. 5475 * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. 5476 * @syscap SystemCapability.Security.Cert 5477 * @crossplatform 5478 * @atomicservice 5479 * @since 12 5480 */ 5481 function createX500DistinguishedName(nameDer: Uint8Array): Promise<X500DistinguishedName>; 5482 5483 /** 5484 * Provides the x500 distinguished name type. 5485 * 5486 * @typedef X500DistinguishedName 5487 * @syscap SystemCapability.Security.Cert 5488 * @crossplatform 5489 * @atomicservice 5490 * @since 12 5491 */ 5492 interface X500DistinguishedName { 5493 /** 5494 * Get distinguished name string in ASCII encoding type. 5495 * 5496 * @returns { string } distinguished name string. 5497 * @throws { BusinessError } 19020001 - memory malloc failed. 5498 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5499 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5500 * @throws { BusinessError } 19030001 - crypto operation error. 5501 * @syscap SystemCapability.Security.Cert 5502 * @crossplatform 5503 * @atomicservice 5504 * @since 12 5505 */ 5506 getName(): string; 5507 5508 /** 5509 * Get distinguished name string according to the encoding type. 5510 * 5511 * @param { EncodingType } encodingType - the specified encoding type. 5512 * @returns { string } distinguished name string. 5513 * @throws { BusinessError } 19020001 - memory malloc failed. 5514 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5515 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5516 * @throws { BusinessError } 19020003 - parameter check failed. Possible causes: 5517 * <br>1. The value of encodingType is not in the EncodingType enumeration range. 5518 * @throws { BusinessError } 19030001 - crypto operation error. 5519 * @syscap SystemCapability.Security.Cert 5520 * @crossplatform 5521 * @atomicservice 5522 * @since 20 5523 */ 5524 getName(encodingType: EncodingType): string; 5525 5526 /** 5527 * Get distinguished name string by type. 5528 * 5529 * @param { string } type - the specified type name. 5530 * @returns { Array<string> } distinguished name string. 5531 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 5532 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 5533 * @throws { BusinessError } 19020001 - memory malloc failed. 5534 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5535 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5536 * @throws { BusinessError } 19030001 - crypto operation error. 5537 * @syscap SystemCapability.Security.Cert 5538 * @crossplatform 5539 * @atomicservice 5540 * @since 12 5541 */ 5542 getName(type: string): Array<string>; 5543 5544 /** 5545 * Get distinguished name in der coding format. 5546 * 5547 * @returns { EncodingBlob } distinguished name encoded data. 5548 * @throws { BusinessError } 19020001 - memory malloc failed. 5549 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 5550 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 5551 * @throws { BusinessError } 19030001 - crypto operation error. 5552 * @syscap SystemCapability.Security.Cert 5553 * @crossplatform 5554 * @atomicservice 5555 * @since 12 5556 */ 5557 getEncoded(): EncodingBlob; 5558 } 5559 5560 /** 5561 * Provides the x509 trust anchor type. 5562 * 5563 * @typedef X509TrustAnchor 5564 * @syscap SystemCapability.Security.Cert 5565 * @crossplatform 5566 * @since 11 5567 */ 5568 /** 5569 * Provides the x509 trust anchor type. 5570 * 5571 * @typedef X509TrustAnchor 5572 * @syscap SystemCapability.Security.Cert 5573 * @crossplatform 5574 * @atomicservice 5575 * @since 12 5576 */ 5577 interface X509TrustAnchor { 5578 /** 5579 * The trust CA cert. 5580 * 5581 * @type { ?X509Cert } 5582 * @syscap SystemCapability.Security.Cert 5583 * @crossplatform 5584 * @since 11 5585 */ 5586 /** 5587 * The trust CA cert. 5588 * 5589 * @type { ?X509Cert } 5590 * @syscap SystemCapability.Security.Cert 5591 * @crossplatform 5592 * @atomicservice 5593 * @since 12 5594 */ 5595 CACert?: X509Cert; 5596 5597 /** 5598 * The trust CA public key in DER format. 5599 * 5600 * @type { ?Uint8Array } 5601 * @syscap SystemCapability.Security.Cert 5602 * @crossplatform 5603 * @since 11 5604 */ 5605 /** 5606 * The trust CA public key in DER format. 5607 * 5608 * @type { ?Uint8Array } 5609 * @syscap SystemCapability.Security.Cert 5610 * @crossplatform 5611 * @atomicservice 5612 * @since 12 5613 */ 5614 CAPubKey?: Uint8Array; 5615 5616 /** 5617 * The trust CA subject in DER format. 5618 * 5619 * @type { ?Uint8Array } 5620 * @syscap SystemCapability.Security.Cert 5621 * @crossplatform 5622 * @since 11 5623 */ 5624 /** 5625 * The trust CA subject in DER format. 5626 * 5627 * @type { ?Uint8Array } 5628 * @syscap SystemCapability.Security.Cert 5629 * @crossplatform 5630 * @atomicservice 5631 * @since 12 5632 */ 5633 CASubject?: Uint8Array; 5634 5635 /** 5636 * The name constraints in DER format. 5637 * 5638 * @type { ?Uint8Array } 5639 * @syscap SystemCapability.Security.Cert 5640 * @crossplatform 5641 * @atomicservice 5642 * @since 12 5643 */ 5644 nameConstraints?: Uint8Array; 5645 } 5646 5647 /** 5648 * Enum for revocation check option. 5649 * 5650 * @enum { number } 5651 * @syscap SystemCapability.Security.Cert 5652 * @crossplatform 5653 * @atomicservice 5654 * @since 12 5655 */ 5656 enum RevocationCheckOptions { 5657 /** 5658 * Indicates priority to use OCSP for verification. 5659 * 5660 * @syscap SystemCapability.Security.Cert 5661 * @crossplatform 5662 * @atomicservice 5663 * @since 12 5664 */ 5665 REVOCATION_CHECK_OPTION_PREFER_OCSP = 0, 5666 5667 /** 5668 * Indicates support for verifying revocation status by accessing the network to obtain CRL or OCSP responses. 5669 * 5670 * @syscap SystemCapability.Security.Cert 5671 * @crossplatform 5672 * @atomicservice 5673 * @since 12 5674 */ 5675 REVOCATION_CHECK_OPTION_ACCESS_NETWORK, 5676 5677 /** 5678 * Indicates when the 'REVOCATION_CHECK_OPTION_ACCESS_NETWORK' option is turned on, it is effective. 5679 * If the preferred verification method is unable to verify the certificate status due to network reasons, 5680 * an alternative solution will be used for verification. 5681 * 5682 * @syscap SystemCapability.Security.Cert 5683 * @crossplatform 5684 * @atomicservice 5685 * @since 12 5686 */ 5687 REVOCATION_CHECK_OPTION_FALLBACK_NO_PREFER, 5688 5689 /** 5690 * Indicates when the 'REVOCATION_CHECK_OPTION_ACCESS_NETWORK' option is turned on, it is effective. 5691 * If both the CRL and OCSP responses obtained online cannot verify the certificate status due to network reasons, 5692 * the locally set CRL and OCSP responses will be used for verification. 5693 * 5694 * @syscap SystemCapability.Security.Cert 5695 * @crossplatform 5696 * @atomicservice 5697 * @since 12 5698 */ 5699 REVOCATION_CHECK_OPTION_FALLBACK_LOCAL 5700 } 5701 5702 /** 5703 * Enum for validation policy type. 5704 * 5705 * @enum { number } 5706 * @syscap SystemCapability.Security.Cert 5707 * @crossplatform 5708 * @atomicservice 5709 * @since 12 5710 */ 5711 enum ValidationPolicyType { 5712 /** 5713 * Indicates not need to verify the sslHostname field in the certificate. 5714 * 5715 * @syscap SystemCapability.Security.Cert 5716 * @crossplatform 5717 * @atomicservice 5718 * @since 12 5719 */ 5720 VALIDATION_POLICY_TYPE_X509 = 0, 5721 5722 /** 5723 * Indicates need to verify the sslHostname field in the certificate. 5724 * 5725 * @syscap SystemCapability.Security.Cert 5726 * @crossplatform 5727 * @atomicservice 5728 * @since 12 5729 */ 5730 VALIDATION_POLICY_TYPE_SSL 5731 } 5732 5733 /** 5734 * Enum for validation keyusage type. 5735 * 5736 * @enum { number } 5737 * @syscap SystemCapability.Security.Cert 5738 * @crossplatform 5739 * @atomicservice 5740 * @since 12 5741 */ 5742 enum KeyUsageType { 5743 /** 5744 * Indicates the certificate public key can be used for digital signature operations. 5745 * 5746 * @syscap SystemCapability.Security.Cert 5747 * @crossplatform 5748 * @atomicservice 5749 * @since 12 5750 */ 5751 KEYUSAGE_DIGITAL_SIGNATURE = 0, 5752 5753 /** 5754 * Indicates certificate public key can be used for non repudiation operations, preventing the signer from denying their signature. 5755 * 5756 * @syscap SystemCapability.Security.Cert 5757 * @crossplatform 5758 * @atomicservice 5759 * @since 12 5760 */ 5761 KEYUSAGE_NON_REPUDIATION, 5762 5763 /** 5764 * Indicates certificate public key can be used for key encryption operations, for encrypting symmetric keys, etc. 5765 * 5766 * @syscap SystemCapability.Security.Cert 5767 * @crossplatform 5768 * @atomicservice 5769 * @since 12 5770 */ 5771 KEYUSAGE_KEY_ENCIPHERMENT, 5772 5773 /** 5774 * Indicates certificate public key can be used for data encryption operations, to encrypt data. 5775 * 5776 * @syscap SystemCapability.Security.Cert 5777 * @crossplatform 5778 * @atomicservice 5779 * @since 12 5780 */ 5781 KEYUSAGE_DATA_ENCIPHERMENT, 5782 5783 /** 5784 * Indicates certificate public key can be used for key negotiation operations, to negotiate shared keys. 5785 * 5786 * @syscap SystemCapability.Security.Cert 5787 * @crossplatform 5788 * @atomicservice 5789 * @since 12 5790 */ 5791 KEYUSAGE_KEY_AGREEMENT, 5792 5793 /** 5794 * Indicates certificate public key can be used for certificate signing operations. 5795 * 5796 * @syscap SystemCapability.Security.Cert 5797 * @crossplatform 5798 * @atomicservice 5799 * @since 12 5800 */ 5801 KEYUSAGE_KEY_CERT_SIGN, 5802 5803 /** 5804 * Indicates certificate public key can be used for signing operations on certificate revocation lists (CRLs). 5805 * 5806 * @syscap SystemCapability.Security.Cert 5807 * @crossplatform 5808 * @atomicservice 5809 * @since 12 5810 */ 5811 KEYUSAGE_CRL_SIGN, 5812 5813 /** 5814 * Indicates the key can only be used for encryption operations and cannot be used for decryption operations. 5815 * 5816 * @syscap SystemCapability.Security.Cert 5817 * @crossplatform 5818 * @atomicservice 5819 * @since 12 5820 */ 5821 KEYUSAGE_ENCIPHER_ONLY, 5822 5823 /** 5824 * Indicates the key can only be used for decryption operations and cannot be used for encryption operations. 5825 * 5826 * @syscap SystemCapability.Security.Cert 5827 * @crossplatform 5828 * @atomicservice 5829 * @since 12 5830 */ 5831 KEYUSAGE_DECIPHER_ONLY 5832 } 5833 5834 /** 5835 * Provides the certificate chain validate revocation parameters. 5836 * 5837 * @typedef RevocationCheckParameter 5838 * @syscap SystemCapability.Security.Cert 5839 * @crossplatform 5840 * @atomicservice 5841 * @since 12 5842 */ 5843 interface RevocationCheckParameter { 5844 /** 5845 * The additional field for sending OCSP requests. 5846 * 5847 * @type { ?Array<Uint8Array> } 5848 * @syscap SystemCapability.Security.Cert 5849 * @crossplatform 5850 * @atomicservice 5851 * @since 12 5852 */ 5853 ocspRequestExtension?: Array<Uint8Array>; 5854 5855 /** 5856 * The server URL address for sending requests to OCSP. 5857 * 5858 * @type { ?string } 5859 * @syscap SystemCapability.Security.Cert 5860 * @crossplatform 5861 * @atomicservice 5862 * @since 12 5863 */ 5864 ocspResponderURI?: string; 5865 5866 /** 5867 * The signing certificate for verifying OCSP response signatures. 5868 * 5869 * @type { ?X509Cert } 5870 * @syscap SystemCapability.Security.Cert 5871 * @crossplatform 5872 * @atomicservice 5873 * @since 12 5874 */ 5875 ocspResponderCert?: X509Cert; 5876 5877 /** 5878 * The OCSP response message returned by an OCSP server. 5879 * 5880 * @type { ?Uint8Array } 5881 * @syscap SystemCapability.Security.Cert 5882 * @crossplatform 5883 * @atomicservice 5884 * @since 12 5885 */ 5886 ocspResponses?: Uint8Array; 5887 5888 /** 5889 * The URL address for downloading the CRL list. 5890 * 5891 * @type { ?string } 5892 * @syscap SystemCapability.Security.Cert 5893 * @crossplatform 5894 * @atomicservice 5895 * @since 12 5896 */ 5897 crlDownloadURI?: string; 5898 5899 /** 5900 * The certificate revocation status verification option. 5901 * 5902 * @type { ?Array<RevocationCheckOptions> } 5903 * @syscap SystemCapability.Security.Cert 5904 * @crossplatform 5905 * @atomicservice 5906 * @since 12 5907 */ 5908 options?: Array<RevocationCheckOptions>; 5909 5910 /** 5911 * The digest used to generate the ocsp cert id. 5912 * 5913 * @type { ?string } 5914 * @default SHA256 5915 * @syscap SystemCapability.Security.Cert 5916 * @crossplatform 5917 * @atomicservice 5918 * @since 12 5919 */ 5920 ocspDigest?: string; 5921 } 5922 5923 /** 5924 * Provides the certificate chain validate parameters type. 5925 * 5926 * @typedef CertChainValidationParameters 5927 * @syscap SystemCapability.Security.Cert 5928 * @crossplatform 5929 * @since 11 5930 */ 5931 /** 5932 * Provides the certificate chain validate parameters type. 5933 * 5934 * @typedef CertChainValidationParameters 5935 * @syscap SystemCapability.Security.Cert 5936 * @crossplatform 5937 * @atomicservice 5938 * @since 12 5939 */ 5940 interface CertChainValidationParameters { 5941 /** 5942 * The datetime to verify the certificate chain validity period. 5943 * 5944 * @type { ?string } 5945 * @syscap SystemCapability.Security.Cert 5946 * @crossplatform 5947 * @since 11 5948 */ 5949 /** 5950 * The datetime to verify the certificate chain validity period. 5951 * 5952 * @type { ?string } 5953 * @syscap SystemCapability.Security.Cert 5954 * @crossplatform 5955 * @atomicservice 5956 * @since 12 5957 */ 5958 date?: string; 5959 5960 /** 5961 * The trust ca certificates to verify the certificate chain. 5962 * 5963 * @type { Array<X509TrustAnchor> } 5964 * @syscap SystemCapability.Security.Cert 5965 * @crossplatform 5966 * @since 11 5967 */ 5968 /** 5969 * The trust ca certificates to verify the certificate chain. 5970 * 5971 * @type { Array<X509TrustAnchor> } 5972 * @syscap SystemCapability.Security.Cert 5973 * @crossplatform 5974 * @atomicservice 5975 * @since 12 5976 */ 5977 trustAnchors: Array<X509TrustAnchor>; 5978 5979 /** 5980 * Indicates whether to use system preinstalled CA certificates to verify the certificate chain. 5981 * 5982 * If set to true and trustAnchors is not an empty array, both user trustAnchors and system preinstalled CA 5983 * certificates are used to verify the certificate chain. 5984 * 5985 * If set to true and trustAnchors is an empty array, only system preinstalled CA certificates are used to verify 5986 * the certificate chain. 5987 * 5988 * @type { ?boolean } 5989 * @default false 5990 * @syscap SystemCapability.Security.Cert 5991 * @crossplatform 5992 * @atomicservice 5993 * @since 20 5994 */ 5995 trustSystemCa?: boolean; 5996 5997 /** 5998 * The cert and CRL list to build cert chain and verify the certificate chain revocation state. 5999 * 6000 * @type { ?Array<CertCRLCollection> } 6001 * @syscap SystemCapability.Security.Cert 6002 * @crossplatform 6003 * @since 11 6004 */ 6005 /** 6006 * The cert and CRL list to build cert chain and verify the certificate chain revocation state. 6007 * 6008 * @type { ?Array<CertCRLCollection> } 6009 * @syscap SystemCapability.Security.Cert 6010 * @crossplatform 6011 * @atomicservice 6012 * @since 12 6013 */ 6014 certCRLs?: Array<CertCRLCollection>; 6015 6016 /** 6017 * The revocation parameters to verify the certificate chain revocation status. 6018 * 6019 * @type { ?RevocationCheckParameter } 6020 * @syscap SystemCapability.Security.Cert 6021 * @crossplatform 6022 * @atomicservice 6023 * @since 12 6024 */ 6025 revocationCheckParam?: RevocationCheckParameter; 6026 6027 /** 6028 * The policy to verify the certificate chain validity. 6029 * 6030 * @type { ?ValidationPolicyType } 6031 * @syscap SystemCapability.Security.Cert 6032 * @crossplatform 6033 * @atomicservice 6034 * @since 12 6035 */ 6036 policy?: ValidationPolicyType; 6037 6038 /** 6039 * The sslHostname to verify the certificate chain validity. 6040 * 6041 * @type { ?string } 6042 * @syscap SystemCapability.Security.Cert 6043 * @crossplatform 6044 * @atomicservice 6045 * @since 12 6046 */ 6047 sslHostname?: string; 6048 6049 /** 6050 * The keyUsage to verify the certificate chain validity. 6051 * 6052 * @type { ?Array<KeyUsageType> } 6053 * @syscap SystemCapability.Security.Cert 6054 * @crossplatform 6055 * @atomicservice 6056 * @since 12 6057 */ 6058 keyUsage?: Array<KeyUsageType>; 6059 } 6060 6061 /** 6062 * Certification chain validate result. 6063 * 6064 * @typedef CertChainValidationResult 6065 * @syscap SystemCapability.Security.Cert 6066 * @crossplatform 6067 * @since 11 6068 */ 6069 /** 6070 * Certification chain validate result. 6071 * 6072 * @typedef CertChainValidationResult 6073 * @syscap SystemCapability.Security.Cert 6074 * @crossplatform 6075 * @atomicservice 6076 * @since 12 6077 */ 6078 interface CertChainValidationResult { 6079 /** 6080 * The cert chain trust anchor. 6081 * 6082 * @type { X509TrustAnchor } 6083 * @readonly 6084 * @syscap SystemCapability.Security.Cert 6085 * @crossplatform 6086 * @since 11 6087 */ 6088 /** 6089 * The cert chain trust anchor. 6090 * 6091 * @type { X509TrustAnchor } 6092 * @readonly 6093 * @syscap SystemCapability.Security.Cert 6094 * @crossplatform 6095 * @atomicservice 6096 * @since 12 6097 */ 6098 readonly trustAnchor: X509TrustAnchor; 6099 6100 /** 6101 * The target certificate. 6102 * 6103 * @type { X509Cert } 6104 * @readonly 6105 * @syscap SystemCapability.Security.Cert 6106 * @crossplatform 6107 * @since 11 6108 */ 6109 /** 6110 * The target certificate. 6111 * 6112 * @type { X509Cert } 6113 * @readonly 6114 * @syscap SystemCapability.Security.Cert 6115 * @crossplatform 6116 * @atomicservice 6117 * @since 12 6118 */ 6119 readonly entityCert: X509Cert; 6120 } 6121 6122 /** 6123 * Provides the certificate chain build parameters type. 6124 * 6125 * @typedef CertChainBuildParameters 6126 * @syscap SystemCapability.Security.Cert 6127 * @crossplatform 6128 * @atomicservice 6129 * @since 12 6130 */ 6131 interface CertChainBuildParameters { 6132 /** 6133 * The certificate match parameters to selects certificate from the certificate collection. 6134 * 6135 * @type { X509CertMatchParameters } 6136 * @syscap SystemCapability.Security.Cert 6137 * @crossplatform 6138 * @atomicservice 6139 * @since 12 6140 */ 6141 certMatchParameters: X509CertMatchParameters; 6142 6143 /** 6144 * The maximum length of the certificate chain to be built. 6145 * 6146 * @type { ?number } 6147 * @syscap SystemCapability.Security.Cert 6148 * @crossplatform 6149 * @atomicservice 6150 * @since 12 6151 */ 6152 maxLength?: number; 6153 6154 /** 6155 * The CertChain validation parameters. 6156 * 6157 * @type { CertChainValidationParameters } 6158 * @syscap SystemCapability.Security.Cert 6159 * @crossplatform 6160 * @atomicservice 6161 * @since 12 6162 */ 6163 validationParameters: CertChainValidationParameters; 6164 } 6165 6166 /** 6167 * Certification chain build result. 6168 * 6169 * @typedef CertChainBuildResult 6170 * @syscap SystemCapability.Security.Cert 6171 * @crossplatform 6172 * @atomicservice 6173 * @since 12 6174 */ 6175 interface CertChainBuildResult { 6176 /** 6177 * The certificate chain of build result. 6178 * 6179 * @type { X509CertChain } 6180 * @readonly 6181 * @syscap SystemCapability.Security.Cert 6182 * @crossplatform 6183 * @atomicservice 6184 * @since 12 6185 */ 6186 readonly certChain: X509CertChain; 6187 6188 /** 6189 * The certificate chain validation result. 6190 * 6191 * @type { CertChainValidationResult } 6192 * @readonly 6193 * @syscap SystemCapability.Security.Cert 6194 * @crossplatform 6195 * @atomicservice 6196 * @since 12 6197 */ 6198 readonly validationResult: CertChainValidationResult; 6199 } 6200 6201 /** 6202 * Enum for CMS content type. 6203 * 6204 * @enum { number } 6205 * @syscap SystemCapability.Security.Cert 6206 * @crossplatform 6207 * @atomicservice 6208 * @since 18 6209 */ 6210 enum CmsContentType { 6211 /** 6212 * Signed data. 6213 * 6214 * @syscap SystemCapability.Security.Cert 6215 * @crossplatform 6216 * @atomicservice 6217 * @since 18 6218 */ 6219 SIGNED_DATA = 0 6220 } 6221 6222 /** 6223 * Enum for CMS content data format. 6224 * 6225 * @enum { number } 6226 * @syscap SystemCapability.Security.Cert 6227 * @crossplatform 6228 * @atomicservice 6229 * @since 18 6230 */ 6231 enum CmsContentDataFormat { 6232 /** 6233 * Binary format. 6234 * 6235 * @syscap SystemCapability.Security.Cert 6236 * @crossplatform 6237 * @atomicservice 6238 * @since 18 6239 */ 6240 BINARY = 0, 6241 6242 /** 6243 * Text format. 6244 * 6245 * @syscap SystemCapability.Security.Cert 6246 * @crossplatform 6247 * @atomicservice 6248 * @since 18 6249 */ 6250 TEXT = 1 6251 } 6252 6253 /** 6254 * Enum for CMS format. 6255 * 6256 * @enum { number } 6257 * @syscap SystemCapability.Security.Cert 6258 * @crossplatform 6259 * @atomicservice 6260 * @since 18 6261 */ 6262 enum CmsFormat { 6263 /** 6264 * PEM format. 6265 * 6266 * @syscap SystemCapability.Security.Cert 6267 * @crossplatform 6268 * @atomicservice 6269 * @since 18 6270 */ 6271 PEM = 0, 6272 6273 /** 6274 * DER format. 6275 * 6276 * @syscap SystemCapability.Security.Cert 6277 * @crossplatform 6278 * @atomicservice 6279 * @since 18 6280 */ 6281 DER = 1 6282 } 6283 6284 /** 6285 * Private key info. 6286 * 6287 * @typedef PrivateKeyInfo 6288 * @syscap SystemCapability.Security.Cert 6289 * @crossplatform 6290 * @atomicservice 6291 * @since 18 6292 */ 6293 interface PrivateKeyInfo { 6294 /** 6295 * The unencrypted or encrypted private key, in PEM or DER format. 6296 * 6297 * @type { string | Uint8Array } 6298 * @syscap SystemCapability.Security.Cert 6299 * @crossplatform 6300 * @atomicservice 6301 * @since 18 6302 */ 6303 key: string | Uint8Array; 6304 6305 /** 6306 * The password of the private key, if the private key is encrypted. 6307 * 6308 * @type { ?string } 6309 * @syscap SystemCapability.Security.Cert 6310 * @crossplatform 6311 * @atomicservice 6312 * @since 18 6313 */ 6314 password?: string; 6315 } 6316 6317 /** 6318 * Configuration options for CMS signer. 6319 * 6320 * @typedef CmsSignerConfig 6321 * @syscap SystemCapability.Security.Cert 6322 * @crossplatform 6323 * @atomicservice 6324 * @since 18 6325 */ 6326 interface CmsSignerConfig { 6327 /** 6328 * Digest algorithm name, such as "SHA384". 6329 * 6330 * @type { string } 6331 * @syscap SystemCapability.Security.Cert 6332 * @crossplatform 6333 * @atomicservice 6334 * @since 18 6335 */ 6336 mdName: string; 6337 6338 /** 6339 * Whether to add the certificate. 6340 * 6341 * @type { ?boolean } 6342 * @default true 6343 * @syscap SystemCapability.Security.Cert 6344 * @crossplatform 6345 * @atomicservice 6346 * @since 18 6347 */ 6348 addCert?: boolean; 6349 6350 /** 6351 * Whether to add the signature attributes. 6352 * 6353 * @type { ?boolean } 6354 * @default true 6355 * @syscap SystemCapability.Security.Cert 6356 * @crossplatform 6357 * @atomicservice 6358 * @since 18 6359 */ 6360 addAttr?: boolean; 6361 6362 /** 6363 * Whether to add the smime capibilities to the signature attributes. 6364 * 6365 * @type { ?boolean } 6366 * @default true 6367 * @syscap SystemCapability.Security.Cert 6368 * @crossplatform 6369 * @atomicservice 6370 * @since 18 6371 */ 6372 addSmimeCapAttr?: boolean 6373 } 6374 6375 /** 6376 * CMS generator options. 6377 * 6378 * @typedef CmsGeneratorOptions 6379 * @syscap SystemCapability.Security.Cert 6380 * @crossplatform 6381 * @atomicservice 6382 * @since 18 6383 */ 6384 interface CmsGeneratorOptions { 6385 /** 6386 * The format of the content data. 6387 * 6388 * @type { ?CmsContentDataFormat } 6389 * @default CmsContentDataFormat.BINARY 6390 * @syscap SystemCapability.Security.Cert 6391 * @crossplatform 6392 * @atomicservice 6393 * @since 18 6394 */ 6395 contentDataFormat?: CmsContentDataFormat; 6396 6397 /** 6398 * The output format of the CMS final data. 6399 * 6400 * @type { ?CmsFormat } 6401 * @default CmsFormat.DER 6402 * @syscap SystemCapability.Security.Cert 6403 * @crossplatform 6404 * @atomicservice 6405 * @since 18 6406 */ 6407 outFormat?: CmsFormat; 6408 6409 /** 6410 * Whether the CMS final data does not contain original content data. 6411 * 6412 * @type { ?boolean } 6413 * @default false 6414 * @syscap SystemCapability.Security.Cert 6415 * @crossplatform 6416 * @atomicservice 6417 * @since 18 6418 */ 6419 isDetached?: boolean; 6420 } 6421 6422 /** 6423 * Provides the interface for generating CMS. 6424 * 6425 * @typedef CmsGenerator 6426 * @syscap SystemCapability.Security.Cert 6427 * @crossplatform 6428 * @atomicservice 6429 * @since 18 6430 */ 6431 interface CmsGenerator { 6432 /** 6433 * Used to add the signer info. 6434 * 6435 * @param { X509Cert } cert - the signer certificate. 6436 * @param { PrivateKeyInfo } keyInfo - the private key info of the signer certificate. 6437 * @param { CmsSignerConfig } config - the configuration for CMS signer. 6438 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 6439 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6440 * @throws { BusinessError } 19020001 - memory malloc failed. 6441 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 6442 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 6443 * @throws { BusinessError } 19030001 - crypto operation error. 6444 * @throws { BusinessError } 19030008 - maybe wrong password. 6445 * @syscap SystemCapability.Security.Cert 6446 * @crossplatform 6447 * @atomicservice 6448 * @since 18 6449 */ 6450 addSigner(cert: X509Cert, keyInfo: PrivateKeyInfo, config: CmsSignerConfig): void; 6451 6452 /** 6453 * Used to add the certificate, such as the issuer certificate of the signer certificate. 6454 * 6455 * @param { X509Cert } cert - the certificate. 6456 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 6457 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6458 * @throws { BusinessError } 19020001 - memory malloc failed. 6459 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 6460 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 6461 * @throws { BusinessError } 19030001 - crypto operation error. 6462 * @syscap SystemCapability.Security.Cert 6463 * @crossplatform 6464 * @atomicservice 6465 * @since 18 6466 */ 6467 addCert(cert: X509Cert): void; 6468 6469 /** 6470 * Used to obtain the CMS final data, such as CMS signed data. 6471 * 6472 * @param { Uint8Array } data - the content data for CMS operation. 6473 * @param { CmsGeneratorOptions } [options] - the configuration options for CMS operation. 6474 * @returns { Promise<Uint8Array | string> } the promise returned by the function. 6475 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 6476 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6477 * @throws { BusinessError } 19020001 - memory malloc failed. 6478 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 6479 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 6480 * @throws { BusinessError } 19030001 - crypto operation error. 6481 * @syscap SystemCapability.Security.Cert 6482 * @crossplatform 6483 * @atomicservice 6484 * @since 18 6485 */ 6486 doFinal(data: Uint8Array, options?: CmsGeneratorOptions): Promise<Uint8Array | string>; 6487 6488 /** 6489 * Used to obtain the CMS final data, such as CMS signed data. 6490 * 6491 * @param { Uint8Array } data - the content data for CMS operation. 6492 * @param { CmsGeneratorOptions } [options] - the configuration options for CMS operation. 6493 * @returns { Uint8Array | string } the CMS final data. 6494 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 6495 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6496 * @throws { BusinessError } 19020001 - memory malloc failed. 6497 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 6498 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 6499 * @throws { BusinessError } 19030001 - crypto operation error. 6500 * @syscap SystemCapability.Security.Cert 6501 * @crossplatform 6502 * @atomicservice 6503 * @since 18 6504 */ 6505 doFinalSync(data: Uint8Array, options?: CmsGeneratorOptions): Uint8Array | string; 6506 } 6507 6508 /** 6509 * Used to create CmsGenerator. 6510 * 6511 * @param { CmsContentType } contentType - the CMS content type. 6512 * @returns { CmsGenerator } the CmsGenerator. 6513 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 6514 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6515 * @throws { BusinessError } 19020001 - memory malloc failed. 6516 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 6517 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 6518 * @throws { BusinessError } 19030001 - crypto operation error. 6519 * @syscap SystemCapability.Security.Cert 6520 * @crossplatform 6521 * @atomicservice 6522 * @since 18 6523 */ 6524 function createCmsGenerator(contentType: CmsContentType): CmsGenerator; 6525 6526 /** 6527 * Additional information about the subject of the certificate. 6528 * 6529 * @typedef CsrAttribute 6530 * @syscap SystemCapability.Security.Cert 6531 * @crossplatform 6532 * @atomicservice 6533 * @since 18 6534 */ 6535 interface CsrAttribute { 6536 /** 6537 * Attribute type. 6538 * 6539 * @type { string } 6540 * @syscap SystemCapability.Security.Cert 6541 * @crossplatform 6542 * @atomicservice 6543 * @since 18 6544 */ 6545 type: string; 6546 6547 /** 6548 * Attribute value. 6549 * 6550 * @type { string } 6551 * @syscap SystemCapability.Security.Cert 6552 * @crossplatform 6553 * @atomicservice 6554 * @since 18 6555 */ 6556 value: string; 6557 } 6558 6559 /** 6560 * Configuration for generating a certificate signing request. 6561 * 6562 * @typedef CsrGenerationConfig 6563 * @syscap SystemCapability.Security.Cert 6564 * @crossplatform 6565 * @atomicservice 6566 * @since 18 6567 */ 6568 interface CsrGenerationConfig { 6569 /** 6570 * The subject. 6571 * 6572 * @type { X500DistinguishedName } 6573 * @syscap SystemCapability.Security.Cert 6574 * @crossplatform 6575 * @atomicservice 6576 * @since 18 6577 */ 6578 subject: X500DistinguishedName; 6579 6580 /** 6581 * The message digest name, such as "SHA384". 6582 * 6583 * @type { string } 6584 * @syscap SystemCapability.Security.Cert 6585 * @crossplatform 6586 * @atomicservice 6587 * @since 18 6588 */ 6589 mdName: string; 6590 6591 /** 6592 * The attributes. 6593 * 6594 * @type { ?Array<CsrAttribute> } 6595 * @syscap SystemCapability.Security.Cert 6596 * @crossplatform 6597 * @atomicservice 6598 * @since 18 6599 */ 6600 attributes?: Array<CsrAttribute>; 6601 6602 /** 6603 * The output format of CSR. 6604 * 6605 * @type { ?EncodingBaseFormat } 6606 * @default EncodingBaseFormat.PEM 6607 * @syscap SystemCapability.Security.Cert 6608 * @crossplatform 6609 * @atomicservice 6610 * @since 18 6611 */ 6612 outFormat?: EncodingBaseFormat; 6613 } 6614 6615 /** 6616 * Used to generate certificate signing request. 6617 * 6618 * @param { PrivateKeyInfo } keyInfo - the private key info. 6619 * @param { CsrGenerationConfig } config - the configuration for generating CSR. 6620 * @returns { string | Uint8Array } the CSR in PEM or DER format. 6621 * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; 6622 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 6623 * @throws { BusinessError } 19020001 - memory malloc failed. 6624 * @throws { BusinessError } 19020002 - runtime error. Possible causes: 1. Memory copy failed; 6625 * <br>2. A null pointer occurs inside the system; 3. Failed to convert parameters between ArkTS and C. 6626 * @throws { BusinessError } 19030001 - crypto operation error. 6627 * @throws { BusinessError } 19030008 - maybe wrong password. 6628 * @syscap SystemCapability.Security.Cert 6629 * @crossplatform 6630 * @atomicservice 6631 * @since 18 6632 */ 6633 function generateCsr(keyInfo: PrivateKeyInfo, config: CsrGenerationConfig): string | Uint8Array; 6634} 6635 6636export default cert; 6637