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