<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" docName="draft-horse-sidrops-rfc3779bis-01" category="std" obsoletes="3779" submissionType="IETF" consensus="true" ipr="trust200902" tocInclude="true" tocDepth="4" sortRefs="true" symRefs="true" version="3" xml:lang="en">
  <front>
    <title abbrev="rfc3779bis">X.509 Extensions for IP Addresses and AS Identifiers</title>
    <author fullname="Theo Buehler" initials="T." surname="Buehler" role="editor">
      <organization>OpenBSD</organization>
      <address>
        <postal>
          <city>Zurich</city>
          <country>CH</country>
        </postal>
        <email>tb@openbsd.org</email>
      </address>
    </author>
    <author fullname="Job Snijders" initials="J." surname="Snijders" role="editor">
      <organization abbrev="BSD">BSD Software Development</organization>
      <address>
        <postal>
          <city>Amsterdam</city>
          <country>NL</country>
        </postal>
        <email>job@bsd.nl</email>
        <uri>https://www.bsd.nl/</uri>
      </address>
    </author>
    <author fullname="Charles Lynn" initials="C." surname="Lynn">
      <organization>BBN Technologies</organization>
      <address>
        <postal>
          <street>10 Moulton St.</street>
          <city>Cambridge</city>
          <region>MA</region>
          <code>02138</code>
          <country>United States of America</country>
        </postal>
        <phone>+1 (617) 873-3367</phone>
        <email>CLynn@BBN.Com</email>
      </address>
    </author>
    <author fullname="Stephen Kent" initials="S." surname="Kent">
      <organization>BBN Technologies</organization>
      <address>
        <postal>
          <street>10 Moulton St.</street>
          <city>Cambridge</city>
          <region>MA</region>
          <code>02138</code>
          <country>United States of America</country>
        </postal>
        <phone>+1 (617) 873-3988</phone>
        <email>Kent@BBN.Com</email>
      </address>
    </author>
    <author fullname="Karen Seo" initials="K." surname="Seo">
      <organization>BBN Technologies</organization>
      <address>
        <postal>
          <street>10 Moulton St.</street>
          <city>Cambridge</city>
          <region>MA</region>
          <code>02138</code>
          <country>United States of America</country>
        </postal>
        <phone>+1 (617) 873-3152</phone>
        <email>KSeo@BBN.Com</email>
      </address>
    </author>
    <date/>
    <area>Operations and Management Area (OPS)</area>
    <workgroup>SIDROPS</workgroup>
    <abstract>
      <t>
        This document defines two X.509 v3 certificate extensions.
        The first binds a list of IP address blocks, or prefixes, to the subject of a certificate.
        The second binds a list of autonomous system identifiers to the subject of a certificate.
        These extensions may be used to convey the authorization of the subject to use the IP addresses and autonomous system identifiers contained in the extensions.
        This document obsoletes RFC 3779.
      </t>
    </abstract>
  </front>
  <middle>
    <section anchor="sec-intro">
      <name>Introduction</name>
      <t>
        This document defines two X.509 v3 certificate extensions that authorize the transfer of the right-to-use for a set of IP addresses and autonomous system identifiers from IANA through the regional Internet registries (RIRs) to Internet service providers (ISPs) and user organizations.
        The first binds a list of IP address blocks, often represented as IP address prefixes, to the subject (private key holder) of a certificate.
        The second binds a list of autonomous system (AS) identifiers to the subject (private key holder) of a certificate.
        The issuer of the certificate is an entity (e.g., the IANA, a regional Internet registry, or an ISP) that has the authority to transfer custodianship of ("allocate") the set of IP address blocks and AS identifiers to the subject of the certificate.
        These certificates provide a scalable means of verifying the right-to-use for a set of IP address prefixes and AS identifiers.
        They may be used by routing protocols, such as Secure BGP <xref target="S-BGP"/>, to verify legitimacy and correctness of routing information, or by Internet routing registries to verify data that they receive.
      </t>
      <t>
        Sections <xref target="sec-ipaddr" format="counter"/> and <xref target="sec-asid" format="counter"/> specify several rules about the encoding of the extensions defined in this specification that <bcp14>MUST</bcp14> be followed.
        These encoding rules serve the following purposes.
        First, they result in a unique encoding of the extension's value; two instances of an extension can be compared for equality octet-by-octet.
        Second, they achieve the minimal size encoding of the information.
        Third, they allow relying parties to use one-pass algorithms when performing certification path validation; in particular, the relying parties do not need to sort the information, or to implement extra code in the subset checking algorithms to handle several boundary cases (adjacent, overlapping, or subsumed ranges).
      </t>
      <section anchor="changes-rfc3779">
        <name>Changes from RFC 3779</name>
        <t>
          This section summarizes the significant changes between <xref target="RFC3779"/> and this document.
        </t>
        <ul>
          <li>Incorporated errata for RFC 3779</li>
        </ul>
      </section>
      <section>
        <name>Requirements Language</name>
        <t>
          The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>", "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.
        </t>
      </section>
      <section anchor="sec-terminology">
        <name>Terminology</name>
        <t>
          It is assumed that the reader is familiar with the terms and concepts described in "Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile" <xref target="RFC3280"/>, "INTERNET PROTOCOL" <xref target="RFC791"/>, "Internet Protocol Version 6 (IPv6) Addressing Architecture" <xref target="RFC3513"/>, "INTERNET REGISTRY IP ALLOCATION GUIDELINES" <xref target="RFC2050"/>, and related regional Internet registry address management policy documents.
          Some relevant terms include:</t>
        <dl newline="false" spacing="normal">
          <dt>allocate:</dt>
          <dd>
            the transfer of custodianship of a resource to an intermediate organization (see <xref target="RFC2050"/>).
          </dd>
          <dt>assign:</dt>
          <dd>
            the transfer of custodianship of a resource to an end organization (see <xref target="RFC2050"/>).
          </dd>
          <dt>Autonomous System (AS):</dt>
          <dd>
            a set of routers under a single technical administration with a uniform policy, using one or more interior gateway protocols and metrics to determine how to route packets within the autonomous system, and using an exterior gateway protocol to determine how to route packets to other autonomous systems.
          </dd>
          <dt>Autonomous System number:</dt>
          <dd>
            a 32-bit number that identifies an autonomous system.
          </dd>
          <dt>delegate:</dt>
          <dd>
            transfer of custodianship (that is, the right-to-use) of an IP address block or AS identifier through issuance of a certificate to an entity.
          </dd>
          <dt>initial octet:</dt>
          <dd>
            the first octet in the value of a DER encoded <tt>BIT STRING</tt> <xref target="X.690"/>.
          </dd>
          <dt>IP v4 address:</dt>
          <dd>
            a 32-bit identifier written as four decimal numbers, each in the range 0 to 255, separated by a ".".
            10.5.0.5 is an example of an IPv4 address.
          </dd>
          <dt>IP v6 address:</dt>
          <dd>
            a 128-bit identifier written as eight hexadecimal quantities, each in the range 0 to ffff, separated by a ":".
            2001:0:200:3:0:0:0:1 is an example of an IPv6 address.
            One string of :0: fields may be replaced by "::", thus 2001:0:200:3::1 represents the same address as the immediately preceding example.
            (See <xref target="RFC3513"/>).
          </dd>
          <dt>prefix:</dt>
          <dd>
            a bit string that consists of some number of initial bits of an address, written as an address followed by a "/", and the number of initial bits.
            10.5.0.0/16 and 2001:0:200:3:0:0:0:0/64 (or 2001:0:200:3::/64) are examples of prefixes.
            A prefix is often abbreviated by omitting the less-significant zero fields, but there should be enough fields to contain the indicated number of initial bits.
            10.5/16 and 2001:0:200:3/64 are examples of abbreviated prefixes.
          </dd>
          <dt>Regional Internet Registry (RIR):</dt>
          <dd>
            any of the bodies recognized by IANA as the regional authorities for management of IP addresses and AS identifiers.
            At the time of writing, these include AfriNIC, APNIC, ARIN, LACNIC, and RIPE NCC.</dd>
          <dt>right-to-use:</dt>
          <dd>
            for an IP address prefix, being authorized to specify the AS that may originate advertisements of the prefix throughout the Internet.
            For an autonomous system identifier, being authorized to operate a network(s) that identifies itself to other network operators using that autonomous system identifier.
          </dd>
          <dt>subsequent octets:</dt>
          <dd>
            the second through last octets in the value of a DER encoded <tt>BIT STRING</tt> <xref target="X.690"/>.
          </dd>
          <dt>trust anchor:</dt>
          <dd>
            a certificate that is to be trusted when performing certification path validation (see <xref target="RFC3280"/>).
          </dd>
        </dl>
      </section>
    </section>
    <section anchor="sec-ipaddr">
      <name>IP Address Delegation Extension</name>
      <t>
        This extension conveys the allocation of IP addresses to an entity by binding those addresses to a public key belonging to the entity.
      </t>
      <section anchor="sec-ipaddr-context">
        <name>Context</name>
        <t>
          IP address space is currently managed by a hierarchy nominally rooted at IANA, but managed by the RIRs.
          IANA allocates IP address space to the RIRs, who in turn allocate IP address space to Internet service providers (ISPs), who may allocate IP address space to down stream providers, customers, etc.
          The RIRs also may assign IP address space to organizations who are end entities, i.e., organizations who will not be reassigning any of their space to other organizations.
          (See <xref target="RFC2050"/> and related RIR policy documents for the guidelines on the allocation and assignment process).
        </t>
        <t>
          The IP address delegation extension is intended to enable verification of the proper delegation of IP address blocks, i.e., of the authorization of an entity to use or sub-allocate IP address space.
          Accordingly, it makes sense to take advantage of the inherent authoritativeness of the existing administrative framework for allocating IP address space.
          As described in <xref target="sec-intro"/> above, this will be achieved by issuing certificates carrying the extension described in this section.
          An example of one use of the information in this extension is an entity using it to verify the authorization of an organization to originate a BGP UPDATE advertising a path to a particular IP address block; see, e.g., <xref target="RFC1771"/>, <xref target="S-BGP"/>.
        </t>
        <section anchor="sec-ip-encoding">
          <name>Encoding of an IP Address or Prefix</name>
          <t>
            There are two families of IP addresses: IPv4 and IPv6.
          </t>
          <t>
            An IPv4 address is a 32-bit quantity that is written as four decimal numbers, each in the range 0 through 255, separated by a dot (".").
            10.5.0.5 is an example of an IPv4 address.
          </t>
          <t>
            An IPv6 address is a 128-bit quantity that is written as eight hexadecimal numbers, each in the range 0 through ffff, separated by a colon (":"); 2001:0:200:3:0:0:0:1 is an example of an IPv6 address.
            IPv6 addresses frequently have adjacent fields whose value is 0.
            One such group of 0 fields may be abbreviated by two colons ("::").
            The previous example may thus be represented by 2001:0:200:3::1.
          </t>
          <t>
            An address prefix is a set of 2^k continuous addresses whose most-significant bits are identical.
            For example, the set of 512 IPv4 addresses from 10.5.0.0 through 10.5.1.255 all have the same 23 most-significant bits.
            The set of addresses is written by appending a slash ("/") and the number of constant bits to the lowest address in the set.
            The prefix for the example set is 10.5.0.0/23, and contains 2^(32-23) = 2^9 addresses.
            The set of IPv6 addresses 2001:0:200:0:0:0:0:0 through 2001:0:3ff:ffff:ffff:ffff:ffff:ffff (2^89 addresses) is represented by 2001:0:200:0:0:0:0:0/39 or equivalently 2001:0:200::/39.
            A prefix may be abbreviated by omitting the least-significant zero fields, but there should be enough fields to contain the indicated number of constant bits.
            The abbreviated forms of the example IPv4 prefix is 10.5.0/23, and of the example IPv6 prefix is 2001:0:200/39.
          </t>
          <t>
            An IP address or prefix is encoded in the IP address delegation extension as a DER-encoded ASN.1 <tt>BIT STRING</tt> containing the constant most-significant bits.
            Recall <xref target="X.690"/> that the DER encoding of a <tt>BIT STRING</tt> consists of the <tt>BIT STRING</tt> type (0x03), followed by (an encoding of) the number of value octets, followed by the value.
            The value consists of an "initial octet" that specifies the number of unused bits in the last value octet, followed by the "subsequent octets" that contain the octets of the bit string.
            (For IP addresses, the encoding of the length will be just the length.)
          </t>
          <t>
            In the case of a single address, all the bits are constant, so the bit string for an IPv4 address contains 32 bits.
            The subsequent octets in the DER-encoding of the address 10.5.0.4 are 0x0a 0x05 0x00 0x04.
            Since all the bits in the last octet are used, the initial octet is 0x00.
            The octets in the DER-encoded <tt>BIT STRING</tt> is thus:
          </t>
          <artwork><![CDATA[
Type Len  Unused Bits ...
0x03 0x05  0x00  0x0a 0x05 0x00 0x04
]]></artwork>
          <t>
            Similarly, the DER-encoding of the prefix 10.5.0/23 is:
          </t>
          <artwork><![CDATA[
Type Len  Unused Bits ...
0x03 0x04  0x01  0x0a 0x05 0x00
]]></artwork>
          <t>
            In this case, the three subsequent octets contain 24 bits, but the prefix only uses 23, so there is one unused bit in the last octet, thus the initial octet is 1 (the DER require that all unused bits <bcp14>MUST</bcp14> be set to zero-bits).
          </t>
          <t>
            The DER-encoding of the IPv6 address 2001:0:200:3:0:0:0:1 is:
          </t>
          <artwork><![CDATA[
Type Len  Unused Bits ...
0x03 0x11  0x00  0x20 0x01 0x00 0x00 0x02 0x00 0x00 0x03
                 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01
]]></artwork>
          <t>
            and the DER-encoding of the prefix 2001:0:200/39, which has one unused bit in the last octet, is:
          </t>
          <artwork><![CDATA[
Type Len  Unused Bits ...
0x03 0x06  0x01  0x20 0x01 0x00 0x00 0x02
]]></artwork>
        </section>
        <section anchor="sec-range-encoding">
          <name>Encoding of a Range of IP Addresses</name>
          <t>
            While any contiguous range of IP addresses can be represented by a set of contiguous prefixes, a more concise representation is achieved by encoding the range as a SEQUENCE containing the lowest address and the highest address, where each address is encoded as a <tt>BIT STRING</tt>.
            Within the SEQUENCE, the bit string representing the lowest address in the range is formed by removing all the least-significant zero-bits from the address, and the bit string representing the highest address in the range is formed by removing all the least-significant one-bits.
            The DER <tt>BIT STRING</tt> encoding requires that all the unused bits in the last octet <bcp14>MUST</bcp14> be set to zero-bits.
            Note that a prefix can always be expressed as a range, but a range cannot always be expressed as a prefix.
          </t>
          <t>
            The range of addresses represented by the prefix 10.5.0/23 is 10.5.0.0 through 10.5.1.255.
            The lowest address ends in sixteen zero-bits that are removed.
            The DER-encoding of the resulting sixteen-bit string is:
          </t>
          <artwork><![CDATA[
Type Len  Unused Bits ...
0x03 0x03  0x00  0x0a 0x05
]]></artwork>
          <t>
            The highest address ends in nine one-bits that are removed.
            The DER-encoding of the resulting twenty-three-bit string is:
          </t>
          <artwork><![CDATA[
Type Len  Unused Bits ...
0x03 0x04  0x01  0x0a 0x05 0x00
]]></artwork>
          <t>
            The prefix 2001:0:200/39 can be encoded as a range where the DER-encoding of the lowest address (2001:0:200::) is:
          </t>
          <artwork><![CDATA[
Type Len  Unused Bits ...
0x03 0x06  0x01  0x20 0x01 0x00 0x00 0x02
]]></artwork>
          <t>
            and the largest address (2001:0:3ff:ffff:ffff:ffff:ffff:ffff), which, after removal of the ninety least-significant one-bits leaves a thirty-eight bit string, is encoded as:
          </t>
          <artwork><![CDATA[
Type Len  Unused Bits ...
0x03 0x06  0x02  0x20 0x01 0x00 0x00 0x00
]]></artwork>
          <t>
            The special case of all IP address blocks, i.e., a prefix of all zero-bits -- "0/0", <bcp14>MUST</bcp14> be encoded per the DER with a length octet of one, an initial octet of zero, and no subsequent octets:
          </t>
          <artwork><![CDATA[
Type Len  Unused Bits ...
0x03 0x01  0x00
]]></artwork>
          <t>
            Note that for IP addresses the number of trailing zero-bits is significant.
            For example, the DER-encoding of 10.64/12:
          </t>
          <artwork><![CDATA[
Type Len  Unused Bits ...
0x03 0x03  0x04  0x0a 0x40
]]></artwork>
          <t>
            is different than the DER-encoding of 10.64.0/20:
          </t>
          <artwork type="ascii-art">
