tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

x509_schema.js (84811B)


      1 /*
      2 * Copyright (c) 2014, GMO GlobalSign
      3 * Copyright (c) 2015, Peculiar Ventures
      4 * All rights reserved.
      5 *
      6 * Author 2014-2015, Yury Strozhevsky <www.strozhevsky.com>.
      7 *
      8 * Redistribution and use in source and binary forms, with or without modification, 
      9 * are permitted provided that the following conditions are met:
     10 *
     11 * 1. Redistributions of source code must retain the above copyright notice, 
     12 *    this list of conditions and the following disclaimer.
     13 *
     14 * 2. Redistributions in binary form must reproduce the above copyright notice, 
     15 *    this list of conditions and the following disclaimer in the documentation 
     16 *    and/or other materials provided with the distribution.
     17 *
     18 * 3. Neither the name of the copyright holder nor the names of its contributors 
     19 *    may be used to endorse or promote products derived from this software without 
     20 *    specific prior written permission.
     21 *
     22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
     23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
     24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
     25 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
     26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
     27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
     28 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
     29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
     30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
     31 * OF SUCH DAMAGE. 
     32 *
     33 */
     34 (
     35 function(in_window)
     36 {
     37    //**************************************************************************************
     38    // #region Declaration of global variables 
     39    //**************************************************************************************
     40    // #region "org" namespace 
     41    if(typeof in_window.org === "undefined")
     42        in_window.org = {};
     43    else
     44    {
     45        if(typeof in_window.org !== "object")
     46            throw new Error("Name org already exists and it's not an object");
     47    }
     48    // #endregion 
     49 
     50    // #region "org.pkijs" namespace 
     51    if(typeof in_window.org.pkijs === "undefined")
     52        in_window.org.pkijs = {};
     53    else
     54    {
     55        if(typeof in_window.org.pkijs !== "object")
     56            throw new Error("Name org.pkijs already exists and it's not an object" + " but " + (typeof in_window.org.pkijs));
     57    }
     58    // #endregion 
     59 
     60    // #region "org.pkijs.schema" namespace 
     61    if(typeof in_window.org.pkijs.schema === "undefined")
     62        in_window.org.pkijs.schema = {};
     63    else
     64    {
     65        if(typeof in_window.org.pkijs.schema !== "object")
     66            throw new Error("Name org.pkijs.schema already exists and it's not an object" + " but " + (typeof in_window.org.pkijs.schema));
     67    }
     68    // #endregion 
     69 
     70    // #region "org.pkijs.schema.x509" namespace 
     71    if(typeof in_window.org.pkijs.schema.x509 === "undefined")
     72        in_window.org.pkijs.schema.x509 = {};
     73    else
     74    {
     75        if(typeof in_window.org.pkijs.schema.x509 !== "object")
     76            throw new Error("Name org.pkijs.schema.x509 already exists and it's not an object" + " but " + (typeof in_window.org.pkijs.schema.x509));
     77    }
     78    // #endregion 
     79 
     80    // #region "local" namespace 
     81    var local = {};
     82    // #endregion   
     83    //**************************************************************************************
     84    // #endregion 
     85    //**************************************************************************************
     86    // #region ASN.1 schema definition for "Time" type 
     87    //**************************************************************************************
     88    in_window.org.pkijs.schema.TIME =
     89    function(input_names, input_optional)
     90    {
     91        var names = in_window.org.pkijs.getNames(arguments[0]);
     92        var optional = (input_optional || false);
     93 
     94        return (new in_window.org.pkijs.asn1.CHOICE({
     95            optional: optional,
     96            value: [
     97                new in_window.org.pkijs.asn1.UTCTIME({ name: (names.utcTimeName || "") }),
     98                new in_window.org.pkijs.asn1.GENERALIZEDTIME({ name: (names.generalTimeName || "") })
     99            ]
    100        }));
    101    };
    102    //**************************************************************************************
    103    // #endregion 
    104    //**************************************************************************************
    105    // #region ASN.1 schema definition for X.509 v3 certificate (RFC5280)
    106    //**************************************************************************************
    107    local.tbsCertificate =
    108    function()
    109    {
    110        //TBSCertificate  ::=  SEQUENCE  {
    111        //    version         [0]  EXPLICIT Version DEFAULT v1,
    112        //    serialNumber         CertificateSerialNumber,
    113        //    signature            AlgorithmIdentifier,
    114        //    issuer               Name,
    115        //    validity             Validity,
    116        //    subject              Name,
    117        //    subjectPublicKeyInfo SubjectPublicKeyInfo,
    118        //    issuerUniqueID  [1]  IMPLICIT UniqueIdentifier OPTIONAL,
    119        //                         -- If present, version MUST be v2 or v3
    120        //    subjectUniqueID [2]  IMPLICIT UniqueIdentifier OPTIONAL,
    121        //                         -- If present, version MUST be v2 or v3
    122        //    extensions      [3]  EXPLICIT Extensions OPTIONAL
    123        //    -- If present, version MUST be v3
    124        //}
    125 
    126        var names = in_window.org.pkijs.getNames(arguments[0]);
    127 
    128        return (new in_window.org.pkijs.asn1.SEQUENCE({
    129            name: (names.block_name || "tbsCertificate"),
    130            value: [
    131                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    132                    optional: true,
    133                    id_block: {
    134                        tag_class: 3, // CONTEXT-SPECIFIC
    135                        tag_number: 0 // [0]
    136                    },
    137                value: [
    138                    new in_window.org.pkijs.asn1.INTEGER({ name: (names.tbsCertificate_version || "tbsCertificate.version") }) // EXPLICIT integer value
    139                ]
    140            }),
    141                new in_window.org.pkijs.asn1.INTEGER({ name: (names.tbsCertificate_serialNumber || "tbsCertificate.serialNumber") }),
    142                in_window.org.pkijs.schema.ALGORITHM_IDENTIFIER(names.signature || {
    143                    names: {
    144                        block_name: "tbsCertificate.signature"
    145                    }
    146                }),
    147                in_window.org.pkijs.schema.RDN(names.issuer || {
    148                    names: {
    149                        block_name: "tbsCertificate.issuer"
    150                    }
    151                }),
    152                new in_window.org.pkijs.asn1.SEQUENCE({
    153                    name: (names.tbsCertificate_validity || "tbsCertificate.validity"),
    154                    value: [
    155                        in_window.org.pkijs.schema.TIME(names.not_before || {
    156                            names: {
    157                                utcTimeName: "tbsCertificate.notBefore",
    158                                generalTimeName: "tbsCertificate.notBefore"
    159                            }
    160                        }),
    161                        in_window.org.pkijs.schema.TIME(names.not_after || {
    162                            names: {
    163                                utcTimeName: "tbsCertificate.notAfter",
    164                                generalTimeName: "tbsCertificate.notAfter"
    165                            }
    166                        })
    167                    ]
    168                }),
    169                in_window.org.pkijs.schema.RDN(names.subject || {
    170                    names: {
    171                        block_name: "tbsCertificate.subject"
    172                    }
    173                }),
    174                in_window.org.pkijs.schema.PUBLIC_KEY_INFO(names.subjectPublicKeyInfo || {
    175                    names: {
    176                        block_name: "tbsCertificate.subjectPublicKeyInfo"
    177                    }
    178                }),
    179                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    180                    name: (names.tbsCertificate_issuerUniqueID ||"tbsCertificate.issuerUniqueID"),
    181                    optional: true,
    182                    id_block: {
    183                        tag_class: 3, // CONTEXT-SPECIFIC
    184                        tag_number: 1 // [1]
    185                    }
    186                }), // IMPLICIT bistring value
    187                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    188                    name: (names.tbsCertificate_subjectUniqueID ||"tbsCertificate.subjectUniqueID"),
    189                    optional: true,
    190                    id_block: {
    191                        tag_class: 3, // CONTEXT-SPECIFIC
    192                        tag_number: 2 // [2]
    193                    }
    194                }), // IMPLICIT bistring value
    195                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    196                    optional: true,
    197                    id_block: {
    198                        tag_class: 3, // CONTEXT-SPECIFIC
    199                        tag_number: 3 // [3]
    200                    },
    201                    value: [in_window.org.pkijs.schema.EXTENSIONS(names.extensions || {
    202                        names: {
    203                            block_name: "tbsCertificate.extensions"
    204                        }
    205                    })]
    206                }) // EXPLICIT SEQUENCE value
    207            ]
    208        }));
    209    };
    210    //**************************************************************************************
    211    in_window.org.pkijs.schema.CERT =
    212    function()
    213    {
    214        //Certificate  ::=  SEQUENCE  {
    215        //    tbsCertificate       TBSCertificate,
    216        //    signatureAlgorithm   AlgorithmIdentifier,
    217        //    signatureValue       BIT STRING  }
    218 
    219        var names = in_window.org.pkijs.getNames(arguments[0]);
    220 
    221        return (new in_window.org.pkijs.asn1.SEQUENCE({
    222            name: (names.block_name || ""),
    223            value: [
    224                local.tbsCertificate(names.tbsCertificate),
    225                in_window.org.pkijs.schema.ALGORITHM_IDENTIFIER(names.signatureAlgorithm || {
    226                    names: {
    227                        block_name: "signatureAlgorithm"
    228                    }
    229                }),
    230                new in_window.org.pkijs.asn1.BITSTRING({ name: (names.signatureValue || "signatureValue") })
    231            ]
    232        }));
    233    };
    234    //**************************************************************************************
    235    // #endregion 
    236    //**************************************************************************************
    237    // #region ASN.1 schema definition for X.509 CRL (Certificate Revocation List)(RFC5280)  
    238    //**************************************************************************************
    239    local.tbsCertList =
    240    function()
    241    {
    242        //TBSCertList  ::=  SEQUENCE  {
    243        //    version                 Version OPTIONAL,
    244        //                                 -- if present, MUST be v2
    245        //    signature               AlgorithmIdentifier,
    246        //    issuer                  Name,
    247        //    thisUpdate              Time,
    248        //    nextUpdate              Time OPTIONAL,
    249        //    revokedCertificates     SEQUENCE OF SEQUENCE  {
    250        //        userCertificate         CertificateSerialNumber,
    251        //        revocationDate          Time,
    252        //        crlEntryExtensions      Extensions OPTIONAL
    253        //        -- if present, version MUST be v2
    254        //    }  OPTIONAL,
    255        //    crlExtensions           [0]  EXPLICIT Extensions OPTIONAL
    256        //    -- if present, version MUST be v2
    257        //}
    258 
    259        var names = in_window.org.pkijs.getNames(arguments[0]);
    260 
    261        return (new in_window.org.pkijs.asn1.SEQUENCE({
    262            name: (names.block_name || "tbsCertList"),
    263            value: [
    264                        new in_window.org.pkijs.asn1.INTEGER({
    265                            optional: true,
    266                            name: (names.tbsCertList_version || "tbsCertList.version"),
    267                            value: 2
    268                        }), // EXPLICIT integer value (v2)
    269                        in_window.org.pkijs.schema.ALGORITHM_IDENTIFIER(names.signature || {
    270                            names: {
    271                                block_name: "tbsCertList.signature"
    272                            }
    273                        }),
    274                        in_window.org.pkijs.schema.RDN(names.issuer || {
    275                            names: {
    276                                block_name: "tbsCertList.issuer"
    277                            }
    278                        }),
    279                        in_window.org.pkijs.schema.TIME(names.tbsCertList_thisUpdate || {
    280                            names: {
    281                                utcTimeName: "tbsCertList.thisUpdate",
    282                                generalTimeName: "tbsCertList.thisUpdate"
    283                            }
    284                        }),
    285                        in_window.org.pkijs.schema.TIME(names.tbsCertList_thisUpdate || {
    286                            names: {
    287                                utcTimeName: "tbsCertList.nextUpdate",
    288                                generalTimeName: "tbsCertList.nextUpdate"
    289                            }
    290                        }, true),
    291                        new in_window.org.pkijs.asn1.SEQUENCE({
    292                            optional: true,
    293                            value: [
    294                                new in_window.org.pkijs.asn1.REPEATED({
    295                                    name: (names.tbsCertList_revokedCertificates || "tbsCertList.revokedCertificates"),
    296                                    value: new in_window.org.pkijs.asn1.SEQUENCE({
    297                                        value: [
    298                                            new in_window.org.pkijs.asn1.INTEGER(),
    299                                            in_window.org.pkijs.schema.TIME(),
    300                                            in_window.org.pkijs.schema.EXTENSIONS({}, true)
    301                                        ]
    302                                    })
    303                                })
    304                            ]
    305                        }),
    306                        new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    307                            optional: true,
    308                            id_block: {
    309                                tag_class: 3, // CONTEXT-SPECIFIC
    310                                tag_number: 0 // [0]
    311                            },
    312                            value: [in_window.org.pkijs.schema.EXTENSIONS(names.crlExtensions || {
    313                                names: {
    314                                    block_name: "tbsCertList.extensions"
    315                                }
    316                            })]
    317                        }) // EXPLICIT SEQUENCE value
    318                    ]
    319        }));
    320    };
    321    //**************************************************************************************
    322    in_window.org.pkijs.schema.CRL =
    323    function()
    324    {
    325        //CertificateList  ::=  SEQUENCE  {
    326        //    tbsCertList          TBSCertList,
    327        //    signatureAlgorithm   AlgorithmIdentifier,
    328        //    signatureValue       BIT STRING  }
    329 
    330        var names = in_window.org.pkijs.getNames(arguments[0]);
    331 
    332        return (new in_window.org.pkijs.asn1.SEQUENCE({
    333            name: (names.block_name || "CertificateList"),
    334            value: [
    335                local.tbsCertList(arguments[0]),
    336                in_window.org.pkijs.schema.ALGORITHM_IDENTIFIER(names.signatureAlgorithm || {
    337                    names: {
    338                        block_name: "signatureAlgorithm"
    339                    }
    340                }),
    341                new in_window.org.pkijs.asn1.BITSTRING({ name: (names.signatureValue || "signatureValue") })
    342            ]
    343        }));
    344    };
    345    //**************************************************************************************
    346    // #endregion 
    347    //**************************************************************************************
    348    // #region ASN.1 schema definition for PKCS#10 certificate request 
    349    //**************************************************************************************
    350    local.CertificationRequestInfo =
    351    function()
    352    {
    353        //CertificationRequestInfo ::= SEQUENCE {
    354        //    version       INTEGER { v1(0) } (v1,...),
    355        //    subject       Name,
    356        //    subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
    357        //    attributes    [0] Attributes{{ CRIAttributes }}
    358        //}
    359 
    360        var names = in_window.org.pkijs.getNames(arguments[0]);
    361 
    362        return (new in_window.org.pkijs.asn1.SEQUENCE({
    363            name: (names.CertificationRequestInfo || "CertificationRequestInfo"),
    364            value: [
    365                new in_window.org.pkijs.asn1.INTEGER({ name: (names.CertificationRequestInfo_version || "CertificationRequestInfo.version") }),
    366                new in_window.org.pkijs.schema.RDN(names.subject || {
    367                    names: {
    368                        block_name: "CertificationRequestInfo.subject"
    369                    }
    370                }),
    371                new in_window.org.pkijs.schema.PUBLIC_KEY_INFO({
    372                    names: {
    373                        block_name: "CertificationRequestInfo.subjectPublicKeyInfo"
    374                    }
    375                }),
    376                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    377                    optional: true,
    378                    id_block: {
    379                        tag_class: 3, // CONTEXT-SPECIFIC
    380                        tag_number: 0 // [0]
    381                    },
    382                    value: [
    383                        new in_window.org.pkijs.asn1.REPEATED({
    384                            optional: true, // Because OpenSSL makes wrong "attributes" field
    385                            name: (names.CertificationRequestInfo_attributes || "CertificationRequestInfo.attributes"),
    386                            value: in_window.org.pkijs.schema.ATTRIBUTE(names.attributes || {})
    387                        })
    388                    ]
    389                })
    390            ]
    391        }));
    392    };
    393    //**************************************************************************************
    394    in_window.org.pkijs.schema.PKCS10 =
    395    function()
    396    {
    397        //CertificationRequest ::= SEQUENCE {
    398        //    certificationRequestInfo CertificationRequestInfo,
    399        //    signatureAlgorithm       AlgorithmIdentifier{{ SignatureAlgorithms }},
    400        //    signature                BIT STRING
    401        //}
    402 
    403        var names = in_window.org.pkijs.getNames(arguments[0]);
    404 
    405        return (new in_window.org.pkijs.asn1.SEQUENCE({
    406            value: [
    407                local.CertificationRequestInfo(names.certificationRequestInfo || {}),
    408                new in_window.org.pkijs.asn1.SEQUENCE({
    409                    name: (names.signatureAlgorithm || "signatureAlgorithm"),
    410                    value: [
    411                        new in_window.org.pkijs.asn1.OID(),
    412                        new in_window.org.pkijs.asn1.ANY({ optional: true })
    413                    ]
    414                }),
    415                new in_window.org.pkijs.asn1.BITSTRING({ name: (names.signatureValue || "signatureValue") })
    416            ]
    417        }));
    418    };
    419    //**************************************************************************************
    420    // #endregion 
    421    //**************************************************************************************
    422    // #region ASN.1 schema definition for PKCS#8 private key bag
    423    //**************************************************************************************
    424    in_window.org.pkijs.schema.PKCS8 =
    425    function()
    426    {
    427        //PrivateKeyInfo ::= SEQUENCE {
    428        //    version Version,
    429        //    privateKeyAlgorithm AlgorithmIdentifier {{PrivateKeyAlgorithms}},
    430        //    privateKey PrivateKey,
    431        //    attributes [0] Attributes OPTIONAL }
    432        //
    433        //Version ::= INTEGER {v1(0)} (v1,...)
    434        //
    435        //PrivateKey ::= OCTET STRING
    436        //
    437        //Attributes ::= SET OF Attribute
    438 
    439        var names = in_window.org.pkijs.getNames(arguments[0]);
    440 
    441        return (new in_window.org.pkijs.asn1.SEQUENCE({
    442            value: [
    443                new in_window.org.pkijs.asn1.INTEGER({ name: (names.version || "") }),
    444                in_window.org.pkijs.schema.ALGORITHM_IDENTIFIER(names.privateKeyAlgorithm || ""),
    445                new in_window.org.pkijs.asn1.OCTETSTRING({ name: (names.privateKey || "") }),
    446                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    447                    optional: true,
    448                    id_block: {
    449                        tag_class: 3, // CONTEXT-SPECIFIC
    450                        tag_number: 0 // [0]
    451                    },
    452                    value: [
    453                        new in_window.org.pkijs.asn1.REPEATED({
    454                            name: (names.attributes || ""),
    455                            value: in_window.org.pkijs.schema.ATTRIBUTE()
    456                        })
    457                    ]
    458                })
    459            ]
    460        }));
    461    };
    462    //**************************************************************************************
    463    // #endregion 
    464    //**************************************************************************************
    465    // #region ASN.1 schema definition for "GeneralName" type 
    466    //**************************************************************************************
    467    local.BuiltInStandardAttributes =
    468    function(optional_flag)
    469    {
    470        //BuiltInStandardAttributes ::= SEQUENCE {
    471        //    country-name                  CountryName OPTIONAL,
    472        //    administration-domain-name    AdministrationDomainName OPTIONAL,
    473        //    network-address           [0] IMPLICIT NetworkAddress OPTIONAL,
    474        //    terminal-identifier       [1] IMPLICIT TerminalIdentifier OPTIONAL,
    475        //    private-domain-name       [2] PrivateDomainName OPTIONAL,
    476        //    organization-name         [3] IMPLICIT OrganizationName OPTIONAL,
    477        //    numeric-user-identifier   [4] IMPLICIT NumericUserIdentifier OPTIONAL,
    478        //    personal-name             [5] IMPLICIT PersonalName OPTIONAL,
    479        //    organizational-unit-names [6] IMPLICIT OrganizationalUnitNames OPTIONAL }
    480 
    481        if(typeof optional_flag === "undefined")
    482            optional_flag = false;
    483 
    484        var names = in_window.org.pkijs.getNames(arguments[0]);
    485 
    486        return (new in_window.org.pkijs.asn1.SEQUENCE({
    487            optional: optional_flag,
    488            value: [
    489                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    490                    optional: true,
    491                    id_block: {
    492                        tag_class: 2, // APPLICATION-SPECIFIC
    493                        tag_number: 1 // [1]
    494                    },
    495                    name: (names.country_name || ""),
    496                    value: [
    497                        new in_window.org.pkijs.asn1.CHOICE({
    498                            value: [
    499                                new in_window.org.pkijs.asn1.NUMERICSTRING(),
    500                                new in_window.org.pkijs.asn1.PRINTABLESTRING()
    501                            ]
    502                        })
    503                    ]
    504                }),
    505                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    506                    optional: true,
    507                    id_block: {
    508                        tag_class: 2, // APPLICATION-SPECIFIC
    509                        tag_number: 2 // [2]
    510                    },
    511                    name: (names.administration_domain_name || ""),
    512                    value: [
    513                        new in_window.org.pkijs.asn1.CHOICE({
    514                            value: [
    515                                new in_window.org.pkijs.asn1.NUMERICSTRING(),
    516                                new in_window.org.pkijs.asn1.PRINTABLESTRING()
    517                            ]
    518                        })
    519                    ]
    520                }),
    521                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    522                    optional: true,
    523                    id_block: {
    524                        tag_class: 3, // CONTEXT-SPECIFIC
    525                        tag_number: 0 // [0]
    526                    },
    527                    name: (names.network_address || ""),
    528                    is_hex_only: true
    529                }),
    530                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    531                    optional: true,
    532                    id_block: {
    533                        tag_class: 3, // CONTEXT-SPECIFIC
    534                        tag_number: 1 // [1]
    535                    },
    536                    name: (names.terminal_identifier || ""),
    537                    is_hex_only: true
    538                }),
    539                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    540                    optional: true,
    541                    id_block: {
    542                        tag_class: 3, // CONTEXT-SPECIFIC
    543                        tag_number: 2 // [2]
    544                    },
    545                    name: (names.private_domain_name || ""),
    546                    value: [
    547                        new in_window.org.pkijs.asn1.CHOICE({
    548                            value: [
    549                                new in_window.org.pkijs.asn1.NUMERICSTRING(),
    550                                new in_window.org.pkijs.asn1.PRINTABLESTRING()
    551                            ]
    552                        })
    553                    ]
    554                }),
    555                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    556                    optional: true,
    557                    id_block: {
    558                        tag_class: 3, // CONTEXT-SPECIFIC
    559                        tag_number: 3 // [3]
    560                    },
    561                    name: (names.organization_name || ""),
    562                    is_hex_only: true
    563                }),
    564                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    565                    optional: true,
    566                    name: (names.numeric_user_identifier || ""),
    567                    id_block: {
    568                        tag_class: 3, // CONTEXT-SPECIFIC
    569                        tag_number: 4 // [4]
    570                    },
    571                    is_hex_only: true
    572                }),
    573                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    574                    optional: true,
    575                    name: (names.personal_name || ""),
    576                    id_block: {
    577                        tag_class: 3, // CONTEXT-SPECIFIC
    578                        tag_number: 5 // [5]
    579                    },
    580                    value: [
    581                        new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    582                            id_block: {
    583                                tag_class: 3, // CONTEXT-SPECIFIC
    584                                tag_number: 0 // [0]
    585                            },
    586                            is_hex_only: true
    587                        }),
    588                        new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    589                            optional: true,
    590                            id_block: {
    591                                tag_class: 3, // CONTEXT-SPECIFIC
    592                                tag_number: 1 // [1]
    593                            },
    594                            is_hex_only: true
    595                        }),
    596                        new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    597                            optional: true,
    598                            id_block: {
    599                                tag_class: 3, // CONTEXT-SPECIFIC
    600                                tag_number: 2 // [2]
    601                            },
    602                            is_hex_only: true
    603                        }),
    604                        new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    605                            optional: true,
    606                            id_block: {
    607                                tag_class: 3, // CONTEXT-SPECIFIC
    608                                tag_number: 3 // [3]
    609                            },
    610                            is_hex_only: true
    611                        })
    612                    ]
    613                }),
    614                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    615                    optional: true,
    616                    name: (names.organizational_unit_names || ""),
    617                    id_block: {
    618                        tag_class: 3, // CONTEXT-SPECIFIC
    619                        tag_number: 6 // [6]
    620                    },
    621                    value: [
    622                        new in_window.org.pkijs.asn1.REPEATED({
    623                            value: new in_window.org.pkijs.asn1.PRINTABLESTRING()
    624                        })
    625                    ]
    626                })
    627            ]
    628        }));
    629    };
    630    //**************************************************************************************
    631    local.BuiltInDomainDefinedAttributes =
    632    function(optional_flag)
    633    {
    634        if(typeof optional_flag === "undefined")
    635            optional_flag = false;
    636 
    637        return (new in_window.org.pkijs.asn1.SEQUENCE({
    638            optional: optional_flag,
    639            value: [
    640                new in_window.org.pkijs.asn1.PRINTABLESTRING(),
    641                new in_window.org.pkijs.asn1.PRINTABLESTRING()
    642            ]
    643        }));
    644    };
    645    //**************************************************************************************
    646    local.ExtensionAttributes =
    647    function(optional_flag)
    648    {
    649        if(typeof optional_flag === "undefined")
    650            optional_flag = false;
    651 
    652        return (new in_window.org.pkijs.asn1.SET({
    653            optional: optional_flag,
    654            value: [
    655                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    656                    optional: true,
    657                    id_block: {
    658                        tag_class: 3, // CONTEXT-SPECIFIC
    659                        tag_number: 0 // [0]
    660                    },
    661                    is_hex_only: true
    662                }),
    663                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    664                    optional: true,
    665                    id_block: {
    666                        tag_class: 3, // CONTEXT-SPECIFIC
    667                        tag_number: 1 // [1]
    668                    },
    669                    value: [new in_window.org.pkijs.asn1.ANY()]
    670                })
    671            ]
    672        }));
    673    };
    674    //**************************************************************************************
    675    in_window.org.pkijs.schema.GENERAL_NAME =
    676    function()
    677    {
    678        /// <remarks>By passing "names" array as an argument you can name each element of "GENERAL NAME" choice</remarks>
    679 
    680        //GeneralName ::= CHOICE {
    681        //    otherName                       [0]     OtherName,
    682        //    rfc822Name                      [1]     IA5String,
    683        //    dNSName                         [2]     IA5String,
    684        //    x400Address                     [3]     ORAddress,
    685        //    directoryName                   [4]     Name,
    686        //    ediPartyName                    [5]     EDIPartyName,
    687        //    uniformResourceIdentifier       [6]     IA5String,
    688        //    iPAddress                       [7]     OCTET STRING,
    689        //    registeredID                    [8]     OBJECT IDENTIFIER }
    690 
    691        var names = in_window.org.pkijs.getNames(arguments[0]);
    692 
    693        return (new in_window.org.pkijs.asn1.CHOICE({
    694            value: [
    695                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    696                    id_block: {
    697                        tag_class: 3, // CONTEXT-SPECIFIC
    698                        tag_number: 0 // [0]
    699                    },
    700                    name: (names.block_name || ""),
    701                    value: [
    702                            new in_window.org.pkijs.asn1.OID(),
    703                            new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    704                                id_block: {
    705                                    tag_class: 3, // CONTEXT-SPECIFIC
    706                                    tag_number: 0 // [0]
    707                                },
    708                                value: [new in_window.org.pkijs.asn1.ANY()]
    709                            })
    710                    ]
    711                }),
    712                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    713                    name: (names.block_name || ""),
    714                    id_block: {
    715                        tag_class: 3, // CONTEXT-SPECIFIC
    716                        tag_number: 1 // [1]
    717                    }
    718                }),
    719                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    720                    name: (names.block_name || ""),
    721                    id_block: {
    722                        tag_class: 3, // CONTEXT-SPECIFIC
    723                        tag_number: 2 // [2]
    724                    }
    725                }),
    726                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    727                    id_block: {
    728                        tag_class: 3, // CONTEXT-SPECIFIC
    729                        tag_number: 3 // [3]
    730                    },
    731                    name: (names.block_name || ""),
    732                    value: [
    733                            local.BuiltInStandardAttributes(false),
    734                            local.BuiltInDomainDefinedAttributes(true),
    735                            local.ExtensionAttributes(true)
    736                    ]
    737                }),
    738                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    739                    id_block: {
    740                        tag_class: 3, // CONTEXT-SPECIFIC
    741                        tag_number: 4 // [4]
    742                    },
    743                    name: (names.block_name || ""),
    744                    value: [in_window.org.pkijs.schema.RDN(names.directoryName || {})]
    745                }),
    746                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    747                    id_block: {
    748                        tag_class: 3, // CONTEXT-SPECIFIC
    749                        tag_number: 5 // [5]
    750                    },
    751                    name: (names.block_name || ""),
    752                    value: [
    753                            new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    754                                optional: true,
    755                                id_block: {
    756                                    tag_class: 3, // CONTEXT-SPECIFIC
    757                                    tag_number: 0 // [0]
    758                                },
    759                                value: [
    760                                    new in_window.org.pkijs.asn1.CHOICE({
    761                                        value: [
    762                                            new in_window.org.pkijs.asn1.TELETEXSTRING(),
    763                                            new in_window.org.pkijs.asn1.PRINTABLESTRING(),
    764                                            new in_window.org.pkijs.asn1.UNIVERSALSTRING(),
    765                                            new in_window.org.pkijs.asn1.UTF8STRING(),
    766                                            new in_window.org.pkijs.asn1.BMPSTRING()
    767                                        ]
    768                                    })
    769                                ]
    770                            }),
    771                            new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    772                                id_block: {
    773                                    tag_class: 3, // CONTEXT-SPECIFIC
    774                                    tag_number: 1 // [1]
    775                                },
    776                                value: [
    777                                    new in_window.org.pkijs.asn1.CHOICE({
    778                                        value: [
    779                                            new in_window.org.pkijs.asn1.TELETEXSTRING(),
    780                                            new in_window.org.pkijs.asn1.PRINTABLESTRING(),
    781                                            new in_window.org.pkijs.asn1.UNIVERSALSTRING(),
    782                                            new in_window.org.pkijs.asn1.UTF8STRING(),
    783                                            new in_window.org.pkijs.asn1.BMPSTRING()
    784                                        ]
    785                                    })
    786                                ]
    787                            })
    788                    ]
    789                }),
    790                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    791                    name: (names.block_name || ""),
    792                    id_block: {
    793                        tag_class: 3, // CONTEXT-SPECIFIC
    794                        tag_number: 6 // [6]
    795                    }
    796                }),
    797                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    798                    name: (names.block_name || ""),
    799                    id_block: {
    800                        tag_class: 3, // CONTEXT-SPECIFIC
    801                        tag_number: 7 // [7]
    802                    }
    803                }),
    804                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
    805                    name: (names.block_name || ""),
    806                    id_block: {
    807                        tag_class: 3, // CONTEXT-SPECIFIC
    808                        tag_number: 8 // [8]
    809                    }
    810                })
    811            ]
    812        }));
    813    };
    814    //**************************************************************************************
    815    // #endregion 
    816    //**************************************************************************************
    817    // #region ASN.1 schema definition for "AlgorithmIdentifier" type 
    818    //**************************************************************************************
    819    in_window.org.pkijs.schema.ALGORITHM_IDENTIFIER =
    820    function()
    821    {
    822        //AlgorithmIdentifier  ::=  SEQUENCE  {
    823        //    algorithm               OBJECT IDENTIFIER,
    824        //    parameters              ANY DEFINED BY algorithm OPTIONAL  }
    825 
    826        var names = in_window.org.pkijs.getNames(arguments[0]);
    827 
    828        return (new in_window.org.pkijs.asn1.SEQUENCE({
    829            name: (names.block_name || ""),
    830            optional: (names.optional || false),
    831            value: [
    832                new in_window.org.pkijs.asn1.OID({ name: (names.algorithmIdentifier || "") }),
    833                new in_window.org.pkijs.asn1.ANY({ name: (names.algorithmParams || ""), optional: true })
    834            ]
    835        }));
    836    };
    837    //**************************************************************************************
    838    // #endregion 
    839    //**************************************************************************************
    840    // #region ASN.1 schema definition for "RSAPublicKey" type (RFC3447)
    841    //**************************************************************************************
    842    in_window.org.pkijs.schema.x509.RSAPublicKey =
    843    function()
    844    {
    845        //RSAPublicKey ::= SEQUENCE {
    846        //    modulus           INTEGER,  -- n
    847        //    publicExponent    INTEGER   -- e
    848        //}
    849 
    850        var names = in_window.org.pkijs.getNames(arguments[0]);
    851 
    852        return (new in_window.org.pkijs.asn1.SEQUENCE({
    853            name: (names.block_name || ""),
    854            value: [
    855                new in_window.org.pkijs.asn1.INTEGER({ name: (names.modulus || "") }),
    856                new in_window.org.pkijs.asn1.INTEGER({ name: (names.publicExponent || "") })
    857            ]
    858        }));
    859    };
    860    //**************************************************************************************
    861    // #endregion 
    862    //**************************************************************************************
    863    // #region ASN.1 schema definition for "OtherPrimeInfo" type (RFC3447) 
    864    //**************************************************************************************
    865    in_window.org.pkijs.schema.x509.OtherPrimeInfo =
    866    function()
    867    {
    868        //OtherPrimeInfo ::= SEQUENCE {
    869        //    prime             INTEGER,  -- ri
    870        //    exponent          INTEGER,  -- di
    871        //    coefficient       INTEGER   -- ti
    872        //}
    873 
    874        var names = in_window.org.pkijs.getNames(arguments[0]);
    875 
    876        return (new in_window.org.pkijs.asn1.SEQUENCE({
    877            name: (names.block_name || ""),
    878            value: [
    879                new in_window.org.pkijs.asn1.INTEGER({ name: (names.prime || "") }),
    880                new in_window.org.pkijs.asn1.INTEGER({ name: (names.exponent || "") }),
    881                new in_window.org.pkijs.asn1.INTEGER({ name: (names.coefficient || "") })
    882    ]
    883        }));
    884    };
    885    //**************************************************************************************
    886    // #endregion 
    887    //**************************************************************************************
    888    // #region ASN.1 schema definition for "RSAPrivateKey" type (RFC3447)
    889    //**************************************************************************************
    890    in_window.org.pkijs.schema.x509.RSAPrivateKey =
    891    function()
    892    {
    893        //RSAPrivateKey ::= SEQUENCE {
    894        //    version           Version,
    895        //    modulus           INTEGER,  -- n
    896        //    publicExponent    INTEGER,  -- e
    897        //    privateExponent   INTEGER,  -- d
    898        //    prime1            INTEGER,  -- p
    899        //    prime2            INTEGER,  -- q
    900        //    exponent1         INTEGER,  -- d mod (p-1)
    901        //    exponent2         INTEGER,  -- d mod (q-1)
    902        //    coefficient       INTEGER,  -- (inverse of q) mod p
    903        //    otherPrimeInfos   OtherPrimeInfos OPTIONAL
    904        //}
    905        //
    906        //OtherPrimeInfos ::= SEQUENCE SIZE(1..MAX) OF OtherPrimeInfo
    907 
    908        var names = in_window.org.pkijs.getNames(arguments[0]);
    909 
    910        return (new in_window.org.pkijs.asn1.SEQUENCE({
    911            name: (names.block_name || ""),
    912            value: [
    913                new in_window.org.pkijs.asn1.INTEGER({ name: (names.version || "") }),
    914                new in_window.org.pkijs.asn1.INTEGER({ name: (names.modulus || "") }),
    915                new in_window.org.pkijs.asn1.INTEGER({ name: (names.publicExponent || "") }),
    916                new in_window.org.pkijs.asn1.INTEGER({ name: (names.privateExponent || "") }),
    917                new in_window.org.pkijs.asn1.INTEGER({ name: (names.prime1 || "") }),
    918                new in_window.org.pkijs.asn1.INTEGER({ name: (names.prime2 || "") }),
    919                new in_window.org.pkijs.asn1.INTEGER({ name: (names.exponent1 || "") }),
    920                new in_window.org.pkijs.asn1.INTEGER({ name: (names.exponent2 || "") }),
    921                new in_window.org.pkijs.asn1.INTEGER({ name: (names.coefficient || "") }),
    922                new in_window.org.pkijs.asn1.SEQUENCE({
    923                    optional: true,
    924                    value: [
    925                        new in_window.org.pkijs.asn1.REPEATED({
    926                            name: (names.otherPrimeInfos || ""),
    927                            value: in_window.org.pkijs.schema.x509.OtherPrimeInfo(names.otherPrimeInfo || {})
    928                        })
    929                    ]
    930                })
    931            ]
    932        }));
    933    };
    934    //**************************************************************************************
    935    // #endregion 
    936    //**************************************************************************************
    937    // #region ASN.1 schema definition for "RSASSA-PSS-params" type (RFC3447)
    938    //**************************************************************************************
    939    in_window.org.pkijs.schema.x509.RSASSA_PSS_params =
    940    function()
    941    {
    942        //RSASSA-PSS-params  ::=  SEQUENCE  {
    943        //    hashAlgorithm      [0] HashAlgorithm DEFAULT sha1Identifier,
    944        //    maskGenAlgorithm   [1] MaskGenAlgorithm DEFAULT mgf1SHA1Identifier,
    945        //    saltLength         [2] INTEGER DEFAULT 20,
    946        //    trailerField       [3] INTEGER DEFAULT 1  }
    947 
    948        var names = in_window.org.pkijs.getNames(arguments[0]);
    949 
    950        return (new in_window.org.pkijs.asn1.SEQUENCE({
    951            name: (names.block_name || ""),
    952            value: [
    953                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    954                    id_block: {
    955                        tag_class: 3, // CONTEXT-SPECIFIC
    956                        tag_number: 0 // [0]
    957                    },
    958                    optional: true,
    959                    value: [in_window.org.pkijs.schema.ALGORITHM_IDENTIFIER(names.hashAlgorithm || {})]
    960                }),
    961                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    962                    id_block: {
    963                        tag_class: 3, // CONTEXT-SPECIFIC
    964                        tag_number: 1 // [1]
    965                    },
    966                    optional: true,
    967                    value: [in_window.org.pkijs.schema.ALGORITHM_IDENTIFIER(names.maskGenAlgorithm || {})]
    968                }),
    969                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    970                    id_block: {
    971                        tag_class: 3, // CONTEXT-SPECIFIC
    972                        tag_number: 2 // [2]
    973                    },
    974                    optional: true,
    975                    value: [new in_window.org.pkijs.asn1.INTEGER({ name: (names.saltLength || "") })]
    976                }),
    977                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
    978                    id_block: {
    979                        tag_class: 3, // CONTEXT-SPECIFIC
    980                        tag_number: 3 // [3]
    981                    },
    982                    optional: true,
    983                    value: [new in_window.org.pkijs.asn1.INTEGER({ name: (names.trailerField || "") })]
    984                })
    985            ]
    986        }));
    987    };
    988    //**************************************************************************************
    989    // #endregion 
    990    //**************************************************************************************
    991    // #region ASN.1 schema definition for "SubjectPublicKeyInfo" type 
    992    //**************************************************************************************
    993    in_window.org.pkijs.schema.PUBLIC_KEY_INFO =
    994    function()
    995    {
    996        //SubjectPublicKeyInfo  ::=  SEQUENCE  {
    997        //    algorithm            AlgorithmIdentifier,
    998        //    subjectPublicKey     BIT STRING  }
    999 
   1000        var names = in_window.org.pkijs.getNames(arguments[0]);
   1001 
   1002        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1003            name: (names.block_name || ""),
   1004            value: [
   1005                in_window.org.pkijs.schema.ALGORITHM_IDENTIFIER(names.algorithm || {}),
   1006                new in_window.org.pkijs.asn1.BITSTRING({ name: (names.subjectPublicKey || "") })
   1007            ]
   1008        }));
   1009    };
   1010    //**************************************************************************************
   1011    // #endregion 
   1012    //**************************************************************************************
   1013    // #region ASN.1 schema definition for "Attribute" type 
   1014    //**************************************************************************************
   1015    in_window.org.pkijs.schema.ATTRIBUTE =
   1016    function()
   1017    {
   1018        // Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE {
   1019        //    type   ATTRIBUTE.&id({IOSet}),
   1020        //    values SET SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{@type})
   1021        //}
   1022 
   1023        var names = in_window.org.pkijs.getNames(arguments[0]);
   1024 
   1025        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1026            name: (names.block_name || ""),
   1027            value: [
   1028                new in_window.org.pkijs.asn1.OID({ name: (names.type || "") }),
   1029                new in_window.org.pkijs.asn1.SET({
   1030                    name: (names.set_name || ""),
   1031                    value: [
   1032                        new in_window.org.pkijs.asn1.REPEATED({
   1033                            name: (names.values || ""),
   1034                            value: new in_window.org.pkijs.asn1.ANY()
   1035                        })
   1036                    ]
   1037                })
   1038            ]
   1039        }));
   1040    };
   1041    //**************************************************************************************
   1042    // #endregion 
   1043    //**************************************************************************************
   1044    // #region ASN.1 schema definition for "AttributeTypeAndValue" type 
   1045    //**************************************************************************************
   1046    in_window.org.pkijs.schema.ATTR_TYPE_AND_VALUE =
   1047    function()
   1048    {
   1049        //AttributeTypeAndValue ::= SEQUENCE {
   1050        //    type     AttributeType,
   1051        //    value    AttributeValue }
   1052        //
   1053        //AttributeType ::= OBJECT IDENTIFIER
   1054        //
   1055        //AttributeValue ::= ANY -- DEFINED BY AttributeType
   1056 
   1057        var names = in_window.org.pkijs.getNames(arguments[0]);
   1058 
   1059        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1060            name: (names.block_name || ""),
   1061            value: [
   1062                new in_window.org.pkijs.asn1.OID({ name: (names.type || "") }),
   1063                new in_window.org.pkijs.asn1.ANY({ name: (names.value || "") })
   1064            ]
   1065        }));
   1066    };
   1067    //**************************************************************************************
   1068    // #endregion 
   1069    //**************************************************************************************
   1070    // #region ASN.1 schema definition for "RelativeDistinguishedName" type 
   1071    //**************************************************************************************
   1072    in_window.org.pkijs.schema.RDN =
   1073    function()
   1074    {
   1075        //RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
   1076        //
   1077        //RelativeDistinguishedName ::=
   1078        //SET SIZE (1..MAX) OF AttributeTypeAndValue
   1079 
   1080        var names = in_window.org.pkijs.getNames(arguments[0]);
   1081 
   1082        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1083            name: (names.block_name || ""),
   1084            value: [
   1085                new in_window.org.pkijs.asn1.REPEATED({
   1086                    name: (names.repeated_sequence || ""),
   1087                    value: new in_window.org.pkijs.asn1.SET({
   1088                        value: [
   1089                            new in_window.org.pkijs.asn1.REPEATED({
   1090                                name: (names.repeated_set || ""),
   1091                                value: in_window.org.pkijs.schema.ATTR_TYPE_AND_VALUE(names.attr_type_and_value || {})
   1092                            })
   1093                        ]
   1094                    })
   1095                })
   1096            ]
   1097        }));
   1098    };
   1099    //**************************************************************************************
   1100    // #endregion 
   1101    //**************************************************************************************
   1102    // #region ASN.1 schema definition for "Extension" type 
   1103    //**************************************************************************************
   1104    in_window.org.pkijs.schema.EXTENSION =
   1105    function()
   1106    {
   1107        //Extension  ::=  SEQUENCE  {
   1108        //    extnID      OBJECT IDENTIFIER,
   1109        //    critical    BOOLEAN DEFAULT FALSE,
   1110        //    extnValue   OCTET STRING
   1111        //}
   1112 
   1113        var names = in_window.org.pkijs.getNames(arguments[0]);
   1114 
   1115        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1116            name: (names.block_name || ""),
   1117            value: [
   1118                new in_window.org.pkijs.asn1.OID({ name: (names.extnID || "") }),
   1119                new in_window.org.pkijs.asn1.BOOLEAN({
   1120                    name: (names.critical || ""),
   1121                    optional: true
   1122                }),
   1123                new in_window.org.pkijs.asn1.OCTETSTRING({ name: (names.extnValue || "") })
   1124            ]
   1125        }));
   1126    };
   1127    //**************************************************************************************
   1128    // #endregion 
   1129    //**************************************************************************************
   1130    // #region ASN.1 schema definition for "Extensions" type (sequence of many Extension)
   1131    //**************************************************************************************
   1132    in_window.org.pkijs.schema.EXTENSIONS =
   1133    function(input_names, input_optional)
   1134    {
   1135        //Extensions  ::=  SEQUENCE SIZE (1..MAX) OF Extension
   1136 
   1137        var names = in_window.org.pkijs.getNames(arguments[0]);
   1138        var optional = input_optional || false;
   1139 
   1140        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1141            optional: optional,
   1142            name: (names.block_name || ""),
   1143            value: [
   1144                new in_window.org.pkijs.asn1.REPEATED({
   1145                    name: (names.extensions || ""),
   1146                    value: in_window.org.pkijs.schema.EXTENSION(names.extension || {})
   1147                })
   1148            ]
   1149        }));
   1150    };
   1151    //**************************************************************************************
   1152    // #endregion 
   1153    //**************************************************************************************
   1154    // #region ASN.1 schema definition for "AuthorityKeyIdentifier" type of extension 
   1155    //**************************************************************************************
   1156    in_window.org.pkijs.schema.x509.AuthorityKeyIdentifier =
   1157    function()
   1158    {
   1159        // AuthorityKeyIdentifier OID ::= 2.5.29.35
   1160        // 
   1161        //AuthorityKeyIdentifier ::= SEQUENCE {
   1162        //    keyIdentifier             [0] KeyIdentifier           OPTIONAL,
   1163        //    authorityCertIssuer       [1] GeneralNames            OPTIONAL,
   1164        //    authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL  }
   1165        //
   1166        //KeyIdentifier ::= OCTET STRING
   1167 
   1168        var names = in_window.org.pkijs.getNames(arguments[0]);
   1169 
   1170        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1171            name: (names.block_name || ""),
   1172            value: [
   1173                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
   1174                    name: (names.keyIdentifier || ""),
   1175                    optional: true,
   1176                    id_block: {
   1177                        tag_class: 3, // CONTEXT-SPECIFIC
   1178                        tag_number: 0 // [0]
   1179                    }
   1180                }),
   1181                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
   1182                    optional: true,
   1183                    id_block: {
   1184                        tag_class: 3, // CONTEXT-SPECIFIC
   1185                        tag_number: 1 // [1]
   1186                    },
   1187                    value: [
   1188                            new in_window.org.pkijs.asn1.REPEATED({
   1189                                name: (names.authorityCertIssuer || ""),
   1190                                value: in_window.org.pkijs.schema.GENERAL_NAME()
   1191                            })
   1192                    ]
   1193                }),
   1194                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
   1195                    name: (names.authorityCertSerialNumber || ""),
   1196                    optional: true,
   1197                    id_block: {
   1198                        tag_class: 3, // CONTEXT-SPECIFIC
   1199                        tag_number: 2 // [2]
   1200                    }
   1201                })
   1202            ]
   1203        }));
   1204    };
   1205    //**************************************************************************************
   1206    // #endregion 
   1207    //**************************************************************************************
   1208    // #region ASN.1 schema definition for "PrivateKeyUsagePeriod" type of extension 
   1209    //**************************************************************************************
   1210    in_window.org.pkijs.schema.x509.PrivateKeyUsagePeriod =
   1211    function()
   1212    {
   1213        // PrivateKeyUsagePeriod OID ::= 2.5.29.16
   1214        //
   1215        //PrivateKeyUsagePeriod ::= SEQUENCE {
   1216        //    notBefore       [0]     GeneralizedTime OPTIONAL,
   1217        //    notAfter        [1]     GeneralizedTime OPTIONAL }
   1218        //-- either notBefore or notAfter MUST be present
   1219 
   1220        var names = in_window.org.pkijs.getNames(arguments[0]);
   1221 
   1222        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1223            name: (names.block_name || ""),
   1224            value: [
   1225                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
   1226                    name: (names.notBefore || ""),
   1227                    optional: true,
   1228                    id_block: {
   1229                        tag_class: 3, // CONTEXT-SPECIFIC
   1230                        tag_number: 0 // [0]
   1231                    }
   1232                }),
   1233                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
   1234                    name: (names.notAfter || ""),
   1235                    optional: true,
   1236                    id_block: {
   1237                        tag_class: 3, // CONTEXT-SPECIFIC
   1238                        tag_number: 1 // [1]
   1239                    }
   1240                })
   1241            ]
   1242        }));
   1243    };
   1244    //**************************************************************************************
   1245    // #endregion 
   1246    //**************************************************************************************
   1247    // #region ASN.1 schema definition for "IssuerAltName" and "SubjectAltName" types of extension 
   1248    //**************************************************************************************
   1249    in_window.org.pkijs.schema.x509.AltName =
   1250    function()
   1251    {
   1252        // SubjectAltName OID ::= 2.5.29.17
   1253        // IssuerAltName OID ::= 2.5.29.18
   1254        //
   1255        // AltName ::= GeneralNames
   1256 
   1257        var names = in_window.org.pkijs.getNames(arguments[0]);
   1258 
   1259        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1260            name: (names.block_name || ""),
   1261            value: [
   1262                new in_window.org.pkijs.asn1.REPEATED({
   1263                    name: (names.altNames || ""),
   1264                    value: in_window.org.pkijs.schema.GENERAL_NAME()
   1265                })
   1266            ]
   1267        }));
   1268    };
   1269    //**************************************************************************************
   1270    // #endregion 
   1271    //**************************************************************************************
   1272    // #region ASN.1 schema definition for "SubjectDirectoryAttributes" type of extension 
   1273    //**************************************************************************************
   1274    in_window.org.pkijs.schema.x509.SubjectDirectoryAttributes =
   1275    function()
   1276    {
   1277        // SubjectDirectoryAttributes OID ::= 2.5.29.9
   1278        //
   1279        //SubjectDirectoryAttributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
   1280 
   1281        var names = in_window.org.pkijs.getNames(arguments[0]);
   1282 
   1283        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1284            name: (names.block_name || ""),
   1285            value: [
   1286                new in_window.org.pkijs.asn1.REPEATED({
   1287                    name: (names.attributes || ""),
   1288                    value: in_window.org.pkijs.schema.ATTRIBUTE()
   1289                })
   1290            ]
   1291        }));
   1292    };
   1293    //**************************************************************************************
   1294    // #endregion 
   1295    //**************************************************************************************
   1296    // #region ASN.1 schema definition for "GeneralSubtree" type 
   1297    //**************************************************************************************
   1298    in_window.org.pkijs.schema.x509.GeneralSubtree =
   1299    function()
   1300    {
   1301        //GeneralSubtree ::= SEQUENCE {
   1302        //    base                    GeneralName,
   1303        //    minimum         [0]     BaseDistance DEFAULT 0,
   1304        //    maximum         [1]     BaseDistance OPTIONAL }
   1305        //
   1306        //BaseDistance ::= INTEGER (0..MAX)
   1307 
   1308        var names = in_window.org.pkijs.getNames(arguments[0]);
   1309 
   1310        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1311            name: (names.block_name || ""),
   1312            value: [
   1313                in_window.org.pkijs.schema.GENERAL_NAME(names.base || ""),
   1314                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
   1315                    optional: true,
   1316                    id_block: {
   1317                        tag_class: 3, // CONTEXT-SPECIFIC
   1318                        tag_number: 0 // [0]
   1319                    },
   1320                    value: [new in_window.org.pkijs.asn1.INTEGER({ name: (names.minimum || "") })]
   1321                }),
   1322                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
   1323                    optional: true,
   1324                    id_block: {
   1325                        tag_class: 3, // CONTEXT-SPECIFIC
   1326                        tag_number: 1 // [1]
   1327                    },
   1328                    value: [new in_window.org.pkijs.asn1.INTEGER({ name: (names.maximum || "") })]
   1329                })
   1330            ]
   1331        }));
   1332    };
   1333    //**************************************************************************************
   1334    // #endregion 
   1335    //**************************************************************************************
   1336    // #region ASN.1 schema definition for "NameConstraints" type of extension 
   1337    //**************************************************************************************
   1338    in_window.org.pkijs.schema.x509.NameConstraints =
   1339    function()
   1340    {
   1341        // NameConstraints OID ::= 2.5.29.30
   1342        //
   1343        //NameConstraints ::= SEQUENCE {
   1344        //    permittedSubtrees       [0]     GeneralSubtrees OPTIONAL,
   1345        //    excludedSubtrees        [1]     GeneralSubtrees OPTIONAL }
   1346 
   1347        var names = in_window.org.pkijs.getNames(arguments[0]);
   1348 
   1349        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1350            name: (names.block_name || ""),
   1351            value: [
   1352                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
   1353                    optional: true,
   1354                    id_block: {
   1355                        tag_class: 3, // CONTEXT-SPECIFIC
   1356                        tag_number: 0 // [0]
   1357                    },
   1358                    value: [
   1359                        new in_window.org.pkijs.asn1.REPEATED({
   1360                            name: (names.permittedSubtrees || ""),
   1361                            value: in_window.org.pkijs.schema.x509.GeneralSubtree()
   1362                        })
   1363                    ]
   1364                }),
   1365                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
   1366                    optional: true,
   1367                    id_block: {
   1368                        tag_class: 3, // CONTEXT-SPECIFIC
   1369                        tag_number: 1 // [1]
   1370                    },
   1371                    value: [
   1372                        new in_window.org.pkijs.asn1.REPEATED({
   1373                            name: (names.excludedSubtrees || ""),
   1374                            value: in_window.org.pkijs.schema.x509.GeneralSubtree()
   1375                        })
   1376                    ]
   1377                })
   1378            ]
   1379        }));
   1380    };
   1381    //**************************************************************************************
   1382    // #endregion 
   1383    //**************************************************************************************
   1384    // #region ASN.1 schema definition for "BasicConstraints" type of extension 
   1385    //**************************************************************************************
   1386    in_window.org.pkijs.schema.x509.BasicConstraints =
   1387    function()
   1388    {
   1389        // BasicConstraints OID ::= 2.5.29.19
   1390        //
   1391        //BasicConstraints ::= SEQUENCE {
   1392        //    cA                      BOOLEAN DEFAULT FALSE,
   1393        //    pathLenConstraint       INTEGER (0..MAX) OPTIONAL }
   1394 
   1395        var names = in_window.org.pkijs.getNames(arguments[0]);
   1396 
   1397        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1398            name: (names.block_name || ""),
   1399            value: [
   1400                new in_window.org.pkijs.asn1.BOOLEAN({
   1401                    optional: true,
   1402                    name: (names.cA || "")
   1403                }),
   1404                new in_window.org.pkijs.asn1.INTEGER({
   1405                    optional: true,
   1406                    name: (names.pathLenConstraint || "")
   1407                })
   1408            ]
   1409        }));
   1410    };
   1411    //**************************************************************************************
   1412    // #endregion 
   1413    //**************************************************************************************
   1414    // #region ASN.1 schema definition for "PolicyQualifierInfo" type 
   1415    //**************************************************************************************
   1416    in_window.org.pkijs.schema.x509.PolicyQualifierInfo =
   1417    function()
   1418    {
   1419        //PolicyQualifierInfo ::= SEQUENCE {
   1420        //    policyQualifierId  PolicyQualifierId,
   1421        //    qualifier          ANY DEFINED BY policyQualifierId }
   1422        //
   1423        //id-qt          OBJECT IDENTIFIER ::=  { id-pkix 2 }
   1424        //id-qt-cps      OBJECT IDENTIFIER ::=  { id-qt 1 }
   1425        //id-qt-unotice  OBJECT IDENTIFIER ::=  { id-qt 2 }
   1426        //
   1427        //PolicyQualifierId ::= OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice )
   1428 
   1429        var names = in_window.org.pkijs.getNames(arguments[0]);
   1430 
   1431        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1432            name: (names.block_name || ""),
   1433            value: [
   1434                new in_window.org.pkijs.asn1.OID({ name: (names.policyQualifierId || "") }),
   1435                new in_window.org.pkijs.asn1.ANY({ name: (names.qualifier || "") })
   1436            ]
   1437        }));
   1438    };
   1439    //**************************************************************************************
   1440    // #endregion 
   1441    //**************************************************************************************
   1442    // #region ASN.1 schema definition for "PolicyInformation" type 
   1443    //**************************************************************************************
   1444    in_window.org.pkijs.schema.x509.PolicyInformation =
   1445    function()
   1446    {
   1447        //PolicyInformation ::= SEQUENCE {
   1448        //    policyIdentifier   CertPolicyId,
   1449        //    policyQualifiers   SEQUENCE SIZE (1..MAX) OF
   1450        //    PolicyQualifierInfo OPTIONAL }
   1451        //
   1452        //CertPolicyId ::= OBJECT IDENTIFIER
   1453 
   1454        var names = in_window.org.pkijs.getNames(arguments[0]);
   1455 
   1456        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1457            name: (names.block_name || ""),
   1458            value: [
   1459                new in_window.org.pkijs.asn1.OID({ name: (names.policyIdentifier || "") }),
   1460                new in_window.org.pkijs.asn1.SEQUENCE({
   1461                    optional: true,
   1462                    value: [
   1463                        new in_window.org.pkijs.asn1.REPEATED({
   1464                            name: (names.policyQualifiers || ""),
   1465                            value: in_window.org.pkijs.schema.x509.PolicyQualifierInfo()
   1466                        })
   1467                    ]
   1468                })
   1469            ]
   1470        }));
   1471    };
   1472    //**************************************************************************************
   1473    // #endregion 
   1474    //**************************************************************************************
   1475    // #region ASN.1 schema definition for "CertificatePolicies" type of extension 
   1476    //**************************************************************************************
   1477    in_window.org.pkijs.schema.x509.CertificatePolicies =
   1478    function()
   1479    {
   1480        // CertificatePolicies OID ::= 2.5.29.32
   1481        //
   1482        //certificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation
   1483 
   1484        var names = in_window.org.pkijs.getNames(arguments[0]);
   1485 
   1486        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1487            name: (names.block_name || ""),
   1488            value: [
   1489                new in_window.org.pkijs.asn1.REPEATED({
   1490                    name: (names.certificatePolicies || ""),
   1491                    value: in_window.org.pkijs.schema.x509.PolicyInformation()
   1492                })
   1493            ]
   1494        }));
   1495    };
   1496    //**************************************************************************************
   1497    // #endregion 
   1498    //**************************************************************************************
   1499    // #region ASN.1 schema definition for "PolicyMapping" type
   1500    //**************************************************************************************
   1501    in_window.org.pkijs.schema.x509.PolicyMapping =
   1502    function()
   1503    {
   1504        //PolicyMapping ::= SEQUENCE {
   1505        //    issuerDomainPolicy      CertPolicyId,
   1506        //    subjectDomainPolicy     CertPolicyId }
   1507 
   1508        var names = in_window.org.pkijs.getNames(arguments[0]);
   1509 
   1510        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1511            name: (names.block_name || ""),
   1512            value: [
   1513                new in_window.org.pkijs.asn1.OID({ name: (names.issuerDomainPolicy || "") }),
   1514                new in_window.org.pkijs.asn1.OID({ name: (names.subjectDomainPolicy || "") })
   1515            ]
   1516        }));
   1517    };
   1518    //**************************************************************************************
   1519    // #endregion 
   1520    //**************************************************************************************
   1521    // #region ASN.1 schema definition for "PolicyMappings" type of extension 
   1522    //**************************************************************************************
   1523    in_window.org.pkijs.schema.x509.PolicyMappings =
   1524    function()
   1525    {
   1526        // PolicyMappings OID ::= 2.5.29.33
   1527        //
   1528        //PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF PolicyMapping
   1529 
   1530        var names = in_window.org.pkijs.getNames(arguments[0]);
   1531 
   1532        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1533            name: (names.block_name || ""),
   1534            value: [
   1535                new in_window.org.pkijs.asn1.REPEATED({
   1536                    name: (names.mappings || ""),
   1537                    value: in_window.org.pkijs.schema.x509.PolicyMapping()
   1538                })
   1539            ]
   1540        }));
   1541    };
   1542    //**************************************************************************************
   1543    // #endregion 
   1544    //**************************************************************************************
   1545    // #region ASN.1 schema definition for "PolicyConstraints" type of extension 
   1546    //**************************************************************************************
   1547    in_window.org.pkijs.schema.x509.PolicyConstraints =
   1548    function()
   1549    {
   1550        // PolicyMappings OID ::= 2.5.29.36
   1551        //
   1552        //PolicyConstraints ::= SEQUENCE {
   1553        //    requireExplicitPolicy           [0] SkipCerts OPTIONAL,
   1554        //    inhibitPolicyMapping            [1] SkipCerts OPTIONAL }
   1555        //
   1556        //SkipCerts ::= INTEGER (0..MAX)
   1557 
   1558        var names = in_window.org.pkijs.getNames(arguments[0]);
   1559 
   1560        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1561            name: (names.block_name || ""),
   1562            value: [
   1563                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
   1564                    name: (names.requireExplicitPolicy || ""),
   1565                    optional: true,
   1566                    id_block: {
   1567                        tag_class: 3, // CONTEXT-SPECIFIC
   1568                        tag_number: 0 // [0]
   1569                    }
   1570                }), // IMPLICIT integer value
   1571                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
   1572                    name: (names.inhibitPolicyMapping || ""),
   1573                    optional: true,
   1574                    id_block: {
   1575                        tag_class: 3, // CONTEXT-SPECIFIC
   1576                        tag_number: 1 // [1]
   1577                    }
   1578                }) // IMPLICIT integer value
   1579            ]
   1580        }));
   1581    };
   1582    //**************************************************************************************
   1583    // #endregion 
   1584    //**************************************************************************************
   1585    // #region ASN.1 schema definition for "ExtKeyUsage" type of extension 
   1586    //**************************************************************************************
   1587    in_window.org.pkijs.schema.x509.ExtKeyUsage =
   1588    function()
   1589    {
   1590        // ExtKeyUsage OID ::= 2.5.29.37
   1591        //
   1592        // ExtKeyUsage ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
   1593 
   1594        // KeyPurposeId ::= OBJECT IDENTIFIER
   1595 
   1596        var names = in_window.org.pkijs.getNames(arguments[0]);
   1597 
   1598        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1599            name: (names.block_name || ""),
   1600            value: [
   1601                new in_window.org.pkijs.asn1.REPEATED({
   1602                    name: (names.keyPurposes || ""),
   1603                    value: new in_window.org.pkijs.asn1.OID()
   1604                })
   1605            ]
   1606        }));
   1607    };
   1608    //**************************************************************************************
   1609    // #endregion 
   1610    //**************************************************************************************
   1611    // #region ASN.1 schema definition for "DistributionPoint" type
   1612    //**************************************************************************************
   1613    in_window.org.pkijs.schema.x509.DistributionPoint =
   1614    function()
   1615    {
   1616        //DistributionPoint ::= SEQUENCE {
   1617        //    distributionPoint       [0]     DistributionPointName OPTIONAL,
   1618        //    reasons                 [1]     ReasonFlags OPTIONAL,
   1619        //    cRLIssuer               [2]     GeneralNames OPTIONAL }
   1620        //
   1621        //DistributionPointName ::= CHOICE {
   1622        //    fullName                [0]     GeneralNames,
   1623        //    nameRelativeToCRLIssuer [1]     RelativeDistinguishedName }
   1624        //
   1625        //ReasonFlags ::= BIT STRING {
   1626        //    unused                  (0),
   1627        //    keyCompromise           (1),
   1628        //    cACompromise            (2),
   1629        //    affiliationChanged      (3),
   1630        //    superseded              (4),
   1631        //    cessationOfOperation    (5),
   1632        //    certificateHold         (6),
   1633        //    privilegeWithdrawn      (7),
   1634        //    aACompromise            (8) }
   1635 
   1636        var names = in_window.org.pkijs.getNames(arguments[0]);
   1637 
   1638        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1639            name: (names.block_name || ""),
   1640            value: [
   1641                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
   1642                    optional: true,
   1643                    id_block: {
   1644                        tag_class: 3, // CONTEXT-SPECIFIC
   1645                        tag_number: 0 // [0]
   1646                    },
   1647                    value: [
   1648                        new in_window.org.pkijs.asn1.CHOICE({
   1649                            value: [
   1650                                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
   1651                                    name: (names.distributionPoint || ""),
   1652                                    optional: true,
   1653                                    id_block: {
   1654                                        tag_class: 3, // CONTEXT-SPECIFIC
   1655                                        tag_number: 0 // [0]
   1656                                    },
   1657                                    value: [
   1658                                        new in_window.org.pkijs.asn1.REPEATED({
   1659                                            name: (names.distributionPoint_names || ""),
   1660                                            value: in_window.org.pkijs.schema.GENERAL_NAME()
   1661                                        })
   1662                                    ]
   1663                                }),
   1664                                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
   1665                                    name: (names.distributionPoint || ""),
   1666                                    optional: true,
   1667                                    id_block: {
   1668                                        tag_class: 3, // CONTEXT-SPECIFIC
   1669                                        tag_number: 1 // [1]
   1670                                    },
   1671                                    value: in_window.org.pkijs.schema.RDN().value_block.value
   1672                                })
   1673                            ]
   1674                        })
   1675                    ]
   1676                }),
   1677                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
   1678                    name: (names.reasons || ""),
   1679                    optional: true,
   1680                    id_block: {
   1681                        tag_class: 3, // CONTEXT-SPECIFIC
   1682                        tag_number: 1 // [1]
   1683                    }
   1684                }), // IMPLICIT bitstring value
   1685                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
   1686                    name: (names.cRLIssuer || ""),
   1687                    optional: true,
   1688                    id_block: {
   1689                        tag_class: 3, // CONTEXT-SPECIFIC
   1690                        tag_number: 2 // [2]
   1691                    },
   1692                    value: [
   1693                        new in_window.org.pkijs.asn1.REPEATED({
   1694                            name: (names.cRLIssuer_names || ""),
   1695                            value: in_window.org.pkijs.schema.GENERAL_NAME()
   1696                        })
   1697                    ]
   1698                }) // IMPLICIT bitstring value
   1699            ]
   1700        }));
   1701    };
   1702    //**************************************************************************************
   1703    // #endregion 
   1704    //**************************************************************************************
   1705    // #region ASN.1 schema definition for "CRLDistributionPoints" type of extension 
   1706    //**************************************************************************************
   1707    in_window.org.pkijs.schema.x509.CRLDistributionPoints =
   1708    function()
   1709    {
   1710        // CRLDistributionPoints OID ::= 2.5.29.31
   1711        //
   1712        //CRLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint
   1713 
   1714        var names = in_window.org.pkijs.getNames(arguments[0]);
   1715 
   1716        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1717            name: (names.block_name || ""),
   1718            value: [
   1719                new in_window.org.pkijs.asn1.REPEATED({
   1720                    name: (names.distributionPoints || ""),
   1721                    value: in_window.org.pkijs.schema.x509.DistributionPoint()
   1722                })
   1723            ]
   1724        }));
   1725    };
   1726    //**************************************************************************************
   1727    // #endregion 
   1728    //**************************************************************************************
   1729    // #region ASN.1 schema definition for "AccessDescription" type
   1730    //**************************************************************************************
   1731    in_window.org.pkijs.schema.x509.AccessDescription =
   1732    function()
   1733    {
   1734        //AccessDescription  ::=  SEQUENCE {
   1735        //    accessMethod          OBJECT IDENTIFIER,
   1736        //    accessLocation        GeneralName  }
   1737 
   1738        var names = in_window.org.pkijs.getNames(arguments[0]);
   1739 
   1740        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1741            name: (names.block_name || ""),
   1742            value: [
   1743                new in_window.org.pkijs.asn1.OID({ name: (names.accessMethod || "") }),
   1744                in_window.org.pkijs.schema.GENERAL_NAME(names.accessLocation || "")
   1745            ]
   1746        }));
   1747    };
   1748    //**************************************************************************************
   1749    // #endregion 
   1750    //**************************************************************************************
   1751    // #region ASN.1 schema definition for "AuthorityInfoAccess" and "SubjectInfoAccess" types of extension 
   1752    //**************************************************************************************
   1753    in_window.org.pkijs.schema.x509.InfoAccess =
   1754    function()
   1755    {
   1756        // AuthorityInfoAccess OID ::= 1.3.6.1.5.5.7.1.1
   1757        // SubjectInfoAccess OID ::= 1.3.6.1.5.5.7.1.11
   1758        //
   1759        //AuthorityInfoAccessSyntax  ::=
   1760        //SEQUENCE SIZE (1..MAX) OF AccessDescription
   1761 
   1762        var names = in_window.org.pkijs.getNames(arguments[0]);
   1763 
   1764        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1765            name: (names.block_name || ""),
   1766            value: [
   1767                new in_window.org.pkijs.asn1.REPEATED({
   1768                    name: (names.accessDescriptions || ""),
   1769                    value: in_window.org.pkijs.schema.x509.AccessDescription()
   1770                })
   1771            ]
   1772        }));
   1773    };
   1774    //**************************************************************************************
   1775    // #endregion 
   1776    //**************************************************************************************
   1777    // #region ASN.1 schema definition for "IssuingDistributionPoint" type of extension 
   1778    //**************************************************************************************
   1779    in_window.org.pkijs.schema.x509.IssuingDistributionPoint =
   1780    function()
   1781    {
   1782        // IssuingDistributionPoint OID ::= 2.5.29.28
   1783        //
   1784        //IssuingDistributionPoint ::= SEQUENCE {
   1785        //    distributionPoint          [0] DistributionPointName OPTIONAL,
   1786        //    onlyContainsUserCerts      [1] BOOLEAN DEFAULT FALSE,
   1787        //    onlyContainsCACerts        [2] BOOLEAN DEFAULT FALSE,
   1788        //    onlySomeReasons            [3] ReasonFlags OPTIONAL,
   1789        //    indirectCRL                [4] BOOLEAN DEFAULT FALSE,
   1790        //    onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE }
   1791        //
   1792        //ReasonFlags ::= BIT STRING {
   1793        //    unused                  (0),
   1794        //    keyCompromise           (1),
   1795        //    cACompromise            (2),
   1796        //    affiliationChanged      (3),
   1797        //    superseded              (4),
   1798        //    cessationOfOperation    (5),
   1799        //    certificateHold         (6),
   1800        //    privilegeWithdrawn      (7),
   1801        //    aACompromise            (8) }
   1802 
   1803        var names = in_window.org.pkijs.getNames(arguments[0]);
   1804 
   1805        return (new in_window.org.pkijs.asn1.SEQUENCE({
   1806            name: (names.block_name || ""),
   1807            value: [
   1808                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
   1809                    optional: true,
   1810                    id_block: {
   1811                        tag_class: 3, // CONTEXT-SPECIFIC
   1812                        tag_number: 0 // [0]
   1813                    },
   1814                    value: [
   1815                        new in_window.org.pkijs.asn1.CHOICE({
   1816                            value: [
   1817                                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
   1818                                    name: (names.distributionPoint || ""),
   1819                                    id_block: {
   1820                                        tag_class: 3, // CONTEXT-SPECIFIC
   1821                                        tag_number: 0 // [0]
   1822                                    },
   1823                                    value: [
   1824                                        new in_window.org.pkijs.asn1.REPEATED({
   1825                                            name: (names.distributionPoint_names || ""),
   1826                                            value: in_window.org.pkijs.schema.GENERAL_NAME()
   1827                                        })
   1828                                    ]
   1829                                }),
   1830                                new in_window.org.pkijs.asn1.ASN1_CONSTRUCTED({
   1831                                    name: (names.distributionPoint || ""),
   1832                                    id_block: {
   1833                                        tag_class: 3, // CONTEXT-SPECIFIC
   1834                                        tag_number: 1 // [1]
   1835                                    },
   1836                                    value: in_window.org.pkijs.schema.RDN().value_block.value
   1837                                })
   1838                            ]
   1839                        })
   1840                    ]
   1841                }),
   1842                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
   1843                    name: (names.onlyContainsUserCerts || ""),
   1844                    optional: true,
   1845                    id_block: {
   1846                        tag_class: 3, // CONTEXT-SPECIFIC
   1847                        tag_number: 1 // [1]
   1848                    }
   1849                }), // IMPLICIT boolean value
   1850                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
   1851                    name: (names.onlyContainsCACerts || ""),
   1852                    optional: true,
   1853                    id_block: {
   1854                        tag_class: 3, // CONTEXT-SPECIFIC
   1855                        tag_number: 2 // [2]
   1856                    }
   1857                }), // IMPLICIT boolean value
   1858                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
   1859                    name: (names.onlySomeReasons || ""),
   1860                    optional: true,
   1861                    id_block: {
   1862                        tag_class: 3, // CONTEXT-SPECIFIC
   1863                        tag_number: 3 // [3]
   1864                    }
   1865                }), // IMPLICIT bitstring value
   1866                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
   1867                    name: (names.indirectCRL || ""),
   1868                    optional: true,
   1869                    id_block: {
   1870                        tag_class: 3, // CONTEXT-SPECIFIC
   1871                        tag_number: 4 // [4]
   1872                    }
   1873                }), // IMPLICIT boolean value
   1874                new in_window.org.pkijs.asn1.ASN1_PRIMITIVE({
   1875                    name: (names.onlyContainsAttributeCerts || ""),
   1876                    optional: true,
   1877                    id_block: {
   1878                        tag_class: 3, // CONTEXT-SPECIFIC
   1879                        tag_number: 5 // [5]
   1880                    }
   1881                }) // IMPLICIT boolean value
   1882            ]
   1883        }));
   1884    };
   1885    //**************************************************************************************
   1886    // #endregion 
   1887    //**************************************************************************************
   1888 }
   1889 )(typeof exports !== "undefined" ? exports : window);