Type Len  Unused Bits ...
0x03 0x04  0x04  0x0a 0x40 0x00
</artwork>
        </section>
      </section>
      <section anchor="sec-ipaddr-spec">
        <name>Specification</name>
        <section anchor="sec-ipaddr-oid">
          <name>OID</name>
          <t>
            The OID for this extension is id-pe-ipAddrBlocks.
          </t>
          <sourcecode type="asn.1">
id-pe-ipAddrBlocks  OBJECT IDENTIFIER ::= { id-pe 7 }
</sourcecode>
          <t>
            where <xref target="RFC3280"/> defines:
          </t>
          <sourcecode type="asn.1">
id-pkix  OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
         dod(6) internet(1) security(5) mechanisms(5) pkix(7) }

id-pe    OBJECT IDENTIFIER ::= { id-pkix 1 }
</sourcecode>
        </section>
        <section anchor="sec-ipaddr-criticality">
          <name>Criticality</name>
          <t>
            This extension <bcp14>SHOULD</bcp14> be CRITICAL.
            The intended use of this extension is to connote a right-to-use for the block(s) of IP addresses identified in the extension.
            A CA marks the extension as CRITICAL to convey the notion that a relying party <bcp14>MUST</bcp14> understand the semantics of the extension to make use of the certificate for the purpose it was issued.
            Newly created applications that use certificates containing this extension are expected to recognize the extension.
          </t>
        </section>
        <section anchor="sec-ipaddr-syntax">
          <name>Syntax</name>
          <sourcecode type="asn.1">
id-pe-ipAddrBlocks      OBJECT IDENTIFIER ::= { id-pe 7 }

IPAddrBlocks        ::= SEQUENCE OF IPAddressFamily

IPAddressFamily     ::= SEQUENCE {    -- AFI &amp; optional SAFI --
   addressFamily        OCTET STRING (SIZE (2..3)),
   ipAddressChoice      IPAddressChoice }

IPAddressChoice     ::= CHOICE {
   inherit              NULL, -- inherit from issuer --
   addressesOrRanges    SEQUENCE OF IPAddressOrRange }

IPAddressOrRange    ::= CHOICE {
   addressPrefix        IPAddress,
   addressRange         IPAddressRange }

IPAddressRange      ::= SEQUENCE {
   min                  IPAddress,
   max                  IPAddress }

IPAddress           ::= BIT STRING
</sourcecode>
          <section anchor="sec-IPAddrBlocks">
            <name>Type IPAddrBlocks</name>
            <t>
              The IPAddrBlocks type is a SEQUENCE OF IPAddressFamily types.
            </t>
          </section>
          <section anchor="sec-IPAddressFamily">
            <name>Type IPAddressFamily</name>
            <t>
              The IPAddressFamily type is a SEQUENCE containing an addressFamily and ipAddressChoice element.
            </t>
          </section>
          <section anchor="sec-addressFamily">
            <name>Element addressFamily</name>
            <t>
              The addressFamily element is an OCTET STRING containing a two-octet Address Family Identifier (AFI), in network byte order, optionally followed by a one-octet Subsequent Address Family Identifier (SAFI).
              AFIs and SAFIs are specified in <xref target="IANA-AFI"/> and <xref target="IANA-SAFI"/>, respectively.
            </t>
            <t>
              In Certification Authority (CA) certificates, if no authorization is being granted for a particular AFI and optional SAFI, then there <bcp14>MUST NOT</bcp14> be an IPAddressFamily member for that AFI/SAFI in the IPAddrBlocks SEQUENCE.
            </t>
            <t>
              There <bcp14>MUST</bcp14> be only one IPAddressFamily SEQUENCE per unique combination of AFI and SAFI.
              Each SEQUENCE <bcp14>MUST</bcp14> be ordered by ascending addressFamily values (treating the octets as unsigned quantities).
              An addressFamily without a SAFI <bcp14>MUST</bcp14> precede one that contains an SAFI.
              When both IPv4 and IPv6 addresses are specified, the IPv4 addresses <bcp14>MUST</bcp14> precede the IPv6 addresses (since the IPv4 AFI of 0001 is less than the IPv6 AFI of 0002).
            </t>
          </section>
          <section anchor="sec-ipAddressChoice">
            <name>Element ipAddressChoice and Type IPAddressChoice</name>
            <t>
              The ipAddressChoice element is of type IPAddressChoice.
              The IPAddressChoice type is a CHOICE of either an inherit or addressesOrRanges element.
            </t>
          </section>
          <section anchor="sec-ip-inherit">
            <name>Element inherit</name>
            <t>
              If the IPAddressChoice CHOICE contains the inherit element, then the set of authorized IP addresses for the specified AFI and optional SAFI is taken from the issuer's certificate, or from the issuer's issuer's certificate, recursively, until a certificate containing an IPAddressChoice containing an addressesOrRanges element is located.
            </t>
          </section>
          <section anchor="sec-addressesOrRanges">
            <name>Element addressesOrRanges</name>
            <t>
              The addressesOrRanges element is a SEQUENCE OF IPAddressOrRange types.
              The addressPrefix and addressRange elements <bcp14>MUST</bcp14> be sorted using the binary representation of:
            </t>
            <artwork><![CDATA[
<lowest IP address in range> | <prefix length>
]]></artwork>
            <t>
              where "|" represents concatenation.
              Note that the octets in this representation (a.b.c.d | length for IPv4 or s:t:u:v:w:x:y:z | length for IPv6) are not the octets that are in the DER-encoded <tt>BIT STRING</tt> value.
              For example, given two addressPrefix:
            </t>
            <!-- should this be a table? -->
            <artwork type="ascii-art">
IP addr | length  DER encoding
----------------  ------------------------
                  Type Len  Unused Bits...
10.32.0.0 | 12     03   03    04   0a 20
10.64.0.0 | 16     03   03    00   0a 40
</artwork>
            <t>
              the prefix 10.32.0.0/12 <bcp14>MUST</bcp14> come before the prefix 10.64.0.0/16 since 32 is less than 64; whereas if one were to sort by the DER <tt>BIT STRINGs</tt>, the order would be reversed as the unused bits octet would sort in the opposite order.
              Any pair of IPAddressOrRange choices in an extension <bcp14>MUST NOT</bcp14> overlap each other.
              Any contiguous address prefixes or ranges <bcp14>MUST</bcp14> be combined into a single range or, whenever possible, a single prefix.
            </t>
          </section>
          <section anchor="sec-IPAddressOrRange">
            <name>Type IPAddressOrRange</name>
            <t>
              The IPAddressOrRange type is a CHOICE of either an addressPrefix (an IP prefix or address) or an addressRange (an IP address range) element.
            </t>
            <t>
              This specification requires that any range of addresses that can be encoded as a prefix <bcp14>MUST</bcp14> be encoded using an IPAddress element (a <tt>BIT STRING</tt>), and any range that cannot be encoded as a prefix <bcp14>MUST</bcp14> be encoded using an IPAddressRange (a SEQUENCE containing two <tt>BIT STRINGs</tt>).
              The following pseudo code illustrates how to select the encoding of a given range of addresses.
            </t>
            <sourcecode type="pseudocode">
LET  N = the number of matching most-significant bits in the
         lowest and highest addresses of the range
IF   all the remaining bits in the lowest address are zero-bits
 AND all the remaining bits in the highest address are one-bits
THEN the range MUST be encoded as an N-bit IPAddress
ELSE the range MUST be encoded as an IPAddressRange
</sourcecode>
          </section>
          <section anchor="sec-addressPrefix">
            <name>Element addressPrefix and Type IPAddress</name>
            <t>
              The addressPrefix element is an IPAddress type.
              The IPAddress type defines a range of IP addresses in which the most-significant (left-most) N bits of the address remain constant, while the remaining bits (32 - N bits for IPv4, or 128 - N bits for IPv6) may be either zero or one.
              For example, the IPv4 prefix 10.64/12 corresponds to the addresses 10.64.0.0 to 10.79.255.255, while 10.64/11 corresponds to 10.64.0.0 to 10.95.255.255.
              The IPv6 prefix 2001:0:2/48 represents addresses 2001:0:2:: to 2001:0:2:ffff:ffff:ffff:ffff:ffff.
            </t>
            <t>
              An IP address prefix is encoded as a <tt>BIT STRING</tt>.
              The DER encoding of a <tt>BIT STRING</tt> uses the initial octet of the string to specify how many of the least-significant bits of the last subsequent octet are unused.
              The DER encoding specifies that these unused bits <bcp14>MUST</bcp14> be set to zero-bits.
            </t>
            <t>Example:</t>
            <artwork><![CDATA[
          128.0.0.0       = 1000 0000.0000 0000.0000 0000.0000 0000
       to 143.255 255 255 = 1000 1111.1111 1111.1111 1111.1111 1111
     bit string to encode = 1000
           Type Len  Unused Bits ...
Encoding = 0x03 0x02  0x04  0x80
]]></artwork>
          </section>
          <section anchor="sec-addressRange">
            <name>Element addressRange and Type IPAddressRange</name>
            <t>
              The addressRange element is of type IPAddressRange.
              The IPAddressRange type consists of a SEQUENCE containing a minimum (element min) and maximum (element max) IP address.
              Each IP address is encoded as a <tt>BIT STRING</tt>.
              The semantic interpretation of the minimum address in an IPAddressRange is that all the unspecified bits (for the full length of the IP address) are zero-bits.
              The semantic interpretation of the maximum address is that all the unspecified bits are one-bits.
              The <tt>BIT STRING</tt> for the minimum address results from removing all the least-significant zero-bits from the minimum address.
              The <tt>BIT STRING</tt> for the maximum address results from removing all the least-significant one-bits from the maximum address.
            </t>
            <t>
              Example:
            </t>
            <artwork><![CDATA[
          129.64.0.0       = 1000 0001.0100 0000.0000 0000.0000 0000
       to 143.255.255.255  = 1000 1111.1111 1111.1111 1111.1111 1111
        minimum bit string = 1000 0001.01
        maximum bit string = 1000
Encoding = SEQUENCE {
            Type Len  Unused Bits ...
     min    0x03 0x03  0x06  0x81      0x40
     max    0x03 0x02  0x04  0x80
           }
]]></artwork>
          </section>
        </section>
      </section>
      <section anchor="sec-ipaddr-validation">
        <name>IP Address Delegation Extension Certification Path Validation</name>
        <t>
          Certification path validation of a certificate containing the IP address delegation extension requires additional processing.
          As each certificate in a path is validated, the IP addresses in the IP address delegation extension of that certificate <bcp14>MUST</bcp14> be subsumed by IP addresses in the IP address delegation extension in the issuer's certificate.
          Validation <bcp14>MUST</bcp14> fail when this is not the case.
          In end-entity (EE) certificates, an IPAddressFamily containing an inherit element for an AFI and optional SAFI which is not contained in the IP address delegation extension in the issuer's certificate <bcp14>MUST</bcp14> be ignored (i.e., treated as absent) for the purpose of certification path validation.
          If the aforementioned elimination process results in an empty IPAddrBlocks sequence, the IP address delegation extension in the EE certificate <bcp14>MUST</bcp14> be ignored (i.e., treated as absent) for the purpose of certification path validation.
          A certificate that is a trust anchor for certification path validation of certificates containing the IP address delegation extension, as well as all certificates along the path, <bcp14>MUST</bcp14> each contain the IP address delegation extension.
          The initial set of allowed address ranges is taken from the trust anchor certificate.
        </t>
      </section>
    </section>
    <section anchor="sec-asid">
      <name>Autonomous System Identifier Delegation Extension</name>
      <t>
        This extension conveys the allocation of autonomous system (AS) identifiers to an entity by binding those AS identifiers to a public key belonging to the entity.
      </t>
      <section anchor="sec-asid-context">
        <name>Context</name>
        <t>
          AS identifier delegation is currently managed by a hierarchy nominally rooted at IANA, but managed by the RIRs.
          IANA allocates AS identifiers to the RIRs, who in turn assign AS identifiers to organizations who are end entities, i.e., will not be re-allocating any of their AS identifiers to other organizations.
          The AS identifier delegation extension is intended to enable verification of the proper delegation of AS identifiers, i.e., of the authorization of an entity to use these AS identifiers.
          Accordingly, it makes sense to take advantage of the inherent authoritativeness of the existing administrative framework for management of AS identifiers.
          As described in <xref target="sec-intro"/> above, this will be achieved by issuing certificates carrying the extension described in this section.
          An example of one use of the information in this extension is an entity using it to verify the authorization of an organization to manage the AS identified by an AS identifier in the extension.
          The use of this extension to represent assignment of AS identifiers is not intended to alter the procedures by which AS identifiers are managed, or when an AS should be used c.f., <xref target="RFC1930"/>.
        </t>
      </section>
      <section anchor="sec-asid-spec">
        <name>Specification</name>
        <section anchor="sec-asid-oid">
          <name>OID</name>
          <t>
            The OID for this extension is id-pe-autonomousSysIds.
          </t>
          <sourcecode type="asn.1">
id-pe-autonomousSysIds  OBJECT IDENTIFIER ::= { id-pe 8 }
</sourcecode>
          <t>
            where <xref target="RFC3280"/> defines:
          </t>
          <sourcecode type="asn.1">
id-pkix  OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
         dod(6) internet(1) security(5) mechanisms(5) pkix(7) }

id-pe    OBJECT IDENTIFIER ::= { id-pkix 1 }
</sourcecode>
        </section>
        <section anchor="sec-asid-criticality">
          <name>Criticality</name>
          <t>
            This extension <bcp14>SHOULD</bcp14> be CRITICAL.
            The intended use of this extension is to connote a right-to-use for the AS identifiers in the extension.
            A CA marks the extension as CRITICAL to convey the notion that a relying party must understand the semantics of the extension to make use of the certificate for the purpose it was issued.
            Newly created applications that use certificates containing this extension are expected to recognize the extension.
          </t>
        </section>
        <section anchor="sec-asid-syntax">
          <name>Syntax</name>
          <sourcecode type="asn.1">
id-pe-autonomousSysIds  OBJECT IDENTIFIER ::= { id-pe 8 }

ASIdentifiers       ::= SEQUENCE {
    asnum               [0] EXPLICIT ASIdentifierChoice OPTIONAL,
    rdi                 [1] EXPLICIT ASIdentifierChoice OPTIONAL}

ASIdentifierChoice  ::= CHOICE {
   inherit              NULL, -- inherit from issuer --
   asIdsOrRanges        SEQUENCE OF ASIdOrRange }

ASIdOrRange         ::= CHOICE {
    id                  ASId,
    range               ASRange }

ASRange             ::= SEQUENCE {
    min                 ASId,
    max                 ASId }

ASId                ::= INTEGER
</sourcecode>
          <section anchor="sec-ASIdentifiers">
            <name>Type ASIdentifiers</name>
            <t>
              The ASIdentifiers type is a SEQUENCE containing one or more forms of autonomous system identifiers -- AS numbers (in the asnum element) or Routing Domain Identifiers (in the rdi element).
              When the ASIdentifiers type contains multiple forms of identifiers, the asnum entry <bcp14>MUST</bcp14> precede the rdi entry.
              AS numbers are used by BGP, and Routing Domain Identifiers are specified in the OSI Inter-Domain Routing Protocol <xref target="ISO10747"/>.
            </t>
          </section>
          <section anchor="sec-ASIdentifierChoice">
            <name>Elements asnum, rdi, and Type ASIdentifierChoice</name>
            <t>
              The asnum and rdi elements are both of type ASIdentifierChoice.
              The ASIdentifierChoice type is a CHOICE of either the inherit or asIdsOrRanges element.
            </t>
          </section>
          <section anchor="sec-as-inherit">
            <name>Element inherit</name>
            <t>
              If the ASIdentifierChoice choice contains the inherit element, then the set of authorized AS identifiers is taken from the issuer's certificate, or from the issuer's issuer's certificate, recursively, until a certificate containing an ASIdentifierChoice containing an asIdsOrRanges element is located.
              In CA certificates, if no authorization is being granted for a particular form of AS identifier, then there <bcp14>MUST NOT</bcp14> be a corresponding asnum/rdi member in the ASIdentifiers sequence.
            </t>
          </section>
          <section anchor="sec-asIdsOrRanges">
            <name>Element asIdsOrRanges</name>
            <t>
              The asIdsOrRanges element is a SEQUENCE of ASIdOrRange types.
              Any pair of items in the asIdsOrRanges SEQUENCE <bcp14>MUST NOT</bcp14> overlap.
              Any contiguous series of AS identifiers <bcp14>MUST</bcp14> be combined into a single range whenever possible.
              The AS identifiers in the asIdsOrRanges element <bcp14>MUST</bcp14> be sorted by increasing numeric value.
            </t>
          </section>
          <section anchor="sec-ASIdOrRange">
            <name>Type ASIdOrRange</name>
            <t>
              The ASIdOrRange type is a CHOICE of either a single integer (ASId) or a single sequence (ASRange).
            </t>
          </section>
          <section anchor="sec-as-id">
            <name>Element id</name>
            <t>
              The id element has type ASId.
            </t>
          </section>
          <section anchor="sec-as-range">
            <name>Element range</name>
            <t>
              The range element has type ASRange.
            </t>
          </section>
          <section anchor="sec-ASRange">
            <name>Type ASRange</name>
            <t>
              The ASRange type is a SEQUENCE consisting of a min and a max element, and is used to specify a range of AS identifier values.
              The min and max elements <bcp14>MUST</bcp14> specify two distinct AS identifiers.
            </t>
          </section>
          <section anchor="sec-as-min-max">
            <name>Elements min and max</name>
            <t>
              The min and max elements have type ASId.
              The min element is used to specify the value of the minimum AS identifier in the range, and the max element specifies the value of the maximum AS identifier in the range.
            </t>
          </section>
          <section anchor="sec-ASId">
            <name>Type ASId</name>
            <t>
              The ASId type is an <tt>INTEGER</tt>.
            </t>
          </section>
        </section>
      </section>
      <section anchor="sec-asid-validation">
        <name>Autonomous System Identifier Delegation Extension Certification Path Validation</name>
        <t>
          Certification path validation of a certificate containing the autonomous system identifier delegation extension requires additional processing.
          As each certificate in a path is validated, the AS identifiers in the autonomous system identifier delegation extension of that certificate <bcp14>MUST</bcp14> be subsumed by the AS identifiers in the autonomous system identifier delegation extension in the issuer's certificate.
          Validation <bcp14>MUST</bcp14> fail when this is not the case.
          In EE certificates, an ASIdentifierChoice containing an inherit element for an autonomous system or Routing Domain Identifier, which is not contained in the AS identifier delegation extension in the issuer's certificate, <bcp14>MUST</bcp14> be ignored (i.e., treated as absent) for the purpose of certification path validation.
          If the aforementioned elimination process results in an empty ASIdentifiers sequence, the AS identifier delegation extension in the EE certificate <bcp14>MUST</bcp14> be ignored (i.e., treated as absent) for the purpose of certification path validation.
          A certificate that is a trust anchor for certification path validation of certificates containing the autonomous system identifier delegation extension, as well as all certificates along the path, <bcp14>MUST</bcp14> each contain the autonomous system identifier delegation extension.
          The initial set of allowed AS identifiers is taken from the trust anchor certificate.
        </t>
      </section>
    </section>
    <section anchor="sec-security">
      <name>Security Considerations</name>
      <t>
        This specification describes two X.509 extensions.
        Since X.509 certificates are digitally signed, no additional integrity service is necessary.
        Certificates with these extensions need not be kept secret, and unrestricted and anonymous access to these certificates has no security implications.
      </t>
      <t>
        However, security factors outside the scope of this specification will affect the assurance provided to certificate users.
        This section highlights critical issues that should be considered by implementors, administrators, and users.
      </t>
      <t>
        These extensions represent authorization information, i.e., a right-to-use for IP addresses or AS identifiers.
        They were developed to support a secure version of BGP <xref target="S-BGP"/>, but may be employed in other contexts.
        In the secure BGP context, certificates containing these extensions function as capabilities: the certificate asserts that the holder of the private key (the Subject) is authorized to use the IP addresses or AS identifiers represented in the extension(s).
        As a result of this capability model, the Subject field is largely irrelevant for security purposes, contrary to common PKI conventions.
      </t>
    </section>
    <section anchor="sec-ack">
      <name>Acknowledgments</name>
      <t>
        The authors would like to acknowledge the contributions to this specification by
          <contact fullname="Charles Gardiner"/>,
          <contact fullname="Russ Housley"/>,
          <contact fullname="James Manger"/>,
          <contact fullname="Jim Schaad"/>,
          <contact fullname="Charles Bobo"/>,
          and
          <contact fullname="Randy Bush"/>.
      </t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <reference anchor="IANA-AFI" target="http://www.iana.org/assignments/address-family-numbers">
          <front>
            <title>Address Family Numbers</title>
            <author>
              <organization>IANA</organization>
            </author>
          </front>
        </reference>
        <reference anchor="IANA-SAFI" target="http://www.iana.org/assignments/safi-namespace">
          <front>
            <title>Subsequent Address Family Identifiers (SAFI)</title>
            <author>
              <organization>IANA</organization>
            </author>
          </front>
        </reference>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author fullname="S. Bradner" initials="S." surname="Bradner"/>
            <date month="March" year="1997"/>
            <abstract>
              <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
          <seriesInfo name="DOI" value="10.17487/RFC2119"/>
        </reference>
        <reference anchor="RFC3280" target="https://www.rfc-editor.org/info/rfc3280" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3280.xml">
          <front>
            <title>Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile</title>
            <author fullname="R. Housley" initials="R." surname="Housley"/>
            <author fullname="W. Polk" initials="W." surname="Polk"/>
            <author fullname="W. Ford" initials="W." surname="Ford"/>
            <author fullname="D. Solo" initials="D." surname="Solo"/>
            <date month="May" year="2002"/>
            <abstract>
              <t>This memo profiles the X.509 v3 certificate and X.509 v2 Certificate Revocation List (CRL) for use in the Internet. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="3280"/>
          <seriesInfo name="DOI" value="10.17487/RFC3280"/>
        </reference>
        <reference anchor="RFC3779" target="https://www.rfc-editor.org/info/rfc3779" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3779.xml">
          <front>
            <title>X.509 Extensions for IP Addresses and AS Identifiers</title>
            <author fullname="C. Lynn" initials="C." surname="Lynn"/>
            <author fullname="S. Kent" initials="S." surname="Kent"/>
            <author fullname="K. Seo" initials="K." surname="Seo"/>
            <date month="June" year="2004"/>
            <abstract>
              <t>This document defines two X.509 v3 certificate extensions. The first binds a list of IP address blocks, or prefixes, to the subject of a certificate. The second binds a list of autonomous system identifiers to the subject of a certificate. These extensions may be used to convey the authorization of the subject to use the IP addresses and autonomous system identifiers contained in the extensions. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="3779"/>
          <seriesInfo name="DOI" value="10.17487/RFC3779"/>
        </reference>
        <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author fullname="B. Leiba" initials="B." surname="Leiba"/>
            <date month="May" year="2017"/>
            <abstract>
              <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="8174"/>
          <seriesInfo name="DOI" value="10.17487/RFC8174"/>
        </reference>
        <reference anchor="X.690">
          <front>
            <title>Information Technology - ASN.1 Encoding Rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)</title>
            <author>
              <organization>ITU-T</organization>
            </author>
            <date year="1997"/>
          </front>
          <seriesInfo name="ITU-T Recommendation" value="X.690"/>
          <seriesInfo name="ISO/IEC" value="8825-1:1998"/>
        </reference>
        <reference anchor="ISO10747" target="https://www.iso.org/standard/21417.html" quoteTitle="true" derivedAnchor="ISO10747">
          <front>
            <title>Information technology - Telecommunications and information exchange between systems - Protocol for exchange of inter-domain routeing information among intermediate systems to support forwarding of ISO 8473 PDUs</title>
            <author>
              <organization showOnFrontPage="true">ISO/IEC</organization>
            </author>
            <date year="1994" month="October"/>
          </front>
          <seriesInfo name="ISO/IEC" value="10747:1994"/>
        </reference>
      </references>
      <references>
        <name>Informative References</name>
        <reference anchor="RFC791" target="https://www.rfc-editor.org/info/rfc791" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.791.xml">
          <front>
            <title>Internet Protocol</title>
            <author fullname="J. Postel" initials="J." surname="Postel"/>
            <date month="September" year="1981"/>
          </front>
          <seriesInfo name="STD" value="5"/>
          <seriesInfo name="RFC" value="791"/>
          <seriesInfo name="DOI" value="10.17487/RFC791"/>
        </reference>
        <reference anchor="RFC1771" target="https://www.rfc-editor.org/info/rfc1771" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.1771.xml">
          <front>
            <title>A Border Gateway Protocol 4 (BGP-4)</title>
            <author fullname="Y. Rekhter" initials="Y." surname="Rekhter"/>
            <author fullname="T. Li" initials="T." surname="Li"/>
            <date month="March" year="1995"/>
            <abstract>
              <t>This document, together with its companion document, "Application of the Border Gateway Protocol in the Internet", define an inter-autonomous system routing protocol for the Internet. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="1771"/>
          <seriesInfo name="DOI" value="10.17487/RFC1771"/>
        </reference>
        <reference anchor="RFC1930" target="https://www.rfc-editor.org/info/rfc1930" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.1930.xml">
          <front>
            <title>Guidelines for creation, selection, and registration of an Autonomous System (AS)</title>
            <author fullname="J. Hawkinson" initials="J." surname="Hawkinson"/>
            <author fullname="T. Bates" initials="T." surname="Bates"/>
            <date month="March" year="1996"/>
            <abstract>
              <t>This memo discusses when it is appropriate to register and utilize an Autonomous System (AS), and lists criteria for such. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="6"/>
          <seriesInfo name="RFC" value="1930"/>
          <seriesInfo name="DOI" value="10.17487/RFC1930"/>
        </reference>
        <reference anchor="RFC2050" target="https://www.rfc-editor.org/info/rfc2050" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2050.xml">
          <front>
            <title>Internet Registry IP Allocation Guidelines</title>
            <author fullname="K. Hubbard" initials="K." surname="Hubbard"/>
            <author fullname="M. Kosters" initials="M." surname="Kosters"/>
            <author fullname="D. Conrad" initials="D." surname="Conrad"/>
            <author fullname="D. Karrenberg" initials="D." surname="Karrenberg"/>
            <author fullname="J. Postel" initials="J." surname="Postel"/>
            <date month="November" year="1996"/>
            <abstract>
              <t>This document describes the registry system for the distribution of globally unique Internet address space and registry operations. Particularly this document describes the rules and guidelines governing the distribution of this address space. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="2050"/>
          <seriesInfo name="DOI" value="10.17487/RFC2050"/>
        </reference>
        <reference anchor="RFC3281" target="https://www.rfc-editor.org/info/rfc3281" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3281.xml">
          <front>
            <title>An Internet Attribute Certificate Profile for Authorization</title>
            <author fullname="S. Farrell" initials="S." surname="Farrell"/>
            <author fullname="R. Housley" initials="R." surname="Housley"/>
            <date month="May" year="2002"/>
            <abstract>
              <t>This specification defines a profile for the use of X.509 Attribute Certificates in Internet Protocols. Attribute certificates may be used in a wide range of applications and environments covering a broad spectrum of interoperability goals and a broader spectrum of operational and assurance requirements. The goal of this document is to establish a common baseline for generic applications requiring broad interoperability as well as limited special purpose requirements. The profile places emphasis on attribute certificate support for Internet electronic mail, IPSec, and WWW security applications. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="3281"/>
          <seriesInfo name="DOI" value="10.17487/RFC3281"/>
        </reference>
        <reference anchor="RFC3513" target="https://www.rfc-editor.org/info/rfc3513" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3513.xml">
          <front>
            <title>Internet Protocol Version 6 (IPv6) Addressing Architecture</title>
            <author fullname="R. Hinden" initials="R." surname="Hinden"/>
            <author fullname="S. Deering" initials="S." surname="Deering"/>
            <date month="April" year="2003"/>
            <abstract>
              <t>This specification defines the addressing architecture of the IP Version 6 (IPv6) protocol. The document includes the IPv6 addressing model, text representations of IPv6 addresses, definition of IPv6 unicast addresses, anycast addresses, and multicast addresses, and an IPv6 node's required addresses. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="3513"/>
          <seriesInfo name="DOI" value="10.17487/RFC3513"/>
        </reference>
        <reference anchor="S-BGP">
          <front>
            <title>Secure Border Gateway Protocol (S-BGP)</title>
            <author fullname="S. Kent" initials="S." surname="Kent"/>
            <author fullname="C. Lynn" initials="C." surname="Lynn"/>
            <author fullname="K. Seo" initials="K." surname="Seo"/>
            <date month="April" year="2000"/>
          </front>
          <refcontent>IEEE JSAC Special Issue on Network Security</refcontent>
        </reference>
      </references>
    </references>
    <section anchor="app-asn1">
      <name>ASN.1 Module</name>
      <t>
        This normative appendix describes the IP address and AS identifiers extensions used by conforming PKI components in ASN.1 syntax.
      </t>
      <sourcecode type="asn.1">
IPAddrAndASCertExtn { iso(1) identified-organization(3) dod(6)
         internet(1) security(5) mechanisms(5) pkix(7) mod(0)
         id-mod-ip-addr-and-as-ident(30) }
    DEFINITIONS EXPLICIT TAGS ::=
BEGIN

-- EXPORTS ALL --

IMPORTS

-- PKIX specific OIDs and arcs --
    id-pe FROM PKIX1Explicit88 { iso(1) identified-organization(3)
               dod(6) internet(1) security(5) mechanisms(5) pkix(7)
               id-mod(0) id-pkix1-explicit(18) };

-- IP Address Delegation Extension OID --

id-pe-ipAddrBlocks  OBJECT IDENTIFIER ::= { id-pe 7 }

-- IP Address Delegation Extension Syntax --

IPAddrBlocks        ::= SEQUENCE OF IPAddressFamily

IPAddressFamily     ::= SEQUENCE { -- AFI &amp; opt SAFI --
   addressFamily        OCTET STRING (SIZE (2..3)),
   ipAddressChoice      IPAddressChoice }

IPAddressChoice     ::= CHOICE {
   inherit              NULL, -- inherit from issuer --
   addressesOrRanges    SEQUENCE OF IPAddressOrRange }

IPAddressOrRange    ::= CHOICE {
   addressPrefix        IPAddress,
   addressRange         IPAddressRange }

IPAddressRange      ::= SEQUENCE {
   min                  IPAddress,
   max                  IPAddress }

IPAddress           ::= BIT STRING

-- Autonomous System Identifier Delegation Extension OID --

id-pe-autonomousSysIds  OBJECT IDENTIFIER ::= { id-pe 8 }

-- Autonomous System Identifier Delegation Extension Syntax --

ASIdentifiers       ::= SEQUENCE {
    asnum               [0] ASIdentifierChoice OPTIONAL,
    rdi                 [1] ASIdentifierChoice OPTIONAL }

ASIdentifierChoice  ::= CHOICE {
   inherit              NULL, -- inherit from issuer --
   asIdsOrRanges        SEQUENCE OF ASIdOrRange }

ASIdOrRange         ::= CHOICE {
    id                  ASId,
    range               ASRange }

ASRange             ::= SEQUENCE {
    min                 ASId,
    max                 ASId }

ASId                ::= INTEGER

END
</sourcecode>
    </section>
    <section anchor="app-ip-examples">
      <name>Examples of IP Address Delegation Extensions</name>
      <t>A critical X.509 v3 certificate extension that specifies:</t>
      <artwork type="ascii-art">
IPv4 unicast address prefixes
    1)  10.0.32/20     i.e., 10.0.32.0 to 10.0.47.255
    2)  10.0.64/24     i.e., 10.0.64.0 to 10.0.64.255
    3)  10.1/16        i.e., 10.1.0.0  to 10.1.255.255
    4)  10.2.48/20     i.e., 10.2.48.0 to 10.2.63.255
    5)  10.2.64/24     i.e., 10.2.64.0 to 10.2.64.255
    6)  10.3/16        i.e., 10.3.0.0  to 10.3.255.255, and
    7)  inherits all IPv6 addresses from the issuer's certificate
</artwork>
      <t>would be (in hexadecimal):</t>
      <artwork type="ascii-art">
30 46                       Extension {
   06 08 2b06010505070107     extnID        1.3.6.1.5.5.7.1.7
   01 01 ff                   critical
   04 37                      extnValue {
      30 35                     IPAddrBlocks {
         30 2b                    IPAddressFamily {
            04 03 0001  01          addressFamily: IPv4 Unicast
                                    IPAddressChoice
            30 24                     addressesOrRanges {
                                        IPAddressOrRange
               03 04 04 0a0020            addressPrefix 10.0.32/20
                                        IPAddressOrRange
               03 04 00 0a0040            addressPrefix 10.0.64/24
                                        IPAddressOrRange
               03 03 00 0a01              addressPrefix    10.1/16
                                        IPAddressOrRange
               30 0c                      addressRange {
                  03 04 04 0a0230           min        10.2.48.0
                  03 04 00 0a0240           max        10.2.64.255
                                          } -- addressRange
                                        IPAddressOrRange
               03 03 00 0a03              addressPrefix    10.3/16
                                      } -- addressesOrRanges
                                  } -- IPAddressFamily
         30 06                    IPAddressFamily {
            04 02 0002              addressFamily: IPv6
                                    IPAddressChoice
            05 00                     inherit from issuer
                                  } -- IPAddressFamily
                                } -- IPAddrBlocks
                              } -- extnValue
                            } -- Extension
</artwork>
      <t>
        This example illustrates how the prefixes and ranges are sorted.
      </t>
      <ul spacing="normal">
        <li>
          Prefix 1 <bcp14>MUST</bcp14> precede prefix 2, even though the number of unused bits (4) in prefix 1 is larger than the number of unused bits (0) in prefix 2.
        </li>
        <li>
          Prefix 2 <bcp14>MUST</bcp14> precede prefix 3 even though the number of octets (4) in the <tt>BIT STRING</tt> encoding of prefix 2 is larger than the number of octets (3) in the <tt>BIT STRING</tt> encoding of prefix 3.
        </li>
        <li>
          Prefixes 4 and 5 are adjacent (representing the range of addresses from 10.2.48.0 to 10.2.64.255), so <bcp14>MUST</bcp14> be combined into a range (since the range cannot be encoded by a single prefix).
        </li>
        <li>
          Note that the six trailing zero bits in the max element of the range are significant to the semantic interpretation of the value (as all unused bits are interpreted to be 1's, not 0's).
          The four trailing zero bits in the min element are not significant and <bcp14>MUST</bcp14> be removed (thus the (4) unused bits in the encoding of the min element).
          (DER encoding requires that any unused bits in the last subsequent octet <bcp14>MUST</bcp14> be set to zero.)
        </li>
        <li>
          The range formed by prefixes 4 and 5 <bcp14>MUST</bcp14> precede prefix 6 even though the SEQUENCE tag for a range (30) is larger than the tag for the <tt>BIT STRING</tt> (03) used to encode prefix 6.
        </li>
        <li>
          The IPv4 information <bcp14>MUST</bcp14> precede the IPv6 information since the address family identifier for IPv4 (0001) is less than the identifier for IPv6 (0002).
        </li>
      </ul>
      <t>
        An extension specifying the IPv6 prefix 2001:0:2/48 and the IPv4 prefixes 10/8 and 172.16/12, and which inherits all IPv4 multicast addresses from the issuer's certificate would be (in hexadecimal):
      </t>
      <artwork><![CDATA[
30 3d                       Extension {
   06 08 2b06010505070107     extnID        1.3.6.1.5.5.7.1.7
   01 01 ff                   critical
   04 2e                      extnValue {
      30 2c                     IPAddrBlocks {
         30 10                    IPAddressFamily {
            04 03 0001 01           addressFamily: IPv4 Unicast
                                    IPAddressChoice
            30 09                     addressesOrRanges {
                                        IPAddressOrRange
               03 02 00 0a                addressPrefix    10/8
                                        IPAddressOrRange
               03 03 04 ac10              addressPrefix    172.16/12
                                      } -- addressesOrRanges
                                  } -- IPAddressFamily
         30 07                    IPAddressFamily {
            04 03 0001 02           addressFamily: IPv4 Multicast
                                    IPAddressChoice
            05 00                     inherit from issuer
                                  } -- IPAddressFamily
         30 0f                    IPAddressFamily {
            04 02 0002              addressFamily: IPv6
                                    IPAddressChoice
            30 09                     addressesOrRanges {
                                        IPAddressOrRange
               03 07 00 200100000002      addressPrefix   2001:0:2::/48
                                      } -- addressesOrRanges
                                  } -- IPAddressFamily
                                } -- IPAddrBlocks
                              } -- extnValue
                               } -- Extension
]]></artwork>
    </section>
    <section anchor="app-as-example">
      <name>Example of an AS Identifier Delegation Extension</name>
      <t>
        An extension that specifies AS numbers 135, 3000 to 3999, and 5001, and which inherits all Routing Domain Identifiers from the issuer's certificate would be (in hexadecimal):
      </t>
      <artwork><![CDATA[
30 2b                       Extension {
   06 08 2b06010505070108     extnID        1.3.6.1.5.5.7.1.8
   01 01 ff                   critical
   04 1c                      extnValue {
      30 1a                     ASIdentifiers {
         a0 14                    asnum
                                    ASIdentifierChoice
            30 12                     asIdsOrRanges {
                                        ASIdOrRange
               02 02 0087                 ASId
                                        ASIdOrRange
               30 08                      ASRange {
                  02 02 0bb8                min
                  02 02 0f9f                max
                                          } -- ASRange
                                        ASIdOrRange
               02 02 1389                 ASId
                                      } -- asIdsOrRanges
                                  } -- asnum
         a1 02                    rdi {
                                    ASIdentifierChoice
            05 00                     inherit from issuer
                                  } -- rdi
                                } -- ASIdentifiers
                              } -- extnValue
                            } -- Extension
]]></artwork>
    </section>
    <section anchor="app-ac">
      <name>Use of X.509 Attribute Certificates</name>
      <t>
        This appendix discusses issues arising from a proposal to use attribute certificates (ACs, as specified in <xref target="RFC3281"/>) to convey, from the Regional Internet Registries (RIRs) to the end-user organizations, the "right-to-use" for IP address blocks or AS identifiers.
      </t>
      <t>
        The two resources, AS identifiers and IP address blocks, are currently managed differently.
        All organizations with the right-to-use for an AS identifier receive the authorization directly from an RIR.
        Organizations with a right-to-use for an IP address block receive the authorization either directly from an RIR, or indirectly, e.g., from a down stream service provider, who might receive its authorization from an Internet service provider, who in turn gets its authorization from a RIR.
        Note that AS identifiers might be sub-allocated in the future, so the mechanisms used should not rely upon a three level hierarchy.
      </t>
      <t>
        In <xref target="RFC3281" section="1" sectionFormat="of"/>, two reasons are given for why the use of ACs might be preferable to the use of public key certificates (PKCs) with extensions that convey the authorization information:
      </t>
      <blockquote>
        <t>
          Authorization information may be placed in a PKC extension or placed in a separate attribute certificate (AC).
          The placement of authorization information in PKCs is usually undesirable for two reasons.
          First, authorization information often does not have the same lifetime as the binding of the identity and the public key.
          When authorization information is placed in a PKC extension, the general result is the shortening of the PKC useful lifetime.
          Second, the PKC issuer is not usually authoritative for the authorization information.
          This results in additional steps for the PKC issuer to obtain authorization information from the authoritative source.
        </t>
        <t>
          For these reasons, it is often better to separate authorization information from the PKC.
          Yet, authorization information also needs to be bound to an identity.
          An AC provides this binding; it is simply a digitally signed (or certified) identity and set of attributes.
        </t>
      </blockquote>
      <t>
        In the case of the IP address and AS identifier authorizations, these reasons do not apply.
        First, the public key certificates are issued exclusively for authorization, so the certificate lifetime corresponds exactly to the authorization lifetime, which is often tied to a contractual relationship between the issuer and entity receiving the authorization.
        The Subject and Issuer names are only used for chaining during certification path validation, and the names need not correspond to any physical entity.
        The Subject name in the PKCs may actually be randomly assigned by the issuing CA, allowing the resource holder limited anonymity.
        Second, the certificate hierarchy is constructed so that the certificate issuer is authoritative for the authorization information.
      </t>
      <t>
        Thus the two points in the first cited paragraph above are not true in the case of AS number and IP address block allocations.
        The point of the second cited paragraph is also not applicable as the resources are not being bound to an identity but to the holder of the private key corresponding to the public key in the PKC.
      </t>
      <t>
        <xref target="RFC3281"/> specifies several requirements that a conformant Attribute Certificate must meet.
        In relation to S-BGP, the more-significant requirements are:
      </t>
      <ol spacing="normal" type="1">
        <li>
          <t>
            from <xref target="RFC3281" section="1" sectionFormat="of"/>: "this specification does NOT RECOMMEND the use of AC chains.
            Other (future) specifications may address the use of AC chains."
          </t>
          <t>
            Allocation from IANA to RIRs to ISPs to DSPs and assignment to end organizations would require the use of chains, at least for IP address blocks.
            A description of how the superior's AC should be located and how it should be processed would have to be provided.
            Readers of this document are encouraged to propose ways the chaining might be avoided.
          </t>
        </li>
        <li>
          <t>
            from <xref target="RFC3281" section="4.2.9" sectionFormat="of"/>: "section 4.3 defines the extensions that MAY be used with this profile, and whether or not they may be marked critical.
            If any other critical extension is used, the AC does not conform to this profile.
            However, if any other non-critical extension is used, the AC does conform to this profile."
          </t>
          <t>
            This means that the delegation extensions defined in this specification, which are critical, could not be simply placed into an AC.
            They could be used if not marked critical, but the intended use requires that the extensions be critical so that the certificates containing them cannot be used as identity certificates by an unsuspecting application.
          </t>
        </li>
        <li>
          <t>
            from <xref target="RFC3281" section="4.5" sectionFormat="of"/>:
              "an AC issuer, MUST NOT also be a PKC issuer.
               That is, an AC issuer cannot be a CA as well."
          </t>
          <t>
            This means that for each AC issuer there would need to be a separate CA to issue the PKC that contains the public key of the AC holder.
            The AC issuer cannot issue the PKC of the holder, and the PKC issuer cannot sign the AC.
            Thus, each entity in the PKI would need to operate an AC issuer in addition to its CA.
            There would be twice as many certificate issuers and CRLs to process to support Attribute certificates than are needed if PKCs are used.
            The possibility of mis-alignment also arises when there are two issuers issuing certificates for a single purpose.
          </t>
          <t>
            The AC model of RFC 3281 implies that the AC holder presents the AC to the AC verifier when the holder wants to substantiate an attribute or authorization.
            The intended usage for the extensions defined herein does not have a direct interaction between an AC verifier (a NOC) and the AC issuers (all RIRs and NOCs).
            Given a signature on a claimed right-to-use object, the "AC verifier" can locate the AC holder's PKC, but there is no direct way to locate the Subject's AC(s).
          </t>
        </li>
        <li>
          <t>
            from <xref target="RFC3281" section="5" sectionFormat="of"/>:
              "4.  The AC issuer MUST be directly trusted as an AC issuer (by configuration or otherwise)."
          </t>
          <t>
            This is not true in the case of a right-to-use for an IP address block, which is allocated through a hierarchy.
            Certification path validation of the AC will require chaining up through the delegation hierarchy.
            Having to configure each relying party (NOC) to "trust" every other NOC does not scale, and such "trust" has resulted in failures that the proposed security mechanisms are designed to prevent.
            A single PKI with a trusted root is used, not thousands of individually trusted per-ISP AC issuers.
          </t>
          <t>
            The amount of work that would be required to properly validate an AC is larger than for the mechanism that places the certificate extensions defined in this document in the PKCs.
            There would be twice as many certificates to be validated, in addition to the ACs.
            There could be a considerable increase in the management burden required to support ACs.
          </t>
        </li>
      </ol>
    </section>
  </back>
</rfc>
