<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" category="std" consensus="true" docName="draft-ietf-dtn-bpsec-default-sc-11" indexInclude="true" ipr="trust200902" number="9173" prepTime="2022-01-31T21:12:44" scripts="Common,Latin" sortRefs="true" submissionType="IETF" symRefs="true" tocDepth="3" tocInclude="true" xml:lang="en">
  <link href="https://datatracker.ietf.org/doc/draft-ietf-dtn-bpsec-default-sc-11" rel="prev"/>
  <link href="https://dx.doi.org/10.17487/rfc9173" rel="alternate"/>
  <link href="urn:issn:2070-1721" rel="alternate"/>
  <front>
    <title abbrev="BPSec Default Security Contexts">Default Security Contexts for Bundle Protocol Security (BPSec)</title>
    <seriesInfo name="RFC" value="9173" stream="IETF"/>
    <author initials="E." surname="Birrane, III" fullname="Edward J. Birrane, III">
      <organization abbrev="JHU/APL" showOnFrontPage="true">The Johns Hopkins University Applied Physics Laboratory</organization>
      <address>
        <postal>
          <street>11100 Johns Hopkins Rd.</street>
          <city>Laurel</city>
          <region>MD</region>
          <code>20723</code>
          <country>US</country>
        </postal>
        <phone>+1 443 778 7423</phone>
        <email>Edward.Birrane@jhuapl.edu</email>
      </address>
    </author>
    <author fullname="Alex White" initials="A." surname="White">
      <organization abbrev="JHU/APL" showOnFrontPage="true">The Johns Hopkins University Applied Physics Laboratory</organization>
      <address>
        <postal>
          <street>11100 Johns Hopkins Rd.</street>
          <city>Laurel</city>
          <region>MD</region>
          <code>20723</code>
          <country>US</country>
        </postal>
        <phone>+1 443 778 0845</phone>
        <email>Alex.White@jhuapl.edu</email>
      </address>
    </author>
    <author fullname="Sarah Heiner" initials="S." surname="Heiner">
      <organization abbrev="JHU/APL" showOnFrontPage="true">The Johns Hopkins University Applied Physics Laboratory</organization>
      <address>
        <postal>
          <street>11100 Johns Hopkins Rd.</street>
          <city>Laurel</city>
          <region>MD</region>
          <code>20723</code>
          <country>US</country>
        </postal>
        <phone>+1 240 592 3704</phone>
        <email>Sarah.Heiner@jhuapl.edu</email>
      </address>
    </author>
    <date month="01" year="2022"/>
    <area>General</area>
    <workgroup>Delay-Tolerant Networking</workgroup>
    <keyword>security</keyword>
    <keyword>bundle</keyword>
    <keyword>integrity</keyword>
    <keyword>confidentiality</keyword>
    <abstract pn="section-abstract">
      <t indent="0" pn="section-abstract-1">
         This document defines default integrity and confidentiality security
         contexts that can be used with Bundle Protocol Security
         (BPSec) implementations.  These security contexts are intended to be 
         used both for testing the interoperability of BPSec implementations and for providing 
         basic security operations when no other security contexts are defined 
         or otherwise required for a network.
      </t>
    </abstract>
    <boilerplate>
      <section anchor="status-of-memo" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.1">
        <name slugifiedName="name-status-of-this-memo">Status of This Memo</name>
        <t indent="0" pn="section-boilerplate.1-1">
            This is an Internet Standards Track document.
        </t>
        <t indent="0" pn="section-boilerplate.1-2">
            This document is a product of the Internet Engineering Task Force
            (IETF).  It represents the consensus of the IETF community.  It has
            received public review and has been approved for publication by
            the Internet Engineering Steering Group (IESG).  Further
            information on Internet Standards is available in Section 2 of 
            RFC 7841.
        </t>
        <t indent="0" pn="section-boilerplate.1-3">
            Information about the current status of this document, any
            errata, and how to provide feedback on it may be obtained at
            <eref target="https://www.rfc-editor.org/info/rfc9173" brackets="none"/>.
        </t>
      </section>
      <section anchor="copyright" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.2">
        <name slugifiedName="name-copyright-notice">Copyright Notice</name>
        <t indent="0" pn="section-boilerplate.2-1">
            Copyright (c) 2022 IETF Trust and the persons identified as the
            document authors. All rights reserved.
        </t>
        <t indent="0" pn="section-boilerplate.2-2">
            This document is subject to BCP 78 and the IETF Trust's Legal
            Provisions Relating to IETF Documents
            (<eref target="https://trustee.ietf.org/license-info" brackets="none"/>) in effect on the date of
            publication of this document. Please review these documents
            carefully, as they describe your rights and restrictions with
            respect to this document. Code Components extracted from this
            document must include Revised BSD License text as described in
            Section 4.e of the Trust Legal Provisions and are provided without
            warranty as described in the Revised BSD License.
        </t>
      </section>
    </boilerplate>
    <toc>
      <section anchor="toc" numbered="false" removeInRFC="false" toc="exclude" pn="section-toc.1">
        <name slugifiedName="name-table-of-contents">Table of Contents</name>
        <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1">
          <li pn="section-toc.1-1.1">
            <t indent="0" keepWithNext="true" pn="section-toc.1-1.1.1"><xref derivedContent="1" format="counter" sectionFormat="of" target="section-1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-introduction">Introduction</xref></t>
          </li>
          <li pn="section-toc.1-1.2">
            <t indent="0" keepWithNext="true" pn="section-toc.1-1.2.1"><xref derivedContent="2" format="counter" sectionFormat="of" target="section-2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-requirements-language">Requirements Language</xref></t>
          </li>
          <li pn="section-toc.1-1.3">
            <t indent="0" pn="section-toc.1-1.3.1"><xref derivedContent="3" format="counter" sectionFormat="of" target="section-3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-integrity-security-context-">Integrity Security Context BIB-HMAC-SHA2</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.3.2">
              <li pn="section-toc.1-1.3.2.1">
                <t indent="0" keepWithNext="true" pn="section-toc.1-1.3.2.1.1"><xref derivedContent="3.1" format="counter" sectionFormat="of" target="section-3.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-overview">Overview</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.2">
                <t indent="0" pn="section-toc.1-1.3.2.2.1"><xref derivedContent="3.2" format="counter" sectionFormat="of" target="section-3.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-scope">Scope</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.3">
                <t indent="0" pn="section-toc.1-1.3.2.3.1"><xref derivedContent="3.3" format="counter" sectionFormat="of" target="section-3.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-parameters">Parameters</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.3.2.3.2">
                  <li pn="section-toc.1-1.3.2.3.2.1">
                    <t indent="0" pn="section-toc.1-1.3.2.3.2.1.1"><xref derivedContent="3.3.1" format="counter" sectionFormat="of" target="section-3.3.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-sha-variant">SHA Variant</xref></t>
                  </li>
                  <li pn="section-toc.1-1.3.2.3.2.2">
                    <t indent="0" pn="section-toc.1-1.3.2.3.2.2.1"><xref derivedContent="3.3.2" format="counter" sectionFormat="of" target="section-3.3.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-wrapped-key">Wrapped Key</xref></t>
                  </li>
                  <li pn="section-toc.1-1.3.2.3.2.3">
                    <t indent="0" pn="section-toc.1-1.3.2.3.2.3.1"><xref derivedContent="3.3.3" format="counter" sectionFormat="of" target="section-3.3.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-integrity-scope-flags">Integrity Scope Flags</xref></t>
                  </li>
                  <li pn="section-toc.1-1.3.2.3.2.4">
                    <t indent="0" pn="section-toc.1-1.3.2.3.2.4.1"><xref derivedContent="3.3.4" format="counter" sectionFormat="of" target="section-3.3.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-enumerations">Enumerations</xref></t>
                  </li>
                </ul>
              </li>
              <li pn="section-toc.1-1.3.2.4">
                <t indent="0" pn="section-toc.1-1.3.2.4.1"><xref derivedContent="3.4" format="counter" sectionFormat="of" target="section-3.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-results">Results</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.5">
                <t indent="0" pn="section-toc.1-1.3.2.5.1"><xref derivedContent="3.5" format="counter" sectionFormat="of" target="section-3.5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-key-considerations">Key Considerations</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.6">
                <t indent="0" pn="section-toc.1-1.3.2.6.1"><xref derivedContent="3.6" format="counter" sectionFormat="of" target="section-3.6"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-processing-conside">Security Processing Considerations</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.7">
                <t indent="0" pn="section-toc.1-1.3.2.7.1"><xref derivedContent="3.7" format="counter" sectionFormat="of" target="section-3.7"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-canonicalization-algorithms">Canonicalization Algorithms</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.8">
                <t indent="0" pn="section-toc.1-1.3.2.8.1"><xref derivedContent="3.8" format="counter" sectionFormat="of" target="section-3.8"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-processing">Processing</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.3.2.8.2">
                  <li pn="section-toc.1-1.3.2.8.2.1">
                    <t indent="0" pn="section-toc.1-1.3.2.8.2.1.1"><xref derivedContent="3.8.1" format="counter" sectionFormat="of" target="section-3.8.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-keyed-hash-generation">Keyed Hash Generation</xref></t>
                  </li>
                  <li pn="section-toc.1-1.3.2.8.2.2">
                    <t indent="0" pn="section-toc.1-1.3.2.8.2.2.1"><xref derivedContent="3.8.2" format="counter" sectionFormat="of" target="section-3.8.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-keyed-hash-verification">Keyed Hash Verification</xref></t>
                  </li>
                </ul>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.4">
            <t indent="0" pn="section-toc.1-1.4.1"><xref derivedContent="4" format="counter" sectionFormat="of" target="section-4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-context-bcb-aes-gc">Security Context BCB-AES-GCM</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.4.2">
              <li pn="section-toc.1-1.4.2.1">
                <t indent="0" pn="section-toc.1-1.4.2.1.1"><xref derivedContent="4.1" format="counter" sectionFormat="of" target="section-4.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-overview-2">Overview</xref></t>
              </li>
              <li pn="section-toc.1-1.4.2.2">
                <t indent="0" pn="section-toc.1-1.4.2.2.1"><xref derivedContent="4.2" format="counter" sectionFormat="of" target="section-4.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-scope-2">Scope</xref></t>
              </li>
              <li pn="section-toc.1-1.4.2.3">
                <t indent="0" pn="section-toc.1-1.4.2.3.1"><xref derivedContent="4.3" format="counter" sectionFormat="of" target="section-4.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-parameters-2">Parameters</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.4.2.3.2">
                  <li pn="section-toc.1-1.4.2.3.2.1">
                    <t indent="0" pn="section-toc.1-1.4.2.3.2.1.1"><xref derivedContent="4.3.1" format="counter" sectionFormat="of" target="section-4.3.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-initialization-vector-iv">Initialization Vector (IV)</xref></t>
                  </li>
                  <li pn="section-toc.1-1.4.2.3.2.2">
                    <t indent="0" pn="section-toc.1-1.4.2.3.2.2.1"><xref derivedContent="4.3.2" format="counter" sectionFormat="of" target="section-4.3.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-aes-variant">AES Variant</xref></t>
                  </li>
                  <li pn="section-toc.1-1.4.2.3.2.3">
                    <t indent="0" pn="section-toc.1-1.4.2.3.2.3.1"><xref derivedContent="4.3.3" format="counter" sectionFormat="of" target="section-4.3.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-wrapped-key-2">Wrapped Key</xref></t>
                  </li>
                  <li pn="section-toc.1-1.4.2.3.2.4">
                    <t indent="0" pn="section-toc.1-1.4.2.3.2.4.1"><xref derivedContent="4.3.4" format="counter" sectionFormat="of" target="section-4.3.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-aad-scope-flags">AAD Scope Flags</xref></t>
                  </li>
                  <li pn="section-toc.1-1.4.2.3.2.5">
                    <t indent="0" pn="section-toc.1-1.4.2.3.2.5.1"><xref derivedContent="4.3.5" format="counter" sectionFormat="of" target="section-4.3.5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-enumerations-2">Enumerations</xref></t>
                  </li>
                </ul>
              </li>
              <li pn="section-toc.1-1.4.2.4">
                <t indent="0" pn="section-toc.1-1.4.2.4.1"><xref derivedContent="4.4" format="counter" sectionFormat="of" target="section-4.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-results-2">Results</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.4.2.4.2">
                  <li pn="section-toc.1-1.4.2.4.2.1">
                    <t indent="0" pn="section-toc.1-1.4.2.4.2.1.1"><xref derivedContent="4.4.1" format="counter" sectionFormat="of" target="section-4.4.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-authentication-tag">Authentication Tag</xref></t>
                  </li>
                  <li pn="section-toc.1-1.4.2.4.2.2">
                    <t indent="0" pn="section-toc.1-1.4.2.4.2.2.1"><xref derivedContent="4.4.2" format="counter" sectionFormat="of" target="section-4.4.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-enumerations-3">Enumerations</xref></t>
                  </li>
                </ul>
              </li>
              <li pn="section-toc.1-1.4.2.5">
                <t indent="0" pn="section-toc.1-1.4.2.5.1"><xref derivedContent="4.5" format="counter" sectionFormat="of" target="section-4.5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-key-considerations-2">Key Considerations</xref></t>
              </li>
              <li pn="section-toc.1-1.4.2.6">
                <t indent="0" pn="section-toc.1-1.4.2.6.1"><xref derivedContent="4.6" format="counter" sectionFormat="of" target="section-4.6"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-gcm-considerations">GCM Considerations</xref></t>
              </li>
              <li pn="section-toc.1-1.4.2.7">
                <t indent="0" pn="section-toc.1-1.4.2.7.1"><xref derivedContent="4.7" format="counter" sectionFormat="of" target="section-4.7"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-canonicalization-algorithms-2">Canonicalization Algorithms</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.4.2.7.2">
                  <li pn="section-toc.1-1.4.2.7.2.1">
                    <t indent="0" pn="section-toc.1-1.4.2.7.2.1.1"><xref derivedContent="4.7.1" format="counter" sectionFormat="of" target="section-4.7.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-calculations-related-to-cip">Calculations Related to Ciphertext</xref></t>
                  </li>
                  <li pn="section-toc.1-1.4.2.7.2.2">
                    <t indent="0" pn="section-toc.1-1.4.2.7.2.2.1"><xref derivedContent="4.7.2" format="counter" sectionFormat="of" target="section-4.7.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-additional-authenticated-da">Additional Authenticated Data</xref></t>
                  </li>
                </ul>
              </li>
              <li pn="section-toc.1-1.4.2.8">
                <t indent="0" pn="section-toc.1-1.4.2.8.1"><xref derivedContent="4.8" format="counter" sectionFormat="of" target="section-4.8"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-processing-2">Processing</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.4.2.8.2">
                  <li pn="section-toc.1-1.4.2.8.2.1">
                    <t indent="0" pn="section-toc.1-1.4.2.8.2.1.1"><xref derivedContent="4.8.1" format="counter" sectionFormat="of" target="section-4.8.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-encryption">Encryption</xref></t>
                  </li>
                  <li pn="section-toc.1-1.4.2.8.2.2">
                    <t indent="0" pn="section-toc.1-1.4.2.8.2.2.1"><xref derivedContent="4.8.2" format="counter" sectionFormat="of" target="section-4.8.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-decryption">Decryption</xref></t>
                  </li>
                </ul>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.5">
            <t indent="0" pn="section-toc.1-1.5.1"><xref derivedContent="5" format="counter" sectionFormat="of" target="section-5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-iana-considerations">IANA Considerations</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.5.2">
              <li pn="section-toc.1-1.5.2.1">
                <t indent="0" pn="section-toc.1-1.5.2.1.1"><xref derivedContent="5.1" format="counter" sectionFormat="of" target="section-5.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-context-identifier">Security Context Identifiers</xref></t>
              </li>
              <li pn="section-toc.1-1.5.2.2">
                <t indent="0" pn="section-toc.1-1.5.2.2.1"><xref derivedContent="5.2" format="counter" sectionFormat="of" target="section-5.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-integrity-scope-flags-2">Integrity Scope Flags</xref></t>
              </li>
              <li pn="section-toc.1-1.5.2.3">
                <t indent="0" pn="section-toc.1-1.5.2.3.1"><xref derivedContent="5.3" format="counter" sectionFormat="of" target="section-5.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-aad-scope-flags-2">AAD Scope Flags</xref></t>
              </li>
              <li pn="section-toc.1-1.5.2.4">
                <t indent="0" pn="section-toc.1-1.5.2.4.1"><xref derivedContent="5.4" format="counter" sectionFormat="of" target="section-5.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-guidance-for-designated-exp">Guidance for Designated Experts</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.6">
            <t indent="0" pn="section-toc.1-1.6.1"><xref derivedContent="6" format="counter" sectionFormat="of" target="section-6"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-considerations">Security Considerations</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.6.2">
              <li pn="section-toc.1-1.6.2.1">
                <t indent="0" pn="section-toc.1-1.6.2.1.1"><xref derivedContent="6.1" format="counter" sectionFormat="of" target="section-6.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-key-management">Key Management</xref></t>
              </li>
              <li pn="section-toc.1-1.6.2.2">
                <t indent="0" pn="section-toc.1-1.6.2.2.1"><xref derivedContent="6.2" format="counter" sectionFormat="of" target="section-6.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-key-handling">Key Handling</xref></t>
              </li>
              <li pn="section-toc.1-1.6.2.3">
                <t indent="0" pn="section-toc.1-1.6.2.3.1"><xref derivedContent="6.3" format="counter" sectionFormat="of" target="section-6.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-aes-gcm">AES GCM</xref></t>
              </li>
              <li pn="section-toc.1-1.6.2.4">
                <t indent="0" pn="section-toc.1-1.6.2.4.1"><xref derivedContent="6.4" format="counter" sectionFormat="of" target="section-6.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-aes-key-wrap">AES Key Wrap</xref></t>
              </li>
              <li pn="section-toc.1-1.6.2.5">
                <t indent="0" pn="section-toc.1-1.6.2.5.1"><xref derivedContent="6.5" format="counter" sectionFormat="of" target="section-6.5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-bundle-fragmentation">Bundle Fragmentation</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.7">
            <t indent="0" pn="section-toc.1-1.7.1"><xref derivedContent="7" format="counter" sectionFormat="of" target="section-7"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-normative-references">Normative References</xref></t>
          </li>
          <li pn="section-toc.1-1.8">
            <t indent="0" pn="section-toc.1-1.8.1"><xref derivedContent="Appendix A" format="default" sectionFormat="of" target="section-appendix.a"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-examples">Examples</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.8.2">
              <li pn="section-toc.1-1.8.2.1">
                <t indent="0" pn="section-toc.1-1.8.2.1.1"><xref derivedContent="A.1" format="counter" sectionFormat="of" target="section-appendix.a.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-example-1-simple-integrity">Example 1 - Simple Integrity</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.8.2.1.2">
                  <li pn="section-toc.1-1.8.2.1.2.1">
                    <t indent="0" pn="section-toc.1-1.8.2.1.2.1.1"><xref derivedContent="A.1.1" format="counter" sectionFormat="of" target="section-appendix.a.1.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-original-bundle">Original Bundle</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.1.2.2">
                    <t indent="0" pn="section-toc.1-1.8.2.1.2.2.1"><xref derivedContent="A.1.2" format="counter" sectionFormat="of" target="section-appendix.a.1.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-operation-overview">Security Operation Overview</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.1.2.3">
                    <t indent="0" pn="section-toc.1-1.8.2.1.2.3.1"><xref derivedContent="A.1.3" format="counter" sectionFormat="of" target="section-appendix.a.1.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-block-integrity-block">Block Integrity Block</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.1.2.4">
                    <t indent="0" pn="section-toc.1-1.8.2.1.2.4.1"><xref derivedContent="A.1.4" format="counter" sectionFormat="of" target="section-appendix.a.1.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-final-bundle">Final Bundle</xref></t>
                  </li>
                </ul>
              </li>
              <li pn="section-toc.1-1.8.2.2">
                <t indent="0" pn="section-toc.1-1.8.2.2.1"><xref derivedContent="A.2" format="counter" sectionFormat="of" target="section-appendix.a.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-example-2-simple-confidenti">Example 2 - Simple Confidentiality with Key Wrap</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.8.2.2.2">
                  <li pn="section-toc.1-1.8.2.2.2.1">
                    <t indent="0" pn="section-toc.1-1.8.2.2.2.1.1"><xref derivedContent="A.2.1" format="counter" sectionFormat="of" target="section-appendix.a.2.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-original-bundle-2">Original Bundle</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.2.2.2">
                    <t indent="0" pn="section-toc.1-1.8.2.2.2.2.1"><xref derivedContent="A.2.2" format="counter" sectionFormat="of" target="section-appendix.a.2.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-operation-overview-2">Security Operation Overview</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.2.2.3">
                    <t indent="0" pn="section-toc.1-1.8.2.2.2.3.1"><xref derivedContent="A.2.3" format="counter" sectionFormat="of" target="section-appendix.a.2.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-block-confidentiality-block">Block Confidentiality Block</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.2.2.4">
                    <t indent="0" pn="section-toc.1-1.8.2.2.2.4.1"><xref derivedContent="A.2.4" format="counter" sectionFormat="of" target="section-appendix.a.2.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-final-bundle-2">Final Bundle</xref></t>
                  </li>
                </ul>
              </li>
              <li pn="section-toc.1-1.8.2.3">
                <t indent="0" pn="section-toc.1-1.8.2.3.1"><xref derivedContent="A.3" format="counter" sectionFormat="of" target="section-appendix.a.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-example-3-security-blocks-f">Example 3 - Security Blocks from Multiple Sources</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.8.2.3.2">
                  <li pn="section-toc.1-1.8.2.3.2.1">
                    <t indent="0" pn="section-toc.1-1.8.2.3.2.1.1"><xref derivedContent="A.3.1" format="counter" sectionFormat="of" target="section-appendix.a.3.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-original-bundle-3">Original Bundle</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.3.2.2">
                    <t indent="0" pn="section-toc.1-1.8.2.3.2.2.1"><xref derivedContent="A.3.2" format="counter" sectionFormat="of" target="section-appendix.a.3.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-operation-overview-3">Security Operation Overview</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.3.2.3">
                    <t indent="0" pn="section-toc.1-1.8.2.3.2.3.1"><xref derivedContent="A.3.3" format="counter" sectionFormat="of" target="section-appendix.a.3.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-block-integrity-block-2">Block Integrity Block</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.3.2.4">
                    <t indent="0" pn="section-toc.1-1.8.2.3.2.4.1"><xref derivedContent="A.3.4" format="counter" sectionFormat="of" target="section-appendix.a.3.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-block-confidentiality-block-2">Block Confidentiality Block</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.3.2.5">
                    <t indent="0" pn="section-toc.1-1.8.2.3.2.5.1"><xref derivedContent="A.3.5" format="counter" sectionFormat="of" target="section-appendix.a.3.5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-final-bundle-3">Final Bundle</xref></t>
                  </li>
                </ul>
              </li>
              <li pn="section-toc.1-1.8.2.4">
                <t indent="0" pn="section-toc.1-1.8.2.4.1"><xref derivedContent="A.4" format="counter" sectionFormat="of" target="section-appendix.a.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-example-4-security-blocks-w">Example 4 - Security Blocks with Full Scope</xref></t>
                <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.8.2.4.2">
                  <li pn="section-toc.1-1.8.2.4.2.1">
                    <t indent="0" pn="section-toc.1-1.8.2.4.2.1.1"><xref derivedContent="A.4.1" format="counter" sectionFormat="of" target="section-appendix.a.4.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-original-bundle-4">Original Bundle</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.4.2.2">
                    <t indent="0" pn="section-toc.1-1.8.2.4.2.2.1"><xref derivedContent="A.4.2" format="counter" sectionFormat="of" target="section-appendix.a.4.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-operation-overview-4">Security Operation Overview</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.4.2.3">
                    <t indent="0" pn="section-toc.1-1.8.2.4.2.3.1"><xref derivedContent="A.4.3" format="counter" sectionFormat="of" target="section-appendix.a.4.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-block-integrity-block-3">Block Integrity Block</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.4.2.4">
                    <t indent="0" pn="section-toc.1-1.8.2.4.2.4.1"><xref derivedContent="A.4.4" format="counter" sectionFormat="of" target="section-appendix.a.4.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-block-confidentiality-block-3">Block Confidentiality Block</xref></t>
                  </li>
                  <li pn="section-toc.1-1.8.2.4.2.5">
                    <t indent="0" pn="section-toc.1-1.8.2.4.2.5.1"><xref derivedContent="A.4.5" format="counter" sectionFormat="of" target="section-appendix.a.4.5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-final-bundle-4">Final Bundle</xref></t>
                  </li>
                </ul>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.9">
            <t indent="0" pn="section-toc.1-1.9.1"><xref derivedContent="Appendix B" format="default" sectionFormat="of" target="section-appendix.b"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-cddl-expression">CDDL Expression</xref></t>
          </li>
          <li pn="section-toc.1-1.10">
            <t indent="0" pn="section-toc.1-1.10.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.c"/><xref derivedContent="" format="title" sectionFormat="of" target="name-acknowledgments">Acknowledgments</xref></t>
          </li>
          <li pn="section-toc.1-1.11">
            <t indent="0" pn="section-toc.1-1.11.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.d"/><xref derivedContent="" format="title" sectionFormat="of" target="name-authors-addresses">Authors' Addresses</xref></t>
          </li>
        </ul>
      </section>
    </toc>
  </front>
  <middle>
    <section anchor="intro" toc="include" numbered="true" removeInRFC="false" pn="section-1">
      <name slugifiedName="name-introduction">Introduction</name>
      <t indent="0" pn="section-1-1">
         The Bundle Protocol Security (BPSec) specification
         <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/> provides inter-bundle 
         integrity and confidentiality operations for networks deploying the 
         Bundle Protocol (BP) <xref target="RFC9171" format="default" sectionFormat="of" derivedContent="RFC9171"/>. BPSec defines 
         BP extension blocks to carry security information produced under the
         auspices of some security context. 
      </t>
      <t indent="0" pn="section-1-2">
         This document defines two security contexts (one for an integrity
         service and one for a confidentiality service) for populating 
         BPSec Block Integrity Blocks (BIBs) and Block Confidentiality Blocks 
         (BCBs). This document assumes familiarity with the concepts and 
         terminology associated with BP and BPSec, as these security 
         contexts are used with BPSec security blocks and other BP blocks 
         carried within BP bundles.  
      </t>
      <t indent="0" pn="section-1-3">
         These contexts generate information that <bcp14>MUST</bcp14> be encoded using
         the Concise Binary Object Representation (CBOR) specification documented in <xref target="RFC8949" format="default" sectionFormat="of" derivedContent="RFC8949"/>.
      </t>
    </section>
    <section anchor="term" toc="include" numbered="true" removeInRFC="false" pn="section-2">
      <name slugifiedName="name-requirements-language">Requirements Language</name>
      <t indent="0" pn="section-2-1">
    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" format="default" sectionFormat="of" derivedContent="RFC2119"/> <xref target="RFC8174" format="default" sectionFormat="of" derivedContent="RFC8174"/> 
    when, and only when, they appear in all capitals, as shown here.
      </t>
    </section>
    <section numbered="true" toc="include" anchor="first-context" removeInRFC="false" pn="section-3">
      <name slugifiedName="name-integrity-security-context-">Integrity Security Context BIB-HMAC-SHA2</name>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-3.1">
        <name slugifiedName="name-overview">Overview</name>
        <t indent="0" pn="section-3.1-1">
            The BIB-HMAC-SHA2 security context provides a keyed-hash 
            Message Authentication Code (MAC) over a 
            set of plaintext information. This context uses the Secure 
            Hash Algorithm 2 (SHA-2) discussed in <xref target="SHS" format="default" sectionFormat="of" derivedContent="SHS"/> combined 
            with the Hashed Message Authentication Code (HMAC) keyed hash discussed in <xref target="RFC2104" format="default" sectionFormat="of" derivedContent="RFC2104"/>. The combination 
            of HMAC and SHA-2 as the integrity mechanism for this security
            context was selected for two reasons: 

        </t>
        <ol spacing="normal" type="1" indent="adaptive" start="1" pn="section-3.1-2"><li pn="section-3.1-2.1" derivedCounter="1."> The use of symmetric keys allows this security context to
                be used in places where an asymmetric-key infrastructure (such as a 
                public key infrastructure) might be impractical.              
              </li>
          <li pn="section-3.1-2.2" derivedCounter="2.">
                The combination HMAC-SHA2 represents a well-supported and well-understood
                integrity mechanism with multiple implementations available.
              </li>
        </ol>
        <t indent="0" pn="section-3.1-3">
            BIB-HMAC-SHA2 supports three variants of HMAC-SHA, based on 
            the supported length of the SHA-2 hash value.  These variants 
            correspond to HMAC 256/256, HMAC 384/384, and HMAC 512/512 as 
            defined in Table 7 ("HMAC Algorithm Values") of <xref target="RFC8152" format="default" sectionFormat="of" derivedContent="RFC8152"/>. 
            The selection of which variant is used by this context is 
            provided as a security context parameter.
        </t>
        <t indent="0" pn="section-3.1-4">
            The output of the HMAC <bcp14>MUST</bcp14> be equal to the size of the SHA2 
            hashing function: 256 bits for SHA-256, 384 bits for SHA-384, and 
            512 bits for SHA-512.
        </t>
        <t indent="0" pn="section-3.1-5">
            The BIB-HMAC-SHA2 security context <bcp14>MUST</bcp14> have the security context 
            identifier specified in <xref target="sc_ids" format="default" sectionFormat="of" derivedContent="Section 5.1"/>.
        </t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-3.2">
        <name slugifiedName="name-scope">Scope</name>
        <t indent="0" pn="section-3.2-1">
          The scope of BIB-HMAC-SHA2 is the set of information used
          to produce the plaintext over which a keyed hash is calculated. This
          plaintext is termed the "Integrity-Protected Plaintext (IPPT)". The
          content of the IPPT is constructed as the concatenation of information
          whose integrity is being preserved from the BIB-HMAC-SHA2 security 
          source to its security acceptor. There are five types of information 
          that can be used in the generation of the IPPT, based on 
          how broadly the concept of integrity is being applied. These
          five types of information, whether they are required, and why
          they are important for integrity are discussed as follows.

        </t>
        <dl newline="true" spacing="normal" indent="3" pn="section-3.2-2">
          <dt pn="section-3.2-2.1">Security target contents</dt>
          <dd pn="section-3.2-2.2"> 
              The contents of the block-type-specific data field of the security 
              target <bcp14>MUST</bcp14> be included in the IPPT. Including this information protects
              the security target data and is considered the minimal, required
              set of information for an integrity service on the security
              target.
            </dd>
          <dt pn="section-3.2-2.3">IPPT scope</dt>
          <dd pn="section-3.2-2.4"> 
              The determination of which optional types of information were
              used when constructing the IPPT <bcp14>MUST</bcp14> always be included
              in the IPPT. Including this information ensures that the scope 
              of the IPPT construction at a security source matches the scope of
              the IPPT construction at security verifiers and security acceptors. 
            </dd>
          <dt pn="section-3.2-2.5">Primary block</dt>
          <dd pn="section-3.2-2.6">
            <t indent="0" pn="section-3.2-2.6.1"> 
              The primary block identifies a bundle, and once 
              created, the contents of this block are immutable. Changes to 
              the primary block associated with the security target indicate
              that the security target (and BIB) might no longer be in the
              correct bundle. 
            </t>
            <t indent="0" pn="section-3.2-2.6.2"> 
              For example, if a security target and associated BIB are copied
              from one bundle to another bundle, the BIB might still contain a
              verifiable signature for the security target unless information
              associated with the bundle primary block is included in the
              keyed hash carried by the BIB.
            </t>
            <t indent="0" pn="section-3.2-2.6.3"> 
              Including this information in the IPPT protects the integrity 
              of the association of the security target with a specific bundle. 
            </t>
          </dd>
          <dt pn="section-3.2-2.7">Other fields of the security target</dt>
          <dd pn="section-3.2-2.8">
            <t indent="0" pn="section-3.2-2.8.1"> 
              The other fields of the security target include block 
              identification and processing information. Changing this 
              information changes how the security target is treated by nodes 
              in the network even when the
              "user data" of the security target are otherwise unchanged. 
            </t>
            <t indent="0" pn="section-3.2-2.8.2"> 
              For example, if the block processing control flags of a security 
              target are different at a security verifier than they were 
              originally set at the security source, then the policy for
              handling the security target has been modified. 
            </t>
            <t indent="0" pn="section-3.2-2.8.3"> 
              Including this information in the IPPT protects the integrity
              of the policy and identification of the security target data.
            </t>
          </dd>
          <dt pn="section-3.2-2.9">Other fields of the BIB</dt>
          <dd pn="section-3.2-2.10">
            <t indent="0" pn="section-3.2-2.10.1"> 
              The other fields of the BIB include block identification 
              and processing information. 
              Changing this information changes how the BIB
              is treated by nodes in the network, even when other aspects of the
              BIB are unchanged. 
            </t>
            <t indent="0" pn="section-3.2-2.10.2"> 
              For example, if the block processing control flags of the BIB are 
              different at a security verifier than they were 
              originally set at the security source, then the policy for
              handling the BIB has been modified. 
            </t>
            <t indent="0" pn="section-3.2-2.10.3"> 
              Including this information in the IPPT protects the integrity
              of the policy and identification of the security service in the bundle. 
            </t>
            <aside pn="section-3.2-2.10.4">
              <t indent="0" pn="section-3.2-2.10.4.1"> 
              NOTE: The security context identifier and security context
              parameters of the security block are not included in the IPPT
              because these parameters, by definition, are required to verify or 
              accept the security service. Successful verification at security
              verifiers and security acceptors implies that these parameters
              were unchanged since being specified at the security source.
              This is the case because keys cannot be reused across security
              contexts and because the integrity scope flags used to define
              the IPPT are included in the IPPT itself. 
              </t>
            </aside>
          </dd>
        </dl>
        <t indent="0" pn="section-3.2-3">
          The scope of the BIB-HMAC-SHA2 security context is configured using
          an optional security context parameter.
        </t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-3.3">
        <name slugifiedName="name-parameters">Parameters</name>
        <t indent="0" pn="section-3.3-1">
          BIB-HMAC-SHA2 can be parameterized to select SHA-2 variants, 
          communicate key information, and define the scope of the IPPT.
        </t>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-3.3.1">
          <name slugifiedName="name-sha-variant">SHA Variant</name>
          <t indent="0" pn="section-3.3.1-1">
            This optional parameter identifies which variant of the SHA-2 
            algorithm is to be used in the generation of the authentication code. 
          </t>
          <t indent="0" pn="section-3.3.1-2">
            This value <bcp14>MUST</bcp14> be encoded as a CBOR unsigned integer. 
          </t>
          <t indent="0" pn="section-3.3.1-3">
            Valid values for this parameter are as follows.
          </t>
          <table align="center" anchor="sha_var" pn="table-1">
            <name slugifiedName="name-sha-variant-parameter-value">SHA Variant Parameter Values</name>
            <thead>
              <tr>
                <th align="center" colspan="1" rowspan="1">Value</th>
                <th align="center" colspan="1" rowspan="1">Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="center" colspan="1" rowspan="1">5</td>
                <td align="left" colspan="1" rowspan="1">HMAC 256/256 as defined in Table 7 ("HMAC Algorithm Values") of <xref target="RFC8152" format="default" sectionFormat="of" derivedContent="RFC8152"/></td>
              </tr>
              <tr>
                <td align="center" colspan="1" rowspan="1">6</td>
                <td align="left" colspan="1" rowspan="1">HMAC 384/384 as defined in Table 7 ("HMAC Algorithm Values") of <xref target="RFC8152" format="default" sectionFormat="of" derivedContent="RFC8152"/></td>
              </tr>
              <tr>
                <td align="center" colspan="1" rowspan="1">7</td>
                <td align="left" colspan="1" rowspan="1">HMAC 512/512 as defined in Table 7 ("HMAC Algorithm Values") of <xref target="RFC8152" format="default" sectionFormat="of" derivedContent="RFC8152"/></td>
              </tr>
            </tbody>
          </table>
          <t indent="0" pn="section-3.3.1-5">
            When not provided, implementations <bcp14>SHOULD</bcp14> assume a value of 6
            (indicating use of HMAC 384/384), unless an alternate default is 
            established by local security policy at the security source, verifiers,
            or acceptor of this integrity service. 
          </t>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-3.3.2">
          <name slugifiedName="name-wrapped-key">Wrapped Key</name>
          <t indent="0" pn="section-3.3.2-1">        
	    This optional parameter contains the output of the AES key wrap function as defined in <xref target="RFC3394" format="default" sectionFormat="of" derivedContent="RFC3394"/>.  Specifically, this parameter holds the ciphertext produced when running this key wrap algorithm with the
	    input string being the symmetric HMAC 
            key used to generate the security results present in the security block. 
            The value of this parameter is used as input to the AES key wrap authenticated
            decryption function at security verifiers and security acceptors to determine 
            the symmetric HMAC key needed for the proper validation of the security results 
            in the security block. 
          </t>
          <t indent="0" pn="section-3.3.2-2">
            This value <bcp14>MUST</bcp14> be encoded as a CBOR byte string. 
          </t>
          <t indent="0" pn="section-3.3.2-3">
            If this parameter is not present, then security verifiers 
            and acceptors <bcp14>MUST</bcp14> determine the proper key as a function of their local BPSec policy 
            and configuration. 
          </t>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-3.3.3">
          <name slugifiedName="name-integrity-scope-flags">Integrity Scope Flags</name>
          <t indent="0" pn="section-3.3.3-1">
            This optional parameter contains a series of flags that describe
            what information is to be included with the block-type-specific data 
            when constructing the IPPT value.
          </t>
          <t indent="0" pn="section-3.3.3-2">
            This value <bcp14>MUST</bcp14> be represented as a CBOR unsigned
            integer, the value of which <bcp14>MUST</bcp14> be processed as a 16-bit field.                           
            The maximum value of this field, as a CBOR unsigned integer, <bcp14>MUST</bcp14> be
            65535.
          </t>
          <t indent="0" pn="section-3.3.3-3">When not provided, implementations <bcp14>SHOULD</bcp14> assume a value of 7 (indicating all assigned fields), unless an alternate default is established by local security policy at the security source,  verifier, or acceptor of this integrity service.
          </t>
          <t indent="0" pn="section-3.3.3-4">
            Implementations <bcp14>MUST</bcp14> set reserved and unassigned bits in this 
            field to 0 when constructing these flags at a security source. 
            Once set, the value of this field <bcp14>MUST NOT</bcp14> be altered until the
            security service is completed at the security acceptor in the
            network and removed from the bundle. 
          </t>
          <t indent="0" pn="section-3.3.3-5">
            Bits in this field represent additional information to be included
            when generating an integrity signature over the security target.
            These bits are defined as follows. 
          </t>
          <dl indent="3" newline="false" spacing="normal" pn="section-3.3.3-6">
            <dt pn="section-3.3.3-6.1">Bit 0 (the low-order bit, 0x0001):</dt>
            <dd pn="section-3.3.3-6.2">Include primary block flag</dd>
            <dt pn="section-3.3.3-6.3">Bit 1 (0x0002):</dt>
            <dd pn="section-3.3.3-6.4">Include target header flag</dd>
            <dt pn="section-3.3.3-6.5">Bit 2 (0x0004):</dt>
            <dd pn="section-3.3.3-6.6">Include security header flag</dd>
            <dt pn="section-3.3.3-6.7">Bits 3-7:</dt>
            <dd pn="section-3.3.3-6.8">Reserved</dd>
            <dt pn="section-3.3.3-6.9">Bits 8-15:</dt>
            <dd pn="section-3.3.3-6.10">Unassigned</dd>
          </dl>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-3.3.4">
          <name slugifiedName="name-enumerations">Enumerations</name>
          <t indent="0" pn="section-3.3.4-1">
            The BIB-HMAC-SHA2 security context parameters are listed in 
            <xref target="bib_parm_table" format="default" sectionFormat="of" derivedContent="Table 2"/>. In this table, the "Parm Id" column 
            refers to the expected parameter identifier described in Section
             <xref target="RFC9172" section="3.10" sectionFormat="bare" format="default" derivedLink="https://rfc-editor.org/rfc/rfc9172#section-3.10" derivedContent="RFC9172">"Parameter 
             and Result Identification"</xref> of <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/>.
          </t>
          <t indent="0" pn="section-3.3.4-2">
            An empty "Default Value" column  indicates that the
            security context parameter does not have a default value. 
          </t>
          <table align="center" anchor="bib_parm_table" pn="table-2">
            <name slugifiedName="name-bib-hmac-sha2-security-cont">BIB-HMAC-SHA2 Security Context Parameters</name>
            <thead>
              <tr>
                <th align="center" colspan="1" rowspan="1">Parm Id</th>
                <th align="left" colspan="1" rowspan="1">Parm Name</th>
                <th align="left" colspan="1" rowspan="1">CBOR Encoding Type</th>
                <th align="left" colspan="1" rowspan="1">Default Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="center" colspan="1" rowspan="1">1</td>
                <td align="left" colspan="1" rowspan="1">SHA Variant</td>
                <td align="left" colspan="1" rowspan="1">unsigned integer</td>
                <td align="center" colspan="1" rowspan="1">6</td>
              </tr>
              <tr>
                <td align="center" colspan="1" rowspan="1">2</td>
                <td align="left" colspan="1" rowspan="1">Wrapped Key</td>
                <td align="left" colspan="1" rowspan="1">byte string</td>
                <td align="center" colspan="1" rowspan="1"/>
              </tr>
              <tr>
                <td align="center" colspan="1" rowspan="1">3</td>
                <td align="left" colspan="1" rowspan="1">Integrity Scope Flags</td>
                <td align="left" colspan="1" rowspan="1">unsigned integer</td>
                <td align="center" colspan="1" rowspan="1">7</td>
              </tr>
            </tbody>
          </table>
        </section>
      </section>
      <section anchor="bib_results" numbered="true" toc="include" removeInRFC="false" pn="section-3.4">
        <name slugifiedName="name-results">Results</name>
        <t indent="0" pn="section-3.4-1">            
            The BIB-HMAC-SHA2 security context results are listed in 
            <xref target="bib_res_table" format="default" sectionFormat="of" derivedContent="Table 3"/>. In this table, the "Result Id" column 
            refers to the expected result identifier described in Section
             <xref target="RFC9172" section="3.10" sectionFormat="bare" format="default" derivedLink="https://rfc-editor.org/rfc/rfc9172#section-3.10" derivedContent="RFC9172">"Parameter 
             and Result Identification"</xref> of <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/>.
        </t>
        <table align="center" anchor="bib_res_table" pn="table-3">
          <name slugifiedName="name-bib-hmac-sha2-security-resu">BIB-HMAC-SHA2 Security Results</name>
          <thead>
            <tr>
              <th align="center" colspan="1" rowspan="1">Result Id</th>
              <th align="center" colspan="1" rowspan="1">Result Name</th>
              <th align="center" colspan="1" rowspan="1">CBOR Encoding Type</th>
              <th align="center" colspan="1" rowspan="1">Description</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="center" colspan="1" rowspan="1">1</td>
              <td align="center" colspan="1" rowspan="1">Expected HMAC</td>
              <td align="center" colspan="1" rowspan="1">byte string</td>
              <td align="left" colspan="1" rowspan="1">The output of the HMAC calculation at the security source.</td>
            </tr>
          </tbody>
        </table>
      </section>
      <section anchor="bib_key_mgmt" numbered="true" toc="include" removeInRFC="false" pn="section-3.5">
        <name slugifiedName="name-key-considerations">Key Considerations</name>
        <t indent="0" pn="section-3.5-1">
          HMAC keys used with this context <bcp14>MUST</bcp14> be symmetric and <bcp14>MUST</bcp14> have 
          a key length equal to the output of the HMAC. For this reason, HMAC 
          key lengths will be integers divisible by 8 bytes, and special padding-aware 
          AES key wrap algorithms are not needed.
        </t>
        <t indent="0" pn="section-3.5-2">
          It is assumed that any security verifier or security acceptor
          performing an integrity verification can determine the proper HMAC
          key to be used. Potential sources of the HMAC key include (but are
          not limited to) the following:

        </t>
        <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-3.5-3">
          <li pn="section-3.5-3.1"> Pre-placed keys selected based on local policy. </li>
          <li pn="section-3.5-3.2"> Keys extracted from material carried in the BIB. </li>
          <li pn="section-3.5-3.3"> Session keys negotiated via a mechanism external to the BIB. </li>
        </ul>
        <t indent="0" pn="section-3.5-4">
          When an AES Key Wrap (AES-KW) <xref target="RFC3394" format="default" sectionFormat="of" derivedContent="RFC3394"/> wrapped key is present in a security block, it is
          assumed that security verifiers and security acceptors can
          independently determine the key encryption key (KEK) used in the
          wrapping of the symmetric HMAC key.
        </t>
        <t indent="0" pn="section-3.5-5">
          As discussed in <xref target="SecCons" format="default" sectionFormat="of" derivedContent="Section 6"/> and emphasized here, it is
          strongly recommended that keys be protected once generated, both
          when they are stored and when they are transmitted. 
        </t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-3.6">
        <name slugifiedName="name-security-processing-conside">Security Processing Considerations</name>
        <t indent="0" pn="section-3.6-1">
          An HMAC calculated over the same IPPT with the same key will always
          have the same value.  This regularity can lead to practical
          side-channel attacks whereby an attacker could produce known
          plaintext, guess at an HMAC tag, and observe the behavior of a
          verifier.  With a modest number of trials, a side-channel attack
          could produce an HMAC tag for attacker-provided plaintext without
          the attacker ever knowing the HMAC key.
        </t>
        <t indent="0" pn="section-3.6-2">
          A common method of observing the behavior of a verifier is precise
          analysis of the timing associated with comparisons. Therefore, one
          way to prevent behavior analysis of this type is to ensure that 
          any comparisons of the supplied and expected authentication tag occur
          in constant time. 
        </t>
        <t indent="0" pn="section-3.6-3">
          A constant-time comparison function <bcp14>SHOULD</bcp14> be used for the comparison
          of authentication tags by any implementation of this security context.
          In cases where such a function is difficult or impossible to use,
          the impact of side-channel attacks (in general) and timing attacks (specifically)
          need to be considered as part of the implementation.
        </t>
      </section>
      <section anchor="bib_canon" numbered="true" toc="include" removeInRFC="false" pn="section-3.7">
        <name slugifiedName="name-canonicalization-algorithms">Canonicalization Algorithms</name>
        <t indent="0" pn="section-3.7-1">
          This section defines the canonicalization algorithm used to prepare
          the IPPT input to the BIB-HMAC-SHA2 integrity mechanism. The
          construction of the IPPT depends on the settings of the
          integrity scope flags that can be provided as part of customizing
          the behavior of this security context. 
        </t>
        <t indent="0" pn="section-3.7-2">
          In all cases, the canonical form of any portion of an extension block
          <bcp14>MUST</bcp14> be created as described in <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/>.
          The canonicalization algorithms defined in <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/>  
          adhere to the canonical forms for extension blocks defined in 
          <xref target="RFC9171" format="default" sectionFormat="of" derivedContent="RFC9171"/> but resolve ambiguities related to
          how values are represented in CBOR.         
        </t>
        <t indent="0" pn="section-3.7-3">
          The IPPT is constructed using the following process. While integrity 
          scope flags might not be included in the BIB representing the 
          security operation, they <bcp14>MUST</bcp14> be included in the IPPT value itself. 

        </t>
        <ol spacing="normal" type="1" indent="adaptive" start="1" pn="section-3.7-4"><li pn="section-3.7-4.1" derivedCounter="1.">
              The canonical form of the IPPT starts as the CBOR encoding of the 
              integrity scope flags in which all unset flags, reserved bits, 
              and unassigned bits have been set to 0.  For example, if the
              primary block flag, target header flag, and security header flag are 
              each set, then the initial value of the canonical form of the
              IPPT will be 0x07. 
            </li>
          <li pn="section-3.7-4.2" derivedCounter="2.">
If the primary block flag of the integrity scope flags is set to 1 and the
security target is not the bundle's primary block, then a canonical form of
the bundle's primary block <bcp14>MUST</bcp14> be calculated and the result
appended to the IPPT.
            </li>
          <li pn="section-3.7-4.3" derivedCounter="3.">
If the target header flag of the integrity scope flags is set to 1 and the
security target is not the bundle's primary block, then the canonical form of
the block type code, block number, and block processing control flags
associated with the security target <bcp14>MUST</bcp14> be calculated and, in
that order, appended to the IPPT.
            </li>
          <li pn="section-3.7-4.4" derivedCounter="4.">
              If the security header flag of the integrity scope flags is set
              to 1, then the canonical form of the block type code, 
              block number, and block processing control flags associated with 
              the BIB <bcp14>MUST</bcp14> be calculated and, in that order, appended to the IPPT.
            </li>
          <li pn="section-3.7-4.5" derivedCounter="5.">
The canonical form of the security target <bcp14>MUST</bcp14> be calculated
and appended to the IPPT. If the security target is the primary block, this is
the canonical form of the primary block. Otherwise, this is the canonical form
of the block-type-specific data of the security target.
            </li>
        </ol>
        <aside pn="section-3.7-5">
          <t indent="0" pn="section-3.7-5.1">NOTE: When the security target is the bundle's primary block, the
	  canonicalization steps associated with the primary block flag and
	  the target header flag are skipped. Skipping primary block flag
	  processing, in this case, avoids adding the bundle's primary block
	  twice in the IPPT calculation. Skipping target header flag
	  processing, in this case, is necessary because the primary block of
	  a bundle does not have the expected elements of a block header such
	  as block number and block processing control flags.
          </t>
        </aside>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-3.8">
        <name slugifiedName="name-processing">Processing</name>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-3.8.1">
          <name slugifiedName="name-keyed-hash-generation">Keyed Hash Generation</name>
          <t indent="0" pn="section-3.8.1-1">
            During keyed hash generation, two inputs are prepared for
            the appropriate HMAC/SHA2 algorithm: the HMAC key and the IPPT.
            These data items <bcp14>MUST</bcp14> be generated as follows.

          </t>
          <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-3.8.1-2">
            <li pn="section-3.8.1-2.1">
                The HMAC key <bcp14>MUST</bcp14> have the appropriate length
                as required by local security policy.  The key can be
                generated specifically for this integrity service, given as
                part of local security policy, or obtained through some other
                key management mechanism as discussed in <xref target="bib_key_mgmt" format="default" sectionFormat="of" derivedContent="Section 3.5"/>.
              </li>
            <li pn="section-3.8.1-2.2">
                Prior to the generation of the IPPT, if a Cyclic Redundancy Check (CRC) value is present
                for the target block of the BIB, then that CRC value <bcp14>MUST</bcp14> be
                removed from the target block. This involves both removing the
                CRC value from the target block and setting the CRC type field
                of the target block to "no CRC is present."
              </li>
            <li pn="section-3.8.1-2.3">
                Once CRC information is removed, the IPPT <bcp14>MUST</bcp14> be generated as 
                discussed in <xref target="bib_canon" format="default" sectionFormat="of" derivedContent="Section 3.7"/>.
              </li>
          </ul>
          <t indent="0" pn="section-3.8.1-3">
            Upon successful hash generation, the following action <bcp14>MUST</bcp14> occur.

          </t>
          <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-3.8.1-4">
            <li pn="section-3.8.1-4.1">
                The keyed hash produced by the HMAC/SHA2 variant <bcp14>MUST</bcp14> be added 
                as a security result for the BIB representing the security
                operation on this security target, as discussed
                in <xref target="bib_results" format="default" sectionFormat="of" derivedContent="Section 3.4"/>.
              </li>
          </ul>
          <t indent="0" pn="section-3.8.1-5">
            Finally, the BIB containing information about this security operation
            <bcp14>MUST</bcp14> be updated as follows. These operations can occur in any order.
          </t>
          <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-3.8.1-6">
            <li pn="section-3.8.1-6.1">
                The security context identifier for the BIB <bcp14>MUST</bcp14> be set to the context
                identifier for BIB-HMAC-SHA2.
              </li>
            <li pn="section-3.8.1-6.2">
                Any local flags used to generate the IPPT <bcp14>MUST</bcp14> be placed in
                the integrity scope flags security context parameter for the BIB unless
                these flags are expected to be correctly configured at security
                verifiers and acceptors in the network.
              </li>
            <li pn="section-3.8.1-6.3">
                The HMAC key <bcp14>MAY</bcp14> be included as a security context parameter, in which case
                it <bcp14>MUST</bcp14> be wrapped using the AES key wrap function as defined in <xref target="RFC3394" format="default" sectionFormat="of" derivedContent="RFC3394"/> and
                the results of the wrapping added as the wrapped key 
                security context parameter for the BIB.
              </li>
            <li pn="section-3.8.1-6.4">
                The SHA variant used by this security context <bcp14>SHOULD</bcp14> be added as
                the SHA variant security context parameter for the BIB if it differs from 
                the default key length. Otherwise, this parameter <bcp14>MAY</bcp14> be
                omitted if doing so provides a useful reduction in message sizes.
              </li>
          </ul>
          <t indent="0" pn="section-3.8.1-7">
            Problems encountered in the keyed hash generation <bcp14>MUST</bcp14> be 
            processed in accordance with local BPSec security policy.
          </t>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-3.8.2">
          <name slugifiedName="name-keyed-hash-verification">Keyed Hash Verification</name>
          <t indent="0" pn="section-3.8.2-1">
            During keyed hash verification, the input of the security target 
            and an HMAC key are provided to the appropriate HMAC/SHA2 algorithm. 
          </t>
          <t indent="0" pn="section-3.8.2-2">
            During keyed hash verification, two inputs are prepared for 
            the appropriate HMAC/SHA2 algorithm: the HMAC key and the IPPT.
            These data items <bcp14>MUST</bcp14> be generated as follows.

          </t>
          <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-3.8.2-3">
            <li pn="section-3.8.2-3.1">
                The HMAC key <bcp14>MUST</bcp14> be derived using the wrapped key 
                security context parameter if such a parameter is included in the
                security context parameters of the BIB. Otherwise, this key
                <bcp14>MUST</bcp14> be derived in accordance with security policy at the
                verifying node as discussed in <xref target="bib_key_mgmt" format="default" sectionFormat="of" derivedContent="Section 3.5"/>.
              </li>
            <li pn="section-3.8.2-3.2">
                The IPPT <bcp14>MUST</bcp14> be generated as discussed in <xref target="bib_canon" format="default" sectionFormat="of" derivedContent="Section 3.7"/> 
                with the value of integrity scope flags being taken from the 
                integrity scope flags security context parameter. If the 
                integrity scope flags parameter is not included in the 
                security context parameters, then these flags <bcp14>MAY</bcp14> be derived 
                from local security policy. 
              </li>
          </ul>
          <t indent="0" pn="section-3.8.2-4"> 
            The calculated HMAC output <bcp14>MUST</bcp14> be compared to the expected HMAC
            output encoded in the security results of the BIB for the security
            target. If the calculated HMAC and expected HMAC are
            identical, the verification <bcp14>MUST</bcp14> be considered a success. Otherwise,
            the verification <bcp14>MUST</bcp14> be considered a failure.
          </t>
          <t indent="0" pn="section-3.8.2-5">
            If the verification fails or otherwise experiences an error or if any 
            needed parameters are missing, then
            the verification <bcp14>MUST</bcp14> be treated as failed and processed in accordance 
            with local security policy.
          </t>
          <t indent="0" pn="section-3.8.2-6">
            This security service is removed from the bundle at the
            security acceptor as required by the BPSec specification <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/>. If the
            security acceptor is not the bundle destination and if no other
            integrity service is being applied to the target block, then a
            CRC <bcp14>MUST</bcp14> be included for the target block. The CRC type, as determined
            by policy, is set in the target block's CRC type field, and the 
            corresponding CRC value is added as the CRC field for that block.
          </t>
        </section>
      </section>
    </section>
    <section numbered="true" toc="include" anchor="second-context" removeInRFC="false" pn="section-4">
      <name slugifiedName="name-security-context-bcb-aes-gc">Security Context BCB-AES-GCM</name>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-4.1">
        <name slugifiedName="name-overview-2">Overview</name>
        <t indent="0" pn="section-4.1-1">
          The BCB-AES-GCM security context replaces the block-type-specific data 
          field of its security target with ciphertext generated using the 
          Advanced Encryption Standard (AES) cipher operating in Galois/Counter Mode
          (GCM) <xref target="AES-GCM" format="default" sectionFormat="of" derivedContent="AES-GCM"/>. The use of AES-GCM was selected
          as the cipher suite for this confidentiality mechanism for several reasons:

        </t>
        <ol spacing="normal" type="1" indent="adaptive" start="1" pn="section-4.1-2"><li pn="section-4.1-2.1" derivedCounter="1."> The selection of a symmetric-key cipher suite allows for relatively smaller
              keys than asymmetric-key cipher suites.
            </li>
          <li pn="section-4.1-2.2" derivedCounter="2."> The selection of a symmetric-key cipher suite allows this security context to
              be used in places where an asymmetric-key infrastructure (such as a public key
              infrastructure) might be impractical.              
            </li>
          <li pn="section-4.1-2.3" derivedCounter="3.">
              The use of the Galois/Counter Mode produces ciphertext with the same size as
              the plaintext making the replacement of target block information easier as 
              length fields do not need to be changed.
            </li>
          <li pn="section-4.1-2.4" derivedCounter="4.">
              The AES-GCM cipher suite provides authenticated encryption, as required by the
              BPSec protocol. 
            </li>
        </ol>
        <t indent="0" pn="section-4.1-3">
          Additionally, the BCB-AES-GCM security context generates an
          authentication tag based on the plaintext value of the block-type-specific
          data and other additional authenticated data (AAD) that might be specified
          via parameters to this security context. 
        </t>
        <t indent="0" pn="section-4.1-4">
          This security context supports two variants of AES-GCM, based on 
          the supported length of the symmetric key.  These variants 
          correspond to A128GCM and A256GCM as
          defined in Table 9 ("Algorithm Value for AES-GCM") of <xref target="RFC8152" format="default" sectionFormat="of" derivedContent="RFC8152"/>. 
        </t>
        <t indent="0" pn="section-4.1-5">
          The BCB-AES-GCM security context <bcp14>MUST</bcp14> have the security context identifier 
          specified in <xref target="sc_ids" format="default" sectionFormat="of" derivedContent="Section 5.1"/>.
        </t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-4.2">
        <name slugifiedName="name-scope-2">Scope</name>
        <t indent="0" pn="section-4.2-1">
          There are two scopes associated with BCB-AES-GCM: the scope of the 
          confidentiality service and the scope of the authentication
          service. The first defines the set of information provided to the 
          AES-GCM cipher for the purpose of producing ciphertext. The second
          defines the set of information used to generate an authentication tag.         
        </t>
        <t indent="0" pn="section-4.2-2">
          The scope of the confidentiality service defines the set of information
          provided to the AES-GCM cipher for the purpose of producing ciphertext.
          This <bcp14>MUST</bcp14> be the full set of plaintext contained in the 
          block-type-specific data field of the security target.
        </t>
        <t indent="0" pn="section-4.2-3">
          The scope of the authentication service defines the set of information
          used to generate an authentication tag carried with the security
          block. This information contains all data protected by the
          confidentiality service and the scope flags used to identify other
          optional information; it <bcp14>MAY</bcp14> include other information 
          (additional authenticated data), as follows.

        </t>
        <dl newline="true" spacing="normal" indent="3" pn="section-4.2-4">
          <dt pn="section-4.2-4.1">Primary block</dt>
          <dd pn="section-4.2-4.2">
            <t indent="0" pn="section-4.2-4.2.1"> 
              The primary block identifies a bundle, and once 
              created, the contents of this block are immutable. Changes to 
              the primary block associated with the security target indicate
              that the security target (and BCB) might no longer be in the
              correct bundle. 
            </t>
            <t indent="0" pn="section-4.2-4.2.2"> 
              For example, if a security target and associated BCB are copied
              from one bundle to another bundle, the BCB might still be able to
              decrypt the security target even though these blocks were never
              intended to exist in the copied-to bundle. 
            </t>
            <t indent="0" pn="section-4.2-4.2.3"> 
              Including this information as part of additional authenticated data
              ensures that the security target (and security block) appear in the
              same bundle at the time of decryption as at the time of encryption.
            </t>
          </dd>
          <dt pn="section-4.2-4.3">Other fields of the security target</dt>
          <dd pn="section-4.2-4.4">
            <t indent="0" pn="section-4.2-4.4.1"> 
              The other fields of the security target include block 
              identification and processing information. Changing this 
              information changes how the security target is treated by nodes 
              in the network even when the "user data" of the security target 
              are otherwise unchanged. 
            </t>
            <t indent="0" pn="section-4.2-4.4.2"> 
              For example, if the block processing control flags of a security 
              target are different at a security verifier than they were 
              originally set at the security source, then the policy for
              handling the security target has been modified. 
            </t>
            <t indent="0" pn="section-4.2-4.4.3"> 
              Including this information as part of additional authenticated data
              ensures that the ciphertext in the security target will not be used
              with a different set of block policy than originally set at the
              time of encryption.
            </t>
          </dd>
          <dt pn="section-4.2-4.5">Other fields of the BCB</dt>
          <dd pn="section-4.2-4.6">
            <t indent="0" pn="section-4.2-4.6.1"> 
              The other fields of the BCB include block identification and 
              processing information. Changing this information changes how the BCB
              is treated by nodes in the network, even when other aspects of the
              BCB are unchanged. 
            </t>
            <t indent="0" pn="section-4.2-4.6.2"> 
              For example, if the block processing control flags of the BCB are 
              different at a security acceptor than they were 
              originally set at the security source, then the policy for
              handling the BCB has been modified. 
            </t>
            <t indent="0" pn="section-4.2-4.6.3"> 
              Including this information as part of additional authenticated data
              ensures that the policy and identification of the security service 
              in the bundle has not changed.
            </t>
            <aside pn="section-4.2-4.6.4">
              <t indent="0" pn="section-4.2-4.6.4.1"> 
              NOTE: The security context identifier and security context
              parameters of the security block are not included as additional
              authenticated data because these parameters, by definition, are
              those needed to verify or accept the security service. Therefore,
              it is expected that changes to these values would result in failures
              at security verifiers and security acceptors. This is the case 
              because keys cannot be reused across security
              contexts and because the AAD scope flags used to identify
              the AAD are included in the AAD. 
              </t>
            </aside>
          </dd>
        </dl>
        <t indent="0" pn="section-4.2-5">
          The scope of the BCB-AES-GCM security context is configured using
          an optional security context parameter.
        </t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-4.3">
        <name slugifiedName="name-parameters-2">Parameters</name>
        <t indent="0" pn="section-4.3-1">
          BCB-AES-GCM can be parameterized to specify the AES variant, 
          initialization vector, key information, and identify additional
          authenticated data.
        </t>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-4.3.1">
          <name slugifiedName="name-initialization-vector-iv">Initialization Vector (IV)</name>
          <t indent="0" pn="section-4.3.1-1">
            This optional parameter identifies the initialization vector (IV) 
            used to initialize the AES-GCM cipher. 
          </t>
          <t indent="0" pn="section-4.3.1-2">
            The length of the initialization vector, prior to any CBOR encoding,
            <bcp14>MUST</bcp14> be between 8-16 bytes. A value of 12 bytes <bcp14>SHOULD</bcp14> be used
            unless local security policy requires a different length.
          </t>
          <t indent="0" pn="section-4.3.1-3">
            This value <bcp14>MUST</bcp14> be encoded as a CBOR byte string.
          </t>
          <t indent="0" pn="section-4.3.1-4">
            The initialization vector can have any value, with the caveat that a 
            value <bcp14>MUST NOT</bcp14> be reused for multiple encryptions using the same 
            encryption key. This value <bcp14>MAY</bcp14> be reused when encrypting with different 
            keys. For example, if each encryption operation using BCB-AES-GCM
            uses a newly generated key, then the same IV can be reused.
          </t>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-4.3.2">
          <name slugifiedName="name-aes-variant">AES Variant</name>
          <t indent="0" pn="section-4.3.2-1">
            This optional parameter identifies the AES variant being used for
            the AES-GCM encryption, where the variant is identified by the length
            of key used.
          </t>
          <t indent="0" pn="section-4.3.2-2">
            This value <bcp14>MUST</bcp14> be encoded as a CBOR unsigned integer. 
          </t>
          <t indent="0" pn="section-4.3.2-3">
            Valid values for this parameter are as follows.
          </t>
          <table align="center" pn="table-4">
            <name slugifiedName="name-aes-variant-parameter-value">AES Variant Parameter Values</name>
            <thead>
              <tr>
                <th align="center" colspan="1" rowspan="1">Value</th>
                <th align="center" colspan="1" rowspan="1">Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="center" colspan="1" rowspan="1">1</td>
                <td align="left" colspan="1" rowspan="1">A128GCM as defined in Table 9 ("Algorithm Value for AES-GCM") of <xref target="RFC8152" format="default" sectionFormat="of" derivedContent="RFC8152"/></td>
              </tr>
              <tr>
                <td align="center" colspan="1" rowspan="1">3</td>
                <td align="left" colspan="1" rowspan="1">A256GCM as defined in Table 9 ("Algorithm Value for AES-GCM") of <xref target="RFC8152" format="default" sectionFormat="of" derivedContent="RFC8152"/></td>
              </tr>
            </tbody>
          </table>
          <t indent="0" pn="section-4.3.2-5">
            When not provided, implementations <bcp14>SHOULD</bcp14> assume a value of 3
            (indicating use of A256GCM), unless an alternate default is 
            established by local security policy at the security source, verifier,
            or acceptor of this integrity service. 
          </t>
          <t indent="0" pn="section-4.3.2-6">
            Regardless of the variant, the generated authentication tag <bcp14>MUST</bcp14>
            always be 128 bits.
          </t>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-4.3.3">
          <name slugifiedName="name-wrapped-key-2">Wrapped Key</name>
          <t indent="0" pn="section-4.3.3-1">        
	    This optional parameter contains the output of the AES key wrap function as defined in <xref target="RFC3394" format="default" sectionFormat="of" derivedContent="RFC3394"/>.  Specifically, this parameter holds the ciphertext produced when running this key wrap algorithm with 
	    the input string being the symmetric AES key used to generate the security results 
            present in the security block. 
            The value of this parameter is used as input to the AES key wrap authenticated
            decryption function at security verifiers and security acceptors to determine 
            the symmetric AES key needed for the proper decryption of the security results 
            in the security block. 
          </t>
          <t indent="0" pn="section-4.3.3-2">
            This value <bcp14>MUST</bcp14> be encoded as a CBOR byte string. 
          </t>
          <t indent="0" pn="section-4.3.3-3">
            If this parameter is not present, then security verifiers 
            and acceptors <bcp14>MUST</bcp14> determine the proper key as a function of their local BPSec policy 
            and configuration. 
          </t>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-4.3.4">
          <name slugifiedName="name-aad-scope-flags">AAD Scope Flags</name>
          <t indent="0" pn="section-4.3.4-1">
            This optional parameter contains a series of flags that describe
            what information is to be included with the 
            block-type-specific data of the security target as part of
            additional authenticated data (AAD).
          </t>
          <t indent="0" pn="section-4.3.4-2">
            This value <bcp14>MUST</bcp14> be represented as a CBOR unsigned
            integer, the value of which <bcp14>MUST</bcp14> be processed as a 16-bit field.
            The maximum value of this field, as a CBOR unsigned integer, <bcp14>MUST</bcp14> be
            65535.
          </t>
          <t indent="0" pn="section-4.3.4-3">When not provided, implementations <bcp14>SHOULD</bcp14> assume a value of 7
	  (indicating all assigned fields), unless an alternate default is
	  established by local security policy at the security source,
	  verifier, or acceptor of this integrity service.
          </t>
          <t indent="0" pn="section-4.3.4-4">
            Implementations <bcp14>MUST</bcp14> set reserved and unassigned bits in this 
            field to 0 when constructing these flags at a security source. 
            Once set, the value of this field <bcp14>MUST NOT</bcp14> be altered until the
            security service is completed at the security acceptor in the
            network and removed from the bundle. 
          </t>
          <t indent="0" pn="section-4.3.4-5">
            Bits in this field represent additional information to be included
            when generating an integrity signature over the security target.
            These bits are defined as follows. 
          </t>
          <dl indent="3" newline="false" spacing="normal" pn="section-4.3.4-6">
            <dt pn="section-4.3.4-6.1">Bit 0 (the low-order bit, 0x0001):</dt>
            <dd pn="section-4.3.4-6.2">Include primary block flag</dd>
            <dt pn="section-4.3.4-6.3">Bit 1 (0x0002):</dt>
            <dd pn="section-4.3.4-6.4">Include target header flag</dd>
            <dt pn="section-4.3.4-6.5">Bit 2 (0x0004):</dt>
            <dd pn="section-4.3.4-6.6">Include security header flag</dd>
            <dt pn="section-4.3.4-6.7">Bits 3-7:</dt>
            <dd pn="section-4.3.4-6.8">Reserved</dd>
            <dt pn="section-4.3.4-6.9">Bits 8-15:</dt>
            <dd pn="section-4.3.4-6.10">Unassigned</dd>
          </dl>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-4.3.5">
          <name slugifiedName="name-enumerations-2">Enumerations</name>
          <t indent="0" pn="section-4.3.5-1">            
            The BCB-AES-GCM security context parameters are listed in 
            <xref target="bcb_parm_table" format="default" sectionFormat="of" derivedContent="Table 5"/>. In this table, the "Parm Id" column 
            refers to the expected parameter identifier described in Section
<xref target="RFC9172" section="3.10" sectionFormat="bare" format="default" derivedLink="https://rfc-editor.org/rfc/rfc9172#section-3.10" derivedContent="RFC9172">"Parameter 
             and Result Identification"</xref> of <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/>.
          </t>
          <t indent="0" pn="section-4.3.5-2">
            An empty "Default Value" column indicates that the
            security context parameter does not have a default value. 
          </t>
          <table align="center" anchor="bcb_parm_table" pn="table-5">
            <name slugifiedName="name-bcb-aes-gcm-security-contex">BCB-AES-GCM Security Context Parameters</name>
            <thead>
              <tr>
                <th align="center" colspan="1" rowspan="1">Parm Id</th>
                <th align="center" colspan="1" rowspan="1">Parm Name</th>
                <th align="center" colspan="1" rowspan="1">CBOR Encoding Type</th>
                <th align="center" colspan="1" rowspan="1">Default Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="center" colspan="1" rowspan="1">1</td>
                <td align="center" colspan="1" rowspan="1">Initialization Vector</td>
                <td align="center" colspan="1" rowspan="1">byte string</td>
                <td align="center" colspan="1" rowspan="1"/>
              </tr>
              <tr>
                <td align="center" colspan="1" rowspan="1">2</td>
                <td align="center" colspan="1" rowspan="1">AES Variant</td>
                <td align="center" colspan="1" rowspan="1">unsigned integer</td>
                <td align="center" colspan="1" rowspan="1">3</td>
              </tr>
              <tr>
                <td align="center" colspan="1" rowspan="1">3</td>
                <td align="center" colspan="1" rowspan="1">Wrapped Key</td>
                <td align="center" colspan="1" rowspan="1">byte string</td>
                <td align="center" colspan="1" rowspan="1"/>
              </tr>
              <tr>
                <td align="center" colspan="1" rowspan="1">4</td>
                <td align="center" colspan="1" rowspan="1">AAD Scope Flags</td>
                <td align="center" colspan="1" rowspan="1">unsigned integer</td>
                <td align="center" colspan="1" rowspan="1">7</td>
              </tr>
            </tbody>
          </table>
        </section>
      </section>
      <section anchor="bcb_results" numbered="true" toc="include" removeInRFC="false" pn="section-4.4">
        <name slugifiedName="name-results-2">Results</name>
        <t indent="0" pn="section-4.4-1">
        The BCB-AES-GCM security context produces a single security result
        carried in the security block: the authentication tag.
        </t>
        <t indent="0" pn="section-4.4-2">
        NOTES:
        </t>
        <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-4.4-3">
          <li pn="section-4.4-3.1">
            The ciphertext generated by the cipher suite is not considered a 
            security result as it is stored in the block-type-specific data field
            of the security target block. When operating in GCM mode, AES produces 
            ciphertext of the same size as its plaintext; therefore, 
            no additional logic is required to handle padding or overflow caused
            by the encryption in most cases.
          </li>
          <li pn="section-4.4-3.2">
            If the authentication tag can be separated from the ciphertext, then
            the tag <bcp14>MAY</bcp14> be separated and stored in the authentication tag 
            security result field. Otherwise, the security target block <bcp14>MUST</bcp14> be 
            resized to accommodate the additional 128 bits of authentication 
            tag included with the generated ciphertext replacing the 
            block-type-specific data field of the security target block. 
          </li>
        </ul>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-4.4.1">
          <name slugifiedName="name-authentication-tag">Authentication Tag</name>
          <t indent="0" pn="section-4.4.1-1">
          The authentication tag is generated by the cipher suite over the 
          security target plaintext input to the cipher suite as combined with 
          any optional additional authenticated data. This tag is used to ensure
          that the plaintext (and important information associated with the
          plaintext) is authenticated prior to decryption. 
          </t>
          <t indent="0" pn="section-4.4.1-2">
          If the authentication tag is included in the ciphertext placed
          in the security target block-type-specific data field, then this
          security result <bcp14>MUST NOT</bcp14> be included in the BCB for that security
          target.
          </t>
          <t indent="0" pn="section-4.4.1-3">
          The length of the authentication tag, prior to any CBOR encoding,
          <bcp14>MUST</bcp14> be 128 bits. 
          </t>
          <t indent="0" pn="section-4.4.1-4">
          This value <bcp14>MUST</bcp14> be encoded as a CBOR byte string.
          </t>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-4.4.2">
          <name slugifiedName="name-enumerations-3">Enumerations</name>
          <t indent="0" pn="section-4.4.2-1">          
          The BCB-AES-GCM security context results are listed in 
            <xref target="bcb_res_table" format="default" sectionFormat="of" derivedContent="Table 6"/>. In this table, the "Result Id" column 
            refers to the expected result identifier described in Section
             <xref target="RFC9172" section="3.10" sectionFormat="bare" format="default" derivedLink="https://rfc-editor.org/rfc/rfc9172#section-3.10" derivedContent="RFC9172">"Parameter 
             and Result Identification"</xref> of <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/>.
          </t>
          <table align="center" anchor="bcb_res_table" pn="table-6">
            <name slugifiedName="name-bcb-aes-gcm-security-result">BCB-AES-GCM Security Results</name>
            <thead>
              <tr>
                <th align="center" colspan="1" rowspan="1">Result Id</th>
                <th align="center" colspan="1" rowspan="1">Result Name</th>
                <th align="center" colspan="1" rowspan="1">CBOR Encoding Type</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="center" colspan="1" rowspan="1">1</td>
                <td align="center" colspan="1" rowspan="1">Authentication Tag</td>
                <td align="center" colspan="1" rowspan="1">byte string</td>
              </tr>
            </tbody>
          </table>
        </section>
      </section>
      <section anchor="bcb_key_mgmt" numbered="true" toc="include" removeInRFC="false" pn="section-4.5">
        <name slugifiedName="name-key-considerations-2">Key Considerations</name>
        <t indent="0" pn="section-4.5-1">
        Keys used with this context <bcp14>MUST</bcp14> be symmetric and <bcp14>MUST</bcp14> have 
        a key length equal to the key length defined in the security
        context parameters or as defined by local security policy at
        security verifiers and acceptors. For this reason, content-encrypting 
        key lengths will be integers divisible by 8 bytes, and special padding-aware AES
        key wrap algorithms are not needed.
        </t>
        <t indent="0" pn="section-4.5-2">
        It is assumed that any security verifier or security acceptor
        can determine the proper key to be used. Potential sources of the key 
        include (but are not limited to) the following. 

        </t>
        <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-4.5-3">
          <li pn="section-4.5-3.1">Pre-placed keys selected based on local policy. </li>
          <li pn="section-4.5-3.2">Keys extracted from material carried in the BCB. </li>
          <li pn="section-4.5-3.3">Session keys negotiated via a mechanism external to the BCB. </li>
        </ul>
        <t indent="0" pn="section-4.5-4">
        When an AES-KW wrapped key is present in a security block, it is assumed that
        security verifiers and security acceptors can independently determine the
        KEK used in the wrapping of the symmetric AES content-encrypting key. 
        </t>
        <t indent="0" pn="section-4.5-5">
        The security provided by block ciphers is reduced as more data is 
        processed with the same key. The total number of AES blocks processed with
        a single key for AES-GCM is recommended to be less than 2<sup>64</sup>, as
        described in Appendix B of <xref target="AES-GCM" format="default" sectionFormat="of" derivedContent="AES-GCM"/>. 
        </t>
        <t indent="0" pn="section-4.5-6">
        Additionally, there exist limits on the number of encryptions that
        can be performed with the same key.  The total number of invocations
        of the authenticated encryption function with a single key for
        AES-GCM is required to not exceed 2<sup>32</sup>, as described in Section
        8.3 of <xref target="AES-GCM" format="default" sectionFormat="of" derivedContent="AES-GCM"/>. 
        </t>
        <t indent="0" pn="section-4.5-7">
        As discussed in <xref target="SecCons" format="default" sectionFormat="of" derivedContent="Section 6"/> and emphasized here, it is
        strongly recommended that keys be protected once generated, both
        when they are stored and when they are transmitted. 
        </t>
      </section>
      <section anchor="GcmCons" numbered="true" toc="include" removeInRFC="false" pn="section-4.6">
        <name slugifiedName="name-gcm-considerations">GCM Considerations</name>
        <t indent="0" pn="section-4.6-1">
        The GCM cryptographic mode of AES has specific requirements that
        <bcp14>MUST</bcp14> be followed by implementers for the secure function of the
        BCB-AES-GCM security context. While these requirements are well
        documented in <xref target="AES-GCM" format="default" sectionFormat="of" derivedContent="AES-GCM"/>, some of them are
        repeated here for emphasis.
        </t>
        <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-4.6-2">
          <li pn="section-4.6-2.1">
            <t indent="0" pn="section-4.6-2.1.1">
            With the exception of the AES-KW function, the IVs 
            used by the BCB-AES-GCM security context are considered to
            be per-invocation IVs. 
            The pairing of a per-invocation IV and a security key
            <bcp14>MUST</bcp14> be unique. A per-invocation IV <bcp14>MUST NOT</bcp14> be used with a security
            key more than one time. If a per-invocation IV and key pair are repeated, then the GCM implementation
            is vulnerable to forgery attacks. Because the loss of integrity protection
            occurs with even a single reuse, this situation is often considered to have
            catastrophic security consequences. More information regarding 
            the importance of the uniqueness of the IV value can be found in 
            Appendix A of <xref target="AES-GCM" format="default" sectionFormat="of" derivedContent="AES-GCM"/>.
            </t>
            <t indent="0" pn="section-4.6-2.1.2">
            Methods of generating unique IV values are provided in Section 8
            of <xref target="AES-GCM" format="default" sectionFormat="of" derivedContent="AES-GCM"/>. For example, one method decomposes the
            IV value into a fixed field and an invocation field. The fixed field
            is a constant value associated with a device, and the invocation 
            field changes on each invocation (such as by incrementing an
            integer counter). Implementers <bcp14>SHOULD</bcp14> carefully read
            all relevant sections of <xref target="AES-GCM" format="default" sectionFormat="of" derivedContent="AES-GCM"/> when generating
            any mechanism to create unique IVs.
            </t>
          </li>
          <li pn="section-4.6-2.2">
            The AES-KW function used to wrap keys for the security contexts in this document uses 
            a single, globally constant IV input to the AES cipher 
            operation and thus is distinct from the aforementioned 
            requirement related to per-invocation IVs. 
          </li>
          <li pn="section-4.6-2.3">
            While any tag-based authentication mechanism has some likelihood
            of being forged, this probability is increased when using AES-GCM.
            In particular, short tag lengths combined with very long messages
            <bcp14>SHOULD</bcp14> be avoided when using this mode. The BCB-AES-GCM security 
            context requires the use of 128-bit authentication tags at all
            times. Concerns relating to the size of authentication tags is 
            discussed in Appendices B and C of <xref target="AES-GCM" format="default" sectionFormat="of" derivedContent="AES-GCM"/>.
          </li>
          <li pn="section-4.6-2.4">
            As discussed in Appendix B of <xref target="AES-GCM" format="default" sectionFormat="of" derivedContent="AES-GCM"/>, 
            implementations <bcp14>SHOULD</bcp14> limit the number of unsuccessful
            verification attempts for each key to reduce the likelihood 
            of guessing tag values. This type of check has potential 
            state-keeping issues when AES-KW is used, since an attacker
            could cause a large number of keys to be used at least
            once. 
          </li>
          <li pn="section-4.6-2.5">
            As discussed in Section
            <xref target="RFC9172" section="8" sectionFormat="bare" format="default" derivedLink="https://rfc-editor.org/rfc/rfc9172#section-8" derivedContent="RFC9172">"Security Considerations"</xref> of <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/>, delay-tolerant networks have a higher 
            occurrence of replay attacks due to the store-and-forward nature
            of the network. Because GCM has no inherent replay attack 
            protection, implementors <bcp14>SHOULD</bcp14> attempt to detect replay attacks 
            by using mechanisms such as those described in Appendix D of 
            <xref target="AES-GCM" format="default" sectionFormat="of" derivedContent="AES-GCM"/>.
          </li>
        </ul>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-4.7">
        <name slugifiedName="name-canonicalization-algorithms-2">Canonicalization Algorithms</name>
        <t indent="0" pn="section-4.7-1">
        This section defines the canonicalization algorithms used to prepare
        the inputs used to generate both the ciphertext and the
        authentication tag. 
        </t>
        <t indent="0" pn="section-4.7-2">
        In all cases, the canonical form of any portion of an extension block
        <bcp14>MUST</bcp14> be created as described in <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/>.
        The canonicalization algorithms defined in <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/>  
        adhere to the canonical forms for extension blocks defined in 
        <xref target="RFC9171" format="default" sectionFormat="of" derivedContent="RFC9171"/> but resolve ambiguities related to
        how values are represented in CBOR.         
        </t>
        <section anchor="bcb_canon_cipher" numbered="true" toc="include" removeInRFC="false" pn="section-4.7.1">
          <name slugifiedName="name-calculations-related-to-cip">Calculations Related to Ciphertext</name>
          <t indent="0" pn="section-4.7.1-1">
          The BCB operates over the block-type-specific data of 
          a block, but the BP always encodes these data within a 
          single, definite-length CBOR byte string. Therefore, the plaintext 
          used during encryption <bcp14>MUST</bcp14> be calculated as the value of the 
          block-type-specific data field of the security target 
          excluding the BP CBOR encoding. 
          </t>
          <t indent="0" pn="section-4.7.1-2">
          <xref target="enc_ex" format="default" sectionFormat="of" derivedContent="Table 7"/> shows two CBOR-encoded examples and the 
          plaintext that would be extracted from them. The first example
          is an unsigned integer, while the second is a byte string.
          </t>
          <table align="center" anchor="enc_ex" pn="table-7">
            <name slugifiedName="name-cbor-plaintext-extraction-e">CBOR Plaintext Extraction Examples</name>
            <thead>
              <tr>
                <th align="center" colspan="1" rowspan="1">CBOR Encoding (Hex)</th>
                <th align="center" colspan="1" rowspan="1">CBOR Part (Hex)</th>
                <th align="center" colspan="1" rowspan="1">Plaintext Part (Hex)</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="center" colspan="1" rowspan="1">18ED</td>
                <td align="center" colspan="1" rowspan="1">18</td>
                <td align="center" colspan="1" rowspan="1">ED</td>
              </tr>
              <tr>
                <td align="center" colspan="1" rowspan="1">C24CDEADBEEFDEADBEEFDEADBEEF</td>
                <td align="center" colspan="1" rowspan="1">C24C</td>
                <td align="center" colspan="1" rowspan="1">DEADBEEFDEADBEEFDEADBEEF</td>
              </tr>
            </tbody>
          </table>
          <t indent="0" pn="section-4.7.1-4"> 
          The ciphertext used during decryption <bcp14>MUST</bcp14> be calculated 
          as the single, definite-length CBOR byte string representing the 
          block-type-specific data field excluding the CBOR byte string 
          identifying byte and optional CBOR byte string length field. 
          </t>
          <t indent="0" pn="section-4.7.1-5">
          All other fields of the security target (such as the block type code, 
          block number, block processing control flags, or any CRC information)
          <bcp14>MUST NOT</bcp14> be considered as part of encryption or decryption.
          </t>
        </section>
        <section anchor="bcb_canon_aad" numbered="true" toc="include" removeInRFC="false" pn="section-4.7.2">
          <name slugifiedName="name-additional-authenticated-da">Additional Authenticated Data</name>
          <t indent="0" pn="section-4.7.2-1">
          The construction of additional authenticated data depends on the
          AAD scope flags that can be provided as part of customizing the
          behavior of this security context. 
          </t>
          <t indent="0" pn="section-4.7.2-2">
          The canonical form of the AAD input to the BCB-AES-GCM mechanism is
          constructed using the following process. While the AAD scope flags
          might not be included in the BCB representing the security operation,
          they <bcp14>MUST</bcp14> be included in the AAD value itself. This process <bcp14>MUST</bcp14> be
          followed when generating AAD for either encryption or decryption.

          </t>
          <ol spacing="normal" type="1" indent="adaptive" start="1" pn="section-4.7.2-3"><li pn="section-4.7.2-3.1" derivedCounter="1.">
              The canonical form of the AAD starts as the CBOR encoding
              of the AAD scope flags in which all unset flags, reserved bits,
              and unassigned bits have been set to 0. For example, if the
              primary block flag, target header flag, and security header flag are 
              each set, then the initial value of the canonical form of the
              AAD will be 0x07. 
            </li>
            <li pn="section-4.7.2-3.2" derivedCounter="2.">
              If the primary block flag of the AAD scope flags is set to 
              1, then a canonical form of the bundle's primary 
              block <bcp14>MUST</bcp14> be calculated and the result appended to the AAD.
            </li>
            <li pn="section-4.7.2-3.3" derivedCounter="3.">
              If the target header flag of the AAD scope flags is set to 
              1, then the canonical form of the block type code, 
              block number, and block processing control flags associated with the
              security target <bcp14>MUST</bcp14> be calculated and, in that order, appended 
              to the AAD.
            </li>
            <li pn="section-4.7.2-3.4" derivedCounter="4.">
              If the security header flag of the AAD scope flags is set to 1, 
              then the canonical form of the block type code, 
              block number, and block processing control flags associated with 
              the BIB <bcp14>MUST</bcp14> be calculated and, in that order, appended to the AAD.
            </li>
          </ol>
        </section>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-4.8">
        <name slugifiedName="name-processing-2">Processing</name>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-4.8.1">
          <name slugifiedName="name-encryption">Encryption</name>
          <t indent="0" pn="section-4.8.1-1">
          During encryption, four data elements are prepared for input to the
          AES-GCM cipher: the encryption key, the IV, 
          the security target plaintext to be encrypted, and any 
          additional authenticated data. These data items <bcp14>MUST</bcp14> be generated
          as follows.
          </t>
          <t indent="0" pn="section-4.8.1-2">
          Prior to encryption, if a CRC value is present for the target block, 
          then that CRC value <bcp14>MUST</bcp14> be removed. This requires removing the CRC 
          field from the target block and setting the CRC type field of the 
          target block to "no CRC is present."
          </t>
          <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-4.8.1-3">
            <li pn="section-4.8.1-3.1">
              The encryption key <bcp14>MUST</bcp14> have the appropriate
              length as required by local security policy.  The key might be
              generated specifically for this encryption, given as part of
              local security policy, or obtained through some other key
              management mechanism as discussed in <xref target="bcb_key_mgmt" format="default" sectionFormat="of" derivedContent="Section 4.5"/>.
            </li>
            <li pn="section-4.8.1-3.2">
              The IV selected <bcp14>MUST</bcp14> be of the appropriate
              length. Because replaying an IV in counter mode voids the 
              confidentiality of all messages encrypted with said IV, this 
              context also requires a unique IV for every encryption performed 
              with the same key. This means the same key and IV combination <bcp14>MUST NOT</bcp14> be used more than once. 
            </li>
            <li pn="section-4.8.1-3.3">
              The security target plaintext for encryption <bcp14>MUST</bcp14> be generated as
              discussed in <xref target="bcb_canon_cipher" format="default" sectionFormat="of" derivedContent="Section 4.7.1"/>.
            </li>
            <li pn="section-4.8.1-3.4">
              Additional authenticated data <bcp14>MUST</bcp14> be generated as
              discussed in <xref target="bcb_canon_aad" format="default" sectionFormat="of" derivedContent="Section 4.7.2"/>, with the value of 
              AAD scope flags being taken from local security policy.
            </li>
          </ul>
          <t indent="0" pn="section-4.8.1-4">
          Upon successful encryption, the following actions <bcp14>MUST</bcp14> occur.

          </t>
          <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-4.8.1-5">
            <li pn="section-4.8.1-5.1">
              The ciphertext produced by AES-GCM <bcp14>MUST</bcp14> replace the bytes used 
              to define the plaintext in the security target block's 
              block-type-specific data field. The block length of the security
              target <bcp14>MUST</bcp14> be updated if the generated ciphertext is larger
              than the plaintext (which can occur when the authentication
              tag is included in the ciphertext calculation, as discussed
              in <xref target="bcb_results" format="default" sectionFormat="of" derivedContent="Section 4.4"/>).
            </li>
            <li pn="section-4.8.1-5.2">              
              The authentication tag calculated by the AES-GCM cipher <bcp14>MAY</bcp14> be
              added as a security result for the security target in the BCB
              holding results for this security operation, in which case it 
              <bcp14>MUST</bcp14> be processed as described in <xref target="bcb_results" format="default" sectionFormat="of" derivedContent="Section 4.4"/>.
            </li>
            <li pn="section-4.8.1-5.3">
              The authentication tag <bcp14>MUST</bcp14> be included either as a security
              result in the BCB representing the security operation or
              (with the ciphertext) in the security target block-type-specific 
              data field. 
            </li>
          </ul>
          <t indent="0" pn="section-4.8.1-6">
          Finally, the BCB containing information about this security operation
          <bcp14>MUST</bcp14> be updated as follows. These operations can occur in any order.
          </t>
          <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-4.8.1-7">
            <li pn="section-4.8.1-7.1">
              The security context identifier for the BCB <bcp14>MUST</bcp14> be set to the context
              identifier for BCB-AES-GCM.
            </li>
            <li pn="section-4.8.1-7.2">
              The IV input to the cipher <bcp14>MUST</bcp14> be added as the
              IV security context parameter for the BCB.
            </li>
            <li pn="section-4.8.1-7.3">
              Any local flags used to generate AAD for this cipher <bcp14>MUST</bcp14> be
              placed in the AAD scope flags security context parameter for the BCB
              unless these flags are expected to be correctly configured at
              security verifiers and security acceptors in the network.
            </li>
            <li pn="section-4.8.1-7.4">
              The encryption key <bcp14>MAY</bcp14> be included as a security
              context parameter, in which case it <bcp14>MUST</bcp14> be
              wrapped using the AES key wrap function as defined in <xref target="RFC3394" format="default" sectionFormat="of" derivedContent="RFC3394"/> and the results of the
              wrapping added as the wrapped key security context parameter for
              the BCB.
            </li>
            <li pn="section-4.8.1-7.5">
              The AES variant used by this security context <bcp14>SHOULD</bcp14> be added as
              the AES variant security context parameter for the BCB if it differs from 
              the default key length. Otherwise, this parameter <bcp14>MAY</bcp14> be
              omitted if doing so provides a useful reduction in message sizes.
            </li>
          </ul>
          <t indent="0" pn="section-4.8.1-8">
           Problems encountered in the encryption <bcp14>MUST</bcp14> be processed in accordance 
           with local security policy. This <bcp14>MAY</bcp14> include restoring a CRC value
           removed from the target block prior to encryption, if the target block
           is allowed to be transmitted after an encryption error.
          </t>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-4.8.2">
          <name slugifiedName="name-decryption">Decryption</name>
          <t indent="0" pn="section-4.8.2-1">
          During decryption, five data elements are prepared for input to the
          AES-GCM cipher: the decryption key, the IV, 
          the security target ciphertext to be decrypted, any additional 
          authenticated data, and the authentication tag generated from the
          original encryption. These data items <bcp14>MUST</bcp14> be generated as follows.
          </t>
          <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-4.8.2-2">
            <li pn="section-4.8.2-2.1">
              The decryption key <bcp14>MUST</bcp14> be derived using the wrapped key
              security context parameter if such a parameter is included in the
              security context parameters of the BCB. Otherwise, this key
              <bcp14>MUST</bcp14> be derived in accordance with local security policy at the
              decrypting node as discussed in <xref target="bcb_key_mgmt" format="default" sectionFormat="of" derivedContent="Section 4.5"/>.
            </li>
            <li pn="section-4.8.2-2.2">
              The IV <bcp14>MUST</bcp14> be set to the value of the
              IV security context parameter included in the BCB. If the IV parameter
              is not included as a security context parameter, an IV <bcp14>MAY</bcp14> be derived
              as a function of local security policy and other BCB contents, or
              a lack of an IV security context parameter in the BCB <bcp14>MAY</bcp14> be treated
              as an error by the decrypting node.
            </li>
            <li pn="section-4.8.2-2.3">
              The security target ciphertext for decryption <bcp14>MUST</bcp14> be generated as
              discussed in <xref target="bcb_canon_cipher" format="default" sectionFormat="of" derivedContent="Section 4.7.1"/>.
            </li>
            <li pn="section-4.8.2-2.4">
              Additional authenticated data <bcp14>MUST</bcp14> be generated as
              discussed in <xref target="bcb_canon_aad" format="default" sectionFormat="of" derivedContent="Section 4.7.2"/> with the value of 
              AAD scope flags being taken from the AAD scope flags
              security context parameter. If the AAD scope flags parameter is
              not included in the security context parameters, then these flags
              <bcp14>MAY</bcp14> be derived from local security policy in cases where the
              set of such flags is determinable in the network. 
            </li>
            <li pn="section-4.8.2-2.5">
              The authentication tag <bcp14>MUST</bcp14> be present either as a security
              result in the BCB representing the security operation or
              (with the ciphertext) in the security target block-type-specific 
              data field. 
            </li>
          </ul>
          <t indent="0" pn="section-4.8.2-3">
          Upon successful decryption, the following action <bcp14>MUST</bcp14> occur.

          </t>
          <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-4.8.2-4">
            <li pn="section-4.8.2-4.1">
              The plaintext produced by AES-GCM <bcp14>MUST</bcp14> replace
              the bytes used to define the ciphertext in the security target
              block's block-type-specific data field. Any changes to the
              security target block length field <bcp14>MUST</bcp14> be
              corrected in cases where the plaintext has a different length
              than the replaced ciphertext.
            </li>
          </ul>
          <t indent="0" pn="section-4.8.2-5">
          If the security acceptor is not the bundle destination and if no other
          integrity or confidentiality service is being applied to the target block, 
          then a CRC <bcp14>MUST</bcp14> be included for the target block. The CRC type, as determined
          by policy, is set in the target block's CRC type field and the 
          corresponding CRC value is added as the CRC field for that block.
          </t>
          <t indent="0" pn="section-4.8.2-6">
          If the ciphertext fails to authenticate, if any needed parameters 
          are missing, or if there are other problems in the decryption, then 
          the decryption <bcp14>MUST</bcp14> be treated as failed and processed in accordance 
          with local security policy.
          </t>
        </section>
      </section>
    </section>
    <section anchor="IANA" toc="include" numbered="true" removeInRFC="false" pn="section-5">
      <name slugifiedName="name-iana-considerations">IANA Considerations</name>
      <section anchor="sc_ids" numbered="true" toc="include" removeInRFC="false" pn="section-5.1">
        <name slugifiedName="name-security-context-identifier">Security Context Identifiers</name>
        <t indent="0" pn="section-5.1-1">
        This specification allocates two security context identifiers from the 
        "BPSec Security Context Identifiers" registry defined in 
        <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/>.
        </t>
        <table align="center" anchor="iana_table" pn="table-8">
          <name slugifiedName="name-additional-entries-for-the-">Additional Entries for the BPSec Security Context Identifiers Registry</name>
          <thead>
            <tr>
              <th align="center" colspan="1" rowspan="1">Value</th>
              <th align="left" colspan="1" rowspan="1">Description</th>
              <th align="left" colspan="1" rowspan="1">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="center" colspan="1" rowspan="1">1</td>
              <td align="left" colspan="1" rowspan="1">BIB-HMAC-SHA2</td>
              <td align="left" colspan="1" rowspan="1">RFC 9173</td>
            </tr>
            <tr>
              <td align="center" colspan="1" rowspan="1">2</td>
              <td align="left" colspan="1" rowspan="1">BCB-AES-GCM</td>
              <td align="left" colspan="1" rowspan="1">RFC 9173</td>
            </tr>
          </tbody>
        </table>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-5.2">
        <name slugifiedName="name-integrity-scope-flags-2">Integrity Scope Flags</name>
        <t indent="0" pn="section-5.2-1">
          The BIB-HMAC-SHA2 security context has an Integrity Scope Flags field for 
          which IANA has created and now maintains a new registry named
          "BPSec BIB-HMAC-SHA2 Integrity Scope Flags" on the "Bundle Protocol" registry page. 
          <xref target="bib_flags" format="default" sectionFormat="of" derivedContent="Table 9"/> shows the initial values for this registry. 
        </t>
        <t indent="0" pn="section-5.2-2">
          The registration policy for this registry is Specification Required <xref target="RFC8126" format="default" sectionFormat="of" derivedContent="RFC8126"/>.
        </t>
        <t indent="0" pn="section-5.2-3">
          The value range is unsigned 16-bit integer.
        </t>
        <table align="center" anchor="bib_flags" pn="table-9">
          <name slugifiedName="name-bpsec-bib-hmac-sha2-integri">BPSec BIB-HMAC-SHA2 Integrity Scope Flags Registry</name>
          <thead>
            <tr>
              <th align="center" colspan="1" rowspan="1">Bit Position (right to left)</th>
              <th align="left" colspan="1" rowspan="1">Description</th>
              <th align="left" colspan="1" rowspan="1">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="center" colspan="1" rowspan="1">0</td>
              <td align="left" colspan="1" rowspan="1">Include primary block flag</td>
              <td align="left" colspan="1" rowspan="1">RFC 9173</td>
            </tr>
            <tr>
              <td align="center" colspan="1" rowspan="1">1</td>
              <td align="left" colspan="1" rowspan="1">Include target header flag</td>
              <td align="left" colspan="1" rowspan="1">RFC 9173</td>
            </tr>
            <tr>
              <td align="center" colspan="1" rowspan="1">2</td>
              <td align="left" colspan="1" rowspan="1">Include security header flag</td>
              <td align="left" colspan="1" rowspan="1">RFC 9173</td>
            </tr>
            <tr>
              <td align="center" colspan="1" rowspan="1">3-7</td>
              <td align="left" colspan="1" rowspan="1">Reserved</td>
              <td align="left" colspan="1" rowspan="1">RFC 9173</td>
            </tr>
            <tr>
              <td align="center" colspan="1" rowspan="1">8-15</td>
              <td align="left" colspan="1" rowspan="1">Unassigned</td>
              <td align="left" colspan="1" rowspan="1"/>
            </tr>
          </tbody>
        </table>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-5.3">
        <name slugifiedName="name-aad-scope-flags-2">AAD Scope Flags</name>
        <t indent="0" pn="section-5.3-1">
          The BCB-AES-GCM security context has an AAD Scope Flags field for 
          which IANA has created and now maintains a new registry named
          "BPSec BCB-AES-GCM AAD Scope Flags" on the "Bundle Protocol" registry page.
          <xref target="bcb_flags" format="default" sectionFormat="of" derivedContent="Table 10"/> shows the initial values for this registry.
        </t>
        <t indent="0" pn="section-5.3-2">
          The registration policy for this registry is Specification Required.
        </t>
        <t indent="0" pn="section-5.3-3">
          The value range is unsigned 16-bit integer.
        </t>
        <table align="center" anchor="bcb_flags" pn="table-10">
          <name slugifiedName="name-bpsec-bcb-aes-gcm-aad-scope">BPSec BCB-AES-GCM AAD Scope Flags Registry</name>
          <thead>
            <tr>
              <th align="center" colspan="1" rowspan="1">Bit Position (right to left)</th>
              <th align="left" colspan="1" rowspan="1">Description</th>
              <th align="left" colspan="1" rowspan="1">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="center" colspan="1" rowspan="1">0</td>
              <td align="left" colspan="1" rowspan="1">Include primary block flag</td>
              <td align="left" colspan="1" rowspan="1">RFC 9173</td>
            </tr>
            <tr>
              <td align="center" colspan="1" rowspan="1">1</td>
              <td align="left" colspan="1" rowspan="1">Include target header flag</td>
              <td align="left" colspan="1" rowspan="1">RFC 9173</td>
            </tr>
            <tr>
              <td align="center" colspan="1" rowspan="1">2</td>
              <td align="left" colspan="1" rowspan="1">Include security header flag</td>
              <td align="left" colspan="1" rowspan="1">RFC 9173</td>
            </tr>
            <tr>
              <td align="center" colspan="1" rowspan="1">3-7</td>
              <td align="left" colspan="1" rowspan="1">Reserved</td>
              <td align="left" colspan="1" rowspan="1">RFC 9173</td>
            </tr>
            <tr>
              <td align="center" colspan="1" rowspan="1">8-15</td>
              <td align="left" colspan="1" rowspan="1">Unassigned</td>
              <td align="left" colspan="1" rowspan="1"/>
            </tr>
          </tbody>
        </table>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-5.4">
        <name slugifiedName="name-guidance-for-designated-exp">Guidance for Designated Experts</name>
        <t indent="0" pn="section-5.4-1">
            New assignments within the "BPSec BIB-HMAC-SHA2 
            Integrity Scope Flags" and 
            "BPSec BCB-AES-GCM AAD Scope Flags" registries require
            review by a Designated Expert (DE). This section
            provides guidance to the DE when performing their
            reviews. Specifically, a DE is expected to perform
            the following activities. 

        </t>
        <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-5.4-2">
          <li pn="section-5.4-2.1">
                Ascertain the existence of suitable documentation
                (a specification) as described in <xref target="RFC8126" format="default" sectionFormat="of" derivedContent="RFC8126"/>
                and verify that the document is permanently and
                publicly available.
              </li>
          <li pn="section-5.4-2.2">
                Ensure that any changes to the "BPSec BIB-HMAC-SHA2 Integrity Scope Flags" registry
                clearly state how new assignments interact with existing
                flags and how the inclusion of new assignments affects
                the construction of the IPPT value.
              </li>
          <li pn="section-5.4-2.3">
                Ensure that any changes to the "BPSec BCB-AES-GCM AAD Scope Flags" registry clearly 
                state how new assignments interact with existing
                flags and how the inclusion of new assignments affects
                the construction of the AAD input to the BCB-AES-GCM mechanism. 
              </li>
          <li pn="section-5.4-2.4">
                Ensure that any processing changes proposed with new assignments
                do not alter any required behavior in this specification.
              </li>
        </ul>
      </section>
    </section>
    <section anchor="SecCons" numbered="true" toc="include" removeInRFC="false" pn="section-6">
      <name slugifiedName="name-security-considerations">Security Considerations</name>
      <t indent="0" pn="section-6-1">
      Security considerations specific to a single security context are 
      provided in the description of that context (see Sections <xref target="first-context" format="counter" sectionFormat="of" derivedContent="3"/> and <xref target="second-context" format="counter" sectionFormat="of" derivedContent="4"/>). This section discusses 
      security considerations that should be evaluated by implementers of any 
      security context described in this document. Considerations can also be 
      found in documents listed as normative references and should also be 
      reviewed by security context implementors. 
      </t>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-6.1">
        <name slugifiedName="name-key-management">Key Management</name>
        <t indent="0" pn="section-6.1-1">
        The delayed and disrupted nature of Delay-Tolerant
   Networking (DTN) complicates the process of key management
        because there might not be reliable, timely, round-trip exchange between security
        sources, security verifiers, and security acceptors in the network. This is true when
        there is a substantial signal propagation delay between nodes, when nodes are in a highly
        challenged communications environment, and when nodes do not support bidirectional 
        communication.
        </t>
        <t indent="0" pn="section-6.1-2">
        In these environments, key establishment protocols that rely on round-trip information
        exchange might not converge on a shared secret in a timely manner (or at all). Also,
        key revocation or key verification mechanisms that rely on access to a centralized
        authority (such as a certificate authority) might similarly fail in the stressing 
        conditions of DTN. 
        </t>
        <t indent="0" pn="section-6.1-3">
        For these reasons, the default security contexts described in this document rely
        on symmetric-key cryptographic mechanisms because asymmetric-key infrastructure (such
        as a public key infrastructure) might be impractical in this environment. 
        </t>
        <t indent="0" pn="section-6.1-4">
        BPSec assumes that "key management is handled as a separate part of network management" 
        <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/>. This assumption is also made
        by the security contexts defined in this document, which do not define new protocols for
        key derivation, exchange of KEKs, revocation of existing keys, 
        or the security configuration or policy used to select certain keys for certain 
        security operations.
        </t>
        <t indent="0" pn="section-6.1-5">
        Nodes using these security contexts need to perform the following kinds of
        activities, independent of the construction, transmission, and processing of
        BPSec security blocks.

        </t>
        <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-6.1-6">
          <li pn="section-6.1-6.1">
            Establish shared KEKs with other nodes in the network using
            an out-of-band mechanism. This might include pre-sharing of KEKs
            or the use of older key establishment mechanisms prior to the 
            exchange of BPSec security blocks.
          </li>
          <li pn="section-6.1-6.2">
            Determine when a key is considered exhausted and no longer to be used in 
            the generation, verification, or acceptance of a security block.
          </li>
          <li pn="section-6.1-6.3">
            Determine when a key is considered invalid and no longer to be used in the
            generation, verification, or acceptance of a security block. Such revocations
            can be based on a variety of mechanisms, including local security policy, 
            time relative to the generation or use of the key, or other mechanisms
            specified through network management.
          </li>
          <li pn="section-6.1-6.4">
            Determine, through an out-of-band mechanism such as local security policy,
            what keys are to be used for what security blocks. This includes the selection
            of which key should be used in the evaluation of a security block received by
            a security verifier or a security acceptor. 
          </li>
        </ul>
        <t indent="0" pn="section-6.1-7">
        The failure to provide effective key management techniques appropriate 
        for the operational networking environment can result in the compromise of 
        those unmanaged keys and the loss of security services in the network.
        </t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-6.2">
        <name slugifiedName="name-key-handling">Key Handling</name>
        <t indent="0" pn="section-6.2-1">
        Once generated, keys should be handled as follows.
        
        </t>
        <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-6.2-2">
          <li pn="section-6.2-2.1">
            It is strongly <bcp14>RECOMMENDED</bcp14> that implementations protect keys both  
            when they are stored and when they are transmitted. 
          </li>
          <li pn="section-6.2-2.2">
            In the event that a key is compromised, any security operations using 
            a security context associated with that key <bcp14>SHOULD</bcp14> also be
            considered compromised. This means that the BIB-HMAC-SHA2 security context
            <bcp14>SHOULD NOT</bcp14> be treated as providing integrity when used with a compromised key, and 
            BCB-AES-GCM <bcp14>SHOULD NOT</bcp14> be treated as providing confidentiality when used with a compromised key.
          </li>
          <li pn="section-6.2-2.3"> 
            The same key, whether a KEK or a wrapped key, <bcp14>MUST NOT</bcp14> 
            be used for different algorithms as doing so might leak information 
            about the key. 
          </li>
          <li pn="section-6.2-2.4">
            A KEK <bcp14>MUST NOT</bcp14> be used to encrypt keys for different security
            contexts. Any KEK used by a security context defined in this document <bcp14>MUST</bcp14>
            only be used to wrap keys associated with security operations using
            that security context. This means that a compliant security source
            would not use the same KEK to wrap keys for both the BIB-HMAC-SHA2 and
            BCB-AES-GCM security contexts. Similarly, any compliant security verifier
            or security acceptor would not use the same KEK to unwrap keys
            for different security contexts. 
          </li>
        </ul>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-6.3">
        <name slugifiedName="name-aes-gcm">AES GCM</name>
        <t indent="0" pn="section-6.3-1">
        There are a significant number of considerations related to the use of the
        GCM mode of AES to provide a confidentiality service. These considerations
        are provided in <xref target="GcmCons" format="default" sectionFormat="of" derivedContent="Section 4.6"/> as part of the documentation
        of the BCB-AES-GCM security context. 
        </t>
        <t indent="0" pn="section-6.3-2">
        The length of the ciphertext produced by the 
        GCM mode of AES will be equal to the length of the plaintext input 
        to the cipher suite. The authentication tag also produced by this 
        cipher suite is separate from the ciphertext. However, it should be 
        noted that implementations of the AES-GCM cipher suite might not separate 
        the concept of ciphertext and authentication tag in their Application 
        Programming Interface (API).
        </t>
        <t indent="0" pn="section-6.3-3">
        Implementations of the BCB-AES-GCM security context can either keep the length
        of the target block unchanged by holding the authentication tag in a BCB
        security result or alter the length of the target block by including the
        authentication tag with the ciphertext replacing the block-type-specific data
        field of the target block. Implementations <bcp14>MAY</bcp14> use the authentication tag
        security result in cases where keeping target block length unchanged is an
        important processing concern. In all cases, the ciphertext and authentication
        tag <bcp14>MUST</bcp14> be processed in accordance with the API of the AES-GCM cipher suites
        at the security source and security acceptor. 
        </t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-6.4">
        <name slugifiedName="name-aes-key-wrap">AES Key Wrap</name>
        <t indent="0" pn="section-6.4-1">
        The AES-KW algorithm used by the security contexts in this document 
        does not use a per-invocation initialization vector and does not require any key padding. Key padding is
        not needed because wrapped keys used by these security contexts will always be multiples of 8
        bytes. The length of the wrapped key can be determined by inspecting the security 
        context parameters. Therefore, a key can be unwrapped using only the information present 
        in the security block and the KEK provided by local security policy at the security verifier 
        or security acceptor. 
        </t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-6.5">
        <name slugifiedName="name-bundle-fragmentation">Bundle Fragmentation</name>
        <t indent="0" pn="section-6.5-1">
        Bundle fragmentation might prevent security services in a bundle from being 
        verified after a bundle is fragmented and before the bundle is 
        re-assembled. Examples of potential issues include the following.

        </t>
        <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-6.5-2">
          <li pn="section-6.5-2.1">
            If a security block and its security target do not exist in the
            same fragment, then the security block cannot be processed until the
            bundle is re-assembled. If a fragment includes an encrypted 
            target block, but not its BCB, then a receiving Bundle Protocol
            Agent (BPA) will not know that the target block has been encrypted. 
          </li>
          <li pn="section-6.5-2.2">
            A security block can be cryptographically bound to a bundle by setting the
            integrity scope flags (for BIB-HMAC-SHA2) or the AAD scope flags (for
            BCB-AES-GCM) to include the bundle primary block. When a security
            block is cryptographically bound to a bundle, it cannot be processed 
            even if the security block and target both coexist in the fragment. This 
            is because fragments have different primary blocks than the original bundle. 
          </li>
          <li pn="section-6.5-2.3">
            If security blocks and their target blocks are repeated in 
            multiple fragments, policy needs to determine how to deal with issues
            where a security operation verifies in one fragment but fails
            in another fragment. This might happen, for example, if a BIB block 
            becomes corrupted in one fragment but not in another fragment. 
          </li>
        </ul>
        <t indent="0" pn="section-6.5-3">
        Implementors should consider how security blocks are processed when
        a BPA fragments a received bundle. For example, security blocks and their targets 
        could be placed in the same fragment if the security block is not 
        otherwise cryptographically bound to the bundle being fragmented.
        Alternatively, if security blocks are cryptographically bound to a 
        bundle, then a fragmenting BPA should consider encapsulating the bundle 
        first and then fragmenting the encapsulating bundle. 
        </t>
      </section>
    </section>
  </middle>
  <back>
    <references pn="section-7">
      <name slugifiedName="name-normative-references">Normative References</name>
      <reference anchor="AES-GCM" quoteTitle="true" target="https://doi.org/10.6028/NIST.SP.800-38D" derivedAnchor="AES-GCM">
        <front>
          <title>Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC</title>
          <author initials="M." surname="Dworkin"/>
          <date year="2007" month="November"/>
        </front>
        <seriesInfo name="NIST Special Publication" value="800-38D"/>
        <seriesInfo name="DOI" value="10.6028/NIST.SP.800-38D"/>
      </reference>
      <reference anchor="RFC2104" target="https://www.rfc-editor.org/info/rfc2104" quoteTitle="true" derivedAnchor="RFC2104">
        <front>
          <title>HMAC: Keyed-Hashing for Message Authentication</title>
          <author initials="H." surname="Krawczyk" fullname="H. Krawczyk">
            <organization showOnFrontPage="true"/>
          </author>
          <author initials="M." surname="Bellare" fullname="M. Bellare">
            <organization showOnFrontPage="true"/>
          </author>
          <author initials="R." surname="Canetti" fullname="R. Canetti">
            <organization showOnFrontPage="true"/>
          </author>
          <date year="1997" month="February"/>
          <abstract>
            <t indent="0">This document describes HMAC, a mechanism for message authentication using cryptographic hash functions. HMAC can be used with any iterative cryptographic hash function, e.g., MD5, SHA-1, in combination with a secret shared key.  The cryptographic strength of HMAC depends on the properties of the underlying hash function.  This memo provides information for the Internet community.  This memo does not specify an Internet standard of any kind</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="2104"/>
        <seriesInfo name="DOI" value="10.17487/RFC2104"/>
      </reference>
      <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" quoteTitle="true" derivedAnchor="RFC2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author initials="S." surname="Bradner" fullname="S. Bradner">
            <organization showOnFrontPage="true"/>
          </author>
          <date year="1997" month="March"/>
          <abstract>
            <t indent="0">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="RFC3394" target="https://www.rfc-editor.org/info/rfc3394" quoteTitle="true" derivedAnchor="RFC3394">
        <front>
          <title>Advanced Encryption Standard (AES) Key Wrap Algorithm</title>
          <author initials="J." surname="Schaad" fullname="J. Schaad">
            <organization showOnFrontPage="true"/>
          </author>
          <author initials="R." surname="Housley" fullname="R. Housley">
            <organization showOnFrontPage="true"/>
          </author>
          <date year="2002" month="September"/>
        </front>
        <seriesInfo name="RFC" value="3394"/>
        <seriesInfo name="DOI" value="10.17487/RFC3394"/>
      </reference>
      <reference anchor="RFC8126" target="https://www.rfc-editor.org/info/rfc8126" quoteTitle="true" derivedAnchor="RFC8126">
        <front>
          <title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
          <author initials="M." surname="Cotton" fullname="M. Cotton">
            <organization showOnFrontPage="true"/>
          </author>
          <author initials="B." surname="Leiba" fullname="B. Leiba">
            <organization showOnFrontPage="true"/>
          </author>
          <author initials="T." surname="Narten" fullname="T. Narten">
            <organization showOnFrontPage="true"/>
          </author>
          <date year="2017" month="June"/>
          <abstract>
            <t indent="0">Many protocols make use of points of extensibility that use constants to identify various protocol parameters.  To ensure that the values in these fields do not have conflicting uses and to promote interoperability, their allocations are often coordinated by a central record keeper.  For IETF protocols, that role is filled by the Internet Assigned Numbers Authority (IANA).</t>
            <t indent="0">To make assignments in a given registry prudently, guidance describing the conditions under which new values should be assigned, as well as when and how modifications to existing values can be made, is needed.  This document defines a framework for the documentation of these guidelines by specification authors, in order to assure that the provided guidance for the IANA Considerations is clear and addresses the various issues that are likely in the operation of a registry.</t>
            <t indent="0">This is the third edition of this document; it obsoletes RFC 5226.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="26"/>
        <seriesInfo name="RFC" value="8126"/>
        <seriesInfo name="DOI" value="10.17487/RFC8126"/>
      </reference>
      <reference anchor="RFC8152" target="https://www.rfc-editor.org/info/rfc8152" quoteTitle="true" derivedAnchor="RFC8152">
        <front>
          <title>CBOR Object Signing and Encryption (COSE)</title>
          <author initials="J." surname="Schaad" fullname="J. Schaad">
            <organization showOnFrontPage="true"/>
          </author>
          <date year="2017" month="July"/>
          <abstract>
            <t indent="0">Concise Binary Object Representation (CBOR) is a data format designed for small code size and small message size.  There is a need for the ability to have basic security services defined for this data format. This document defines the CBOR Object Signing and Encryption (COSE) protocol.  This specification describes how to create and process signatures, message authentication codes, and encryption using CBOR for serialization.  This specification additionally describes how to represent cryptographic keys using CBOR.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="8152"/>
        <seriesInfo name="DOI" value="10.17487/RFC8152"/>
      </reference>
      <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" quoteTitle="true" derivedAnchor="RFC8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author initials="B." surname="Leiba" fullname="B. Leiba">
            <organization showOnFrontPage="true"/>
          </author>
          <date year="2017" month="May"/>
          <abstract>
            <t indent="0">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="RFC8742" target="https://www.rfc-editor.org/info/rfc8742" quoteTitle="true" derivedAnchor="RFC8742">
        <front>
          <title>Concise Binary Object Representation (CBOR) Sequences</title>
          <author initials="C." surname="Bormann" fullname="C. Bormann">
            <organization showOnFrontPage="true"/>
          </author>
          <date year="2020" month="February"/>
          <abstract>
            <t indent="0">This document describes the Concise Binary Object Representation (CBOR) Sequence format and associated media type "application/cbor-seq".  A CBOR Sequence consists of any number of encoded CBOR data items, simply concatenated in sequence.</t>
            <t indent="0">Structured syntax suffixes for media types allow other media types to build on them and make it explicit that they are built on an existing media type as their foundation.  This specification defines and registers "+cbor-seq" as a structured syntax suffix for CBOR Sequences.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="8742"/>
        <seriesInfo name="DOI" value="10.17487/RFC8742"/>
      </reference>
      <reference anchor="RFC8949" target="https://www.rfc-editor.org/info/rfc8949" quoteTitle="true" derivedAnchor="RFC8949">
        <front>
          <title>Concise Binary Object Representation (CBOR)</title>
          <author initials="C." surname="Bormann" fullname="C. Bormann">
            <organization showOnFrontPage="true"/>
          </author>
          <author initials="P." surname="Hoffman" fullname="P. Hoffman">
            <organization showOnFrontPage="true"/>
          </author>
          <date year="2020" month="December"/>
          <abstract>
            <t indent="0">The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of extremely small code size, fairly small message size, and extensibility without the need for version negotiation. These design goals make it different from earlier binary serializations such as ASN.1 and MessagePack.</t>
            <t indent="0">This document obsoletes RFC 7049, providing editorial improvements, new details, and errata fixes while keeping full compatibility with the interchange format of RFC 7049.  It does not create a new version of the format.</t>
          </abstract>
        </front>
        <seriesInfo name="STD" value="94"/>
        <seriesInfo name="RFC" value="8949"/>
        <seriesInfo name="DOI" value="10.17487/RFC8949"/>
      </reference>
      <reference anchor="RFC9171" quoteTitle="true" target="https://www.rfc-editor.org/rfc/rfc9171" derivedAnchor="RFC9171">
        <front>
          <title>Bundle Protocol Version 7</title>
          <author initials="S" surname="Burleigh" fullname="Scott Burleigh">
            <organization showOnFrontPage="true"/>
          </author>
          <author initials="K" surname="Fall" fullname="Kevin Fall">
            <organization showOnFrontPage="true"/>
          </author>
          <author initials="E." surname="Birrane, III" fullname="Edward J. Birrane, III">
            <organization showOnFrontPage="true"/>
          </author>
          <date year="2022" month="January"/>
        </front>
        <seriesInfo name="RFC" value="9171"/>
        <seriesInfo name="DOI" value="10.17487/RFC9171"/>
      </reference>
      <reference anchor="RFC9172" quoteTitle="true" target="https://www.rfc-editor.org/rfc/rfc9172" derivedAnchor="RFC9172">
        <front>
          <title>Bundle Protocol Security (BPSec)</title>
          <author initials="E." surname="Birrane, III" fullname="Edward J. Birrane, III">
            <organization showOnFrontPage="true"/>
          </author>
          <author initials="K" surname="McKeever" fullname="Kenneth McKeever">
            <organization showOnFrontPage="true"/>
          </author>
          <date year="2022" month="January"/>
        </front>
        <seriesInfo name="RFC" value="9172"/>
        <seriesInfo name="DOI" value="10.17487/RFC9172"/>
      </reference>
      <reference anchor="SHS" target="https://csrc.nist.gov/publications/detail/fips/180/4/final" quoteTitle="true" derivedAnchor="SHS">
        <front>
          <title>Secure Hash Standard (SHS)</title>
          <author>
            <organization showOnFrontPage="true">National Institute of Standards and Technology</organization>
          </author>
          <date year="2015" month="August"/>
        </front>
        <seriesInfo name="FIPS PUB" value="180-4"/>
        <seriesInfo name="DOI" value="10.6028/NIST.FIPS.180-4"/>
      </reference>
    </references>
    <section anchor="vectors" toc="include" numbered="true" removeInRFC="false" pn="section-appendix.a">
      <name slugifiedName="name-examples">Examples</name>
      <t indent="0" pn="section-appendix.a-1"> This appendix is informative. </t>
      <t indent="0" pn="section-appendix.a-2">
      This appendix presents a series of examples of constructing BPSec 
      security blocks (using the security contexts defined in this document)
      and adding those blocks to a sample bundle.
      </t>
      <t indent="0" pn="section-appendix.a-3"> 
      The examples presented in this appendix represent valid constructions of 
      bundles, security blocks, and the encoding of security context parameters 
      and results. For this reason, they can inform unit test suites 
      for individual implementations as well as interoperability test suites 
      amongst implementations. However, these examples do not cover every 
      permutation of security context parameters, security results, or use of security 
      blocks in a bundle. 
      </t>
      <t indent="0" pn="section-appendix.a-4">
      NOTES: </t>
      <ul bare="false" empty="false" indent="3" spacing="normal" pn="section-appendix.a-5">
        <li pn="section-appendix.a-5.1">The bundle diagrams in this appendix are patterned after the bundle
      diagrams used in Section <xref target="RFC9172" section="3.11" sectionFormat="bare" format="default" derivedLink="https://rfc-editor.org/rfc/rfc9172#section-3.11" derivedContent="RFC9172">"BPSec Block Examples"</xref> of <xref target="RFC9172" format="default" sectionFormat="of" derivedContent="RFC9172"/>.
      </li>
        <li pn="section-appendix.a-5.2">
Figures in this appendix identified as "(CBOR Diagnostic Notation)" 
      are represented using the CBOR diagnostic notation defined in <xref target="RFC8949" format="default" sectionFormat="of" derivedContent="RFC8949"/>. 
      This notation is used to express CBOR data structures in a manner that enables 
      visual inspection. The bundles, security blocks, and security context contents
      in these figures are represented using CBOR structures. In cases where BP blocks 
      (to include BPSec security blocks) are comprised of a sequence of
      CBOR objects, these objects are represented as a CBOR sequence as defined in 
      <xref target="RFC8742" format="default" sectionFormat="of" derivedContent="RFC8742"/>. 
      </li>
        <li pn="section-appendix.a-5.3">
      Examples in this appendix use the "ipn" URI scheme for endpoint ID
      naming, as defined in <xref target="RFC9171" format="default" sectionFormat="of" derivedContent="RFC9171"/>. 
      </li>
        <li pn="section-appendix.a-5.4">
      The bundle source is presumed to be the security source for all
      security blocks in this appendix, unless otherwise noted. 
      </li>
      </ul>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.1">
        <name slugifiedName="name-example-1-simple-integrity">Example 1 - Simple Integrity</name>
        <t indent="0" pn="section-appendix.a.1-1">
        This example shows the addition of a BIB to a sample bundle
        to provide integrity for the payload block. 
        </t>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.1.1">
          <name slugifiedName="name-original-bundle">Original Bundle</name>
          <t indent="0" pn="section-appendix.a.1.1-1">
          The following diagram shows the original bundle before the
          BIB has been added.
          </t>
          <figure align="left" suppress-title="false" pn="figure-1">
            <name slugifiedName="name-example-1-original-bundle">Example 1 - Original Bundle</name>
            <artwork align="center" pn="section-appendix.a.1.1-2.1">
                  Block                    Block   Block
                in Bundle                  Type    Number
+========================================+=======+========+
|  Primary Block                         |  N/A  |    0   |
+----------------------------------------+-------+--------+
|  Payload Block                         |   1   |    1   |
+----------------------------------------+-------+--------+
	    </artwork>
          </figure>
          <section anchor="ex_primary_block" numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.1.1.1">
            <name slugifiedName="name-primary-block">Primary Block</name>
            <t indent="0" pn="section-appendix.a.1.1.1-1">
            The Bundle Protocol version 7 (BPv7) bundle has no special block
            and bundle processing control flags, and no CRC is provided
            because the primary block is expected to be protected by an
            integrity service BIB using the BIB-HMAC-SHA2 security context.
            </t>
            <t indent="0" pn="section-appendix.a.1.1.1-2">
            The bundle is sourced at the source node ipn:2.1 and destined for
            the destination node ipn:1.2. 
The bundle creation time is set to 0, indicating lack of an accurate clock,
	    with a 
            sequence number of 40. The lifetime of the bundle is given as
            1,000,000 milliseconds since the bundle creation time. 
            </t>
            <t indent="0" pn="section-appendix.a.1.1.1-3">
            The primary block is provided as follows.

            </t>
            <figure anchor="ex_bdl_prim" align="left" suppress-title="false" pn="figure-2">
              <name slugifiedName="name-primary-block-cbor-diagnost">Primary Block (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" name="" markers="false" pn="section-appendix.a.1.1.1-4.1">
[
  7,           / BP version            /
  0,           / flags                 /
  0,           / CRC type              /
  [2, [1,2]],  / destination (ipn:1.2) /
  [2, [2,1]],  / source      (ipn:2.1) /
  [2, [2,1]],  / report-to   (ipn:2.1) /
  [0, 40],     / timestamp             /
  1000000      / lifetime              /
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.1.1.1-5">
            The CBOR encoding of the primary block is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.1.1.1-6">
0x88070000820282010282028202018202820201820018281a000f4240
</sourcecode>
          </section>
          <section anchor="ex_payload_block" numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.1.1.2">
            <name slugifiedName="name-payload-block">Payload Block</name>
            <t indent="0" pn="section-appendix.a.1.1.2-1">
            Other than its use as a source of plaintext for security blocks,
            the payload has no required distinguishing characteristic for the
            purpose of this example. The sample payload is a 35-byte string.
            </t>
            <t indent="0" pn="section-appendix.a.1.1.2-2">
            The payload is represented in the payload block as a byte string
            of the raw payload string. It is NOT represented as a CBOR text
            string wrapped within a CBOR binary string. The hex value of the
            payload is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.1.1.2-3">
0x526561647920746f2067656e657261746520612033322d62797465207061796c6f
6164
</sourcecode>
            <t indent="0" pn="section-appendix.a.1.1.2-4">
            The payload block is provided as follows.

            </t>
            <figure align="left" suppress-title="false" pn="figure-3">
              <name slugifiedName="name-payload-block-cbor-diagnost">Payload Block (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" name="" markers="false" pn="section-appendix.a.1.1.2-5.1">
[
  1,                       / type code: Payload block       /
  1,                       / block number                   /
  0,                       / block processing control flags /
  0,                       / CRC type                       /
  h'526561647920746f206765 / type-specific-data: payload    /
  6e657261746520612033322d
  62797465207061796c6f6164'
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.1.1.2-6">
            The CBOR encoding of the payload block is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.1.1.2-7">
0x85010100005823526561647920746f2067656e657261746520612033322d627974
65207061796c6f6164
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.1.1.3">
            <name slugifiedName="name-bundle-cbor-representation">Bundle CBOR Representation</name>
            <t indent="0" pn="section-appendix.a.1.1.3-1">
            A BPv7 bundle is represented as an indefinite-length array consisting
            of the blocks comprising the bundle, with a terminator character at
            the end. 
            </t>
            <t indent="0" pn="section-appendix.a.1.1.3-2">
            The CBOR encoding of the original bundle is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.1.1.3-3">
0x9f88070000820282010282028202018202820201820018281a000f424085010100
005823526561647920746f2067656e657261746520612033322d6279746520706179
6c6f6164ff
</sourcecode>
          </section>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.1.2">
          <name slugifiedName="name-security-operation-overview">Security Operation Overview</name>
          <t indent="0" pn="section-appendix.a.1.2-1">
          This example adds a BIB to the bundle using the BIB-HMAC-SHA2 security 
          context to provide an integrity mechanism over the payload block. 
          </t>
          <t indent="0" pn="section-appendix.a.1.2-2">
          The following diagram shows the resulting bundle after the 
          BIB is added.

          </t>
          <figure align="left" suppress-title="false" pn="figure-4">
            <name slugifiedName="name-example-1-resulting-bundle">Example 1 - Resulting Bundle</name>
            <artwork align="center" pn="section-appendix.a.1.2-3.1">
                  Block                    Block   Block
                in Bundle                  Type    Number
+========================================+=======+========+
|  Primary Block                         |  N/A  |    0   |
+----------------------------------------+-------+--------+
|  Block Integrity Block                 |   11  |    2   |
|  OP(bib-integrity, target=1)           |       |        |
+----------------------------------------+-------+--------+
|  Payload Block                         |   1   |    1   |
+----------------------------------------+-------+--------+
	    </artwork>
          </figure>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.1.3">
          <name slugifiedName="name-block-integrity-block">Block Integrity Block</name>
          <t indent="0" pn="section-appendix.a.1.3-1">
          In this example, a BIB is used to carry an integrity signature over
          the payload block.
          </t>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.1.3.1">
            <name slugifiedName="name-configuration-parameters-an">Configuration, Parameters, and Results</name>
            <t indent="0" pn="section-appendix.a.1.3.1-1">
            For this example, the following configuration and security context
            parameters are used to generate the security results
            indicated.
            </t>
            <t indent="0" pn="section-appendix.a.1.3.1-2">
            This BIB has a single target and includes a single security
            result: the calculated signature over the payload block.
            </t>
            <figure anchor="ex1_cpr" align="left" suppress-title="false" pn="figure-5">
              <name slugifiedName="name-example-1-configuration-par">Example 1 - Configuration, Parameters, and Results</name>
              <artwork name="" type="" alt="" align="center" pn="section-appendix.a.1.3.1-3.1">
 Key         : h'1a2b1a2b1a2b1a2b1a2b1a2b1a2b1a2b'
 SHA Variant : HMAC 512/512                       
 Scope Flags : 0x00                               
 Payload Data: h'526561647920746f2067656e65726174
                 6520612033322d62797465207061796c
                 6f6164'
 IPPT        : h'005823526561647920746f2067656e65
                 7261746520612033322d627974652070
                 61796c6f6164'
 Signature   : h'3bdc69b3a34a2b5d3a8554368bd1e808
                 f606219d2a10a846eae3886ae4ecc83c
                 4ee550fdfb1cc636b904e2f1a73e303d
                 cd4b6ccece003e95e8164dcc89a156e1'
        </artwork>
            </figure>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.1.3.2">
            <name slugifiedName="name-abstract-security-block">Abstract Security Block</name>
            <t indent="0" pn="section-appendix.a.1.3.2-1">
            The abstract security block structure of the BIB's
            block-type-specific data field for this application is as follows.

            </t>
            <figure anchor="ex1_bib_asb" align="left" suppress-title="false" pn="figure-6">
              <name slugifiedName="name-example-1-bib-abstract-secu">Example 1 - BIB Abstract Security Block (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" markers="false" pn="section-appendix.a.1.3.2-2.1">
[1],           / Security Target        - Payload block       /
1,             / Security Context ID    - BIB-HMAC-SHA2       /
1,             / Security Context Flags - Parameters Present  /
[2,[2, 1]],    / Security Source        - ipn:2.1             /
[              / Security Parameters    - 2 Parameters        /
   [1, 7],     / SHA Variant            - HMAC 512/512        /
   [3, 0x00]   / Scope Flags            - No Additional Scope /
],
[              / Security Results: 1 Result                   /
  [            / Target 1 Results                             /
    [1, h'3bdc69b3a34a2b5d3a8554368bd1e808         / MAC      /
          f606219d2a10a846eae3886ae4ecc83c
          4ee550fdfb1cc636b904e2f1a73e303d
          cd4b6ccece003e95e8164dcc89a156e1']
  ]
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.1.3.2-3">
            The CBOR encoding of the BIB block-type-specific data field (the abstract security block) is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.1.3.2-4">
0x810101018202820201828201078203008181820158403bdc69b3a34a2b5d3a8554
368bd1e808f606219d2a10a846eae3886ae4ecc83c4ee550fdfb1cc636b904e2f1a7
3e303dcd4b6ccece003e95e8164dcc89a156e1
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.1.3.3">
            <name slugifiedName="name-representations">Representations</name>
            <t indent="0" pn="section-appendix.a.1.3.3-1">
            The complete BIB is as follows.

            </t>
            <figure anchor="ex1_bib" align="left" suppress-title="false" pn="figure-7">
              <name slugifiedName="name-example-1-bib-cbor-diagnost">Example 1 - BIB (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" name="" markers="false" pn="section-appendix.a.1.3.3-2.1">
[
  11, / type code    /
  2,  / block number /
  0,  / flags        /
  0,  / CRC type     /
  h'810101018202820201828201078203008181820158403bdc69b3a34a
  2b5d3a8554368bd1e808f606219d2a10a846eae3886ae4ecc83c4ee550
  fdfb1cc636b904e2f1a73e303dcd4b6ccece003e95e8164dcc89a156e1'
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.1.3.3-3">
            The CBOR encoding of the BIB block is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.1.3.3-4">
0x850b0200005856810101018202820201828201078203008181820158403bdc69b3
a34a2b5d3a8554368bd1e808f606219d2a10a846eae3886ae4ecc83c4ee550fdfb1c
c636b904e2f1a73e303dcd4b6ccece003e95e8164dcc89a156e1
</sourcecode>
          </section>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.1.4">
          <name slugifiedName="name-final-bundle">Final Bundle</name>
          <t indent="0" pn="section-appendix.a.1.4-1">
          The CBOR encoding of the full output bundle, with the BIB: 
          </t>
          <sourcecode markers="false" pn="section-appendix.a.1.4-2">
0x9f88070000820282010282028202018202820201820018281a000f4240850b0200
005856810101018202820201828201078203008181820158403bdc69b3a34a2b5d3a
8554368bd1e808f606219d2a10a846eae3886ae4ecc83c4ee550fdfb1cc636b904e2
f1a73e303dcd4b6ccece003e95e8164dcc89a156e185010100005823526561647920
746f2067656e657261746520612033322d62797465207061796c6f6164ff
</sourcecode>
        </section>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.2">
        <name slugifiedName="name-example-2-simple-confidenti">Example 2 - Simple Confidentiality with Key Wrap</name>
        <t indent="0" pn="section-appendix.a.2-1">
        This example shows the addition of a BCB to a sample bundle
        to provide confidentiality for the payload block. AES key wrap 
        is used to transmit the symmetric key used to generate the
        security results for this service.
        </t>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.2.1">
          <name slugifiedName="name-original-bundle-2">Original Bundle</name>
          <t indent="0" pn="section-appendix.a.2.1-1">
          The following diagram shows the original bundle before the
          BCB has been added.

          </t>
          <figure align="center" suppress-title="false" pn="figure-8">
            <name slugifiedName="name-example-2-original-bundle">Example 2 - Original Bundle</name>
            <artwork align="center" pn="section-appendix.a.2.1-2.1">
                  Block                    Block   Block
                in Bundle                  Type    Number
+========================================+=======+========+
|  Primary Block                         |  N/A  |    0   |
+----------------------------------------+-------+--------+
|  Payload Block                         |   1   |    1   |
+----------------------------------------+-------+--------+
	    </artwork>
          </figure>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.2.1.1">
            <name slugifiedName="name-primary-block-2">Primary Block</name>
            <t indent="0" pn="section-appendix.a.2.1.1-1">
           The primary block used in this example is identical to the primary block
           presented for Example 1 in <xref target="ex_primary_block" format="default" sectionFormat="of" derivedContent="Appendix A.1.1.1"/>.
            </t>
            <t indent="0" pn="section-appendix.a.2.1.1-2"> 
            In summary, the CBOR encoding of the primary block is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.2.1.1-3">
0x88070000820282010282028202018202820201820018281a000f4240
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.2.1.2">
            <name slugifiedName="name-payload-block-2">Payload Block</name>
            <t indent="0" pn="section-appendix.a.2.1.2-1">
           The payload block used in this example is identical to the payload block
           presented for Example 1 in <xref target="ex_payload_block" format="default" sectionFormat="of" derivedContent="Appendix A.1.1.2"/>.
            </t>
            <t indent="0" pn="section-appendix.a.2.1.2-2"> 
            In summary, the CBOR encoding of the payload block is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.2.1.2-3">
0x85010100005823526561647920746f2067656e657261746520612033322d627974
65207061796c6f6164
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.2.1.3">
            <name slugifiedName="name-bundle-cbor-representation-2">Bundle CBOR Representation</name>
            <t indent="0" pn="section-appendix.a.2.1.3-1">
            A BPv7 bundle is represented as an indefinite-length array consisting
            of the blocks comprising the bundle, with a terminator character at
            the end. 
            </t>
            <t indent="0" pn="section-appendix.a.2.1.3-2">
            The CBOR encoding of the original bundle is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.2.1.3-3">
0x9f88070000820282010282028202018202820201820018281a000f424085010100
005823526561647920746f2067656e657261746520612033322d6279746520706179
6c6f6164ff
</sourcecode>
          </section>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.2.2">
          <name slugifiedName="name-security-operation-overview-2">Security Operation Overview</name>
          <t indent="0" pn="section-appendix.a.2.2-1">
          This example adds a BCB using the BCB-AES-GCM security context 
          using AES key wrap to provide a confidentiality mechanism over 
          the payload block and transmit the symmetric key.
          </t>
          <t indent="0" pn="section-appendix.a.2.2-2">
          The following diagram shows the resulting bundle after the 
          BCB is added.

          </t>
          <figure align="center" suppress-title="false" pn="figure-9">
            <name slugifiedName="name-example-2-resulting-bundle">Example 2 - Resulting Bundle</name>
            <artwork align="center" pn="section-appendix.a.2.2-3.1">
                  Block                    Block   Block
                in Bundle                  Type    Number
+========================================+=======+========+
|  Primary Block                         |  N/A  |    0   |
+----------------------------------------+-------+--------+
|  Block Confidentiality Block           |   12  |    2   |
|  OP(bcb-confidentiality, target=1)     |       |        |
+----------------------------------------+-------+--------+
|  Payload Block (Encrypted)             |   1   |    1   |
+----------------------------------------+-------+--------+
	    </artwork>
          </figure>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.2.3">
          <name slugifiedName="name-block-confidentiality-block">Block Confidentiality Block</name>
          <t indent="0" pn="section-appendix.a.2.3-1">
  In this example, a BCB is used to encrypt the payload block, and AES key
  wrap is used to encode the symmetric key prior to its inclusion in the BCB.
          </t>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.2.3.1">
            <name slugifiedName="name-configuration-parameters-and">Configuration, Parameters, and Results</name>
            <t indent="0" pn="section-appendix.a.2.3.1-1">
            For this example, the following configuration and security context
            parameters are used to generate the security results
            indicated.
            </t>
            <t indent="0" pn="section-appendix.a.2.3.1-2">
            This BCB has a single target -- the payload block. Three
            security results are generated: ciphertext that
            replaces the plaintext block-type-specific data to
            encrypt the payload block, an authentication tag, and
            the AES wrapped key. 
            </t>
            <figure anchor="ex2_cpr" align="left" suppress-title="false" pn="figure-10">
              <name slugifiedName="name-example-2-configuration-par">Example 2 - Configuration, Parameters, and Results</name>
              <artwork align="center" name="" type="" alt="" pn="section-appendix.a.2.3.1-3.1">
 Content Encryption                                     
                Key: h'71776572747975696f70617364666768'
 Key Encryption Key: h'6162636465666768696a6b6c6d6e6f70'
                 IV: h'5477656c7665313231323132'        
        AES Variant: A128GCM                            
    AES Wrapped Key: h'69c411276fecddc4780df42c8a2af892 
                       96fabf34d7fae700'              
        Scope Flags: 0x00                               
       Payload Data: h'526561647920746f2067656e65726174
                       6520612033322d62797465207061796c
                       6f6164'
                AAD: h'00'
 Authentication Tag: h'efa4b5ac0108e3816c5606479801bc04'
 Payload Ciphertext: h'3a09c1e63fe23a7f66a59c7303837241
                       e070b02619fc59c5214a22f08cd70795
                       e73e9a'
        </artwork>
            </figure>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.2.3.2">
            <name slugifiedName="name-abstract-security-block-2">Abstract Security Block</name>
            <t indent="0" pn="section-appendix.a.2.3.2-1">
            The abstract security block structure of the BCB's
            block-type-specific data field for this application is as follows.

            </t>
            <figure anchor="ex2_bcb_asb" align="left" suppress-title="false" pn="figure-11">
              <name slugifiedName="name-example-2-bcb-abstract-secu">Example 2 - BCB Abstract Security Block (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" markers="false" pn="section-appendix.a.2.3.2-2.1">
[1],               / Security Target        - Payload block       /
2,                 / Security Context ID    - BCB-AES-GCM         /
1,                 / Security Context Flags - Parameters Present  /
[2,[2, 1]],        / Security Source        - ipn:2.1             /
[                  / Security Parameters    - 4 Parameters        /
  [1, h'5477656c7665313231323132'], / Initialization Vector       /
  [2, 1],                           / AES Variant - A128GCM       /
  [3, h'69c411276fecddc4780df42c8a  / AES wrapped key             /
        2af89296fabf34d7fae700'],
  [4, 0x00]                         / Scope Flags - No extra scope/
],
[                                   /  Security Results: 1 Result /
  [                                 /  Target 1 Results           /
    [1, h'efa4b5ac0108e3816c5606479801bc04']  / Payload Auth. Tag /
  ]
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.2.3.2-3">
            The CBOR encoding of the BCB block-type-specific data field 
            (the abstract security block) is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.2.3.2-4">
0x8101020182028202018482014c5477656c76653132313231328202018203581869
c411276fecddc4780df42c8a2af89296fabf34d7fae7008204008181820150efa4b5
ac0108e3816c5606479801bc04
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.2.3.3">
            <name slugifiedName="name-representations-2">Representations</name>
            <t indent="0" pn="section-appendix.a.2.3.3-1">
            The complete BCB is as follows.

            </t>
            <figure anchor="ex2_bcb" align="left" suppress-title="false" pn="figure-12">
              <name slugifiedName="name-example-2-bcb-cbor-diagnost">Example 2 - BCB (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" markers="false" pn="section-appendix.a.2.3.3-2.1">
[
  12, / type code                                          /
  2,  / block number                                       /
  1,  / flags - block must be replicated in every fragment /
  0,  / CRC type                                           /
  h'8101020182028202018482014c5477656c766531323132313282020182035818
    69c411276fecddc4780df42c8a2af89296fabf34d7fae7008204008181820150
    efa4b5ac0108e3816c5606479801bc04'
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.2.3.3-3">
            The CBOR encoding of the BCB block is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.2.3.3-4">
0x850c02010058508101020182028202018482014c5477656c766531323132313282
02018203581869c411276fecddc4780df42c8a2af89296fabf34d7fae70082040081
81820150efa4b5ac0108e3816c5606479801bc04
</sourcecode>
          </section>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.2.4">
          <name slugifiedName="name-final-bundle-2">Final Bundle</name>
          <t indent="0" pn="section-appendix.a.2.4-1">
          The CBOR encoding of the full output bundle, with the BCB: 
          </t>
          <sourcecode markers="false" pn="section-appendix.a.2.4-2">
0x9f88070000820282010282028202018202820201820018281a000f4240850c0201
0058508101020182028202018482014c5477656c7665313231323132820201820358
1869c411276fecddc4780df42c8a2af89296fabf34d7fae7008204008181820150ef
a4b5ac0108e3816c5606479801bc04850101000058233a09c1e63fe23a7f66a59c73
03837241e070b02619fc59c5214a22f08cd70795e73e9aff
</sourcecode>
        </section>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.3">
        <name slugifiedName="name-example-3-security-blocks-f">Example 3 - Security Blocks from Multiple Sources</name>
        <t indent="0" pn="section-appendix.a.3-1">
        This example shows the addition of a BIB and BCB to 
        a sample bundle. These two security blocks are added 
        by two different nodes. The BCB is added by the source 
        endpoint, and the BIB is added by a forwarding node.
        </t>
        <t indent="0" pn="section-appendix.a.3-2">
        The resulting bundle contains a BCB to encrypt the 
        Payload Block and a BIB to provide integrity to the 
        primary block and Bundle Age Block.
        </t>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.3.1">
          <name slugifiedName="name-original-bundle-3">Original Bundle</name>
          <t indent="0" pn="section-appendix.a.3.1-1">
          The following diagram shows the original bundle before the
          security blocks have been added.
          </t>
          <figure align="center" suppress-title="false" pn="figure-13">
            <name slugifiedName="name-example-3-original-bundle">Example 3 - Original Bundle</name>
            <artwork align="center" pn="section-appendix.a.3.1-2.1">
                  Block                    Block   Block
                in Bundle                  Type    Number
+========================================+=======+========+
|  Primary Block                         |  N/A  |    0   |
+----------------------------------------+-------+--------+
|  Extension Block: Bundle Age Block     |   7   |    2   |
+----------------------------------------+-------+--------+
|  Payload Block                         |   1   |    1   |
+----------------------------------------+-------+--------+
	    </artwork>
          </figure>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.3.1.1">
            <name slugifiedName="name-primary-block-3">Primary Block</name>
            <t indent="0" pn="section-appendix.a.3.1.1-1">
           The primary block used in this example is identical to the primary block
           presented for Example 1 in <xref target="ex_primary_block" format="default" sectionFormat="of" derivedContent="Appendix A.1.1.1"/>.
            </t>
            <t indent="0" pn="section-appendix.a.3.1.1-2"> 
            In summary, the CBOR encoding of the primary block is: 
            </t>
            <sourcecode markers="false" pn="section-appendix.a.3.1.1-3">
0x88070000820282010282028202018202820201820018281a000f4240
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.3.1.2">
            <name slugifiedName="name-bundle-age-block">Bundle Age Block</name>
            <t indent="0" pn="section-appendix.a.3.1.2-1">
          A Bundle Age Block is added to the bundle to help other nodes in the
          network determine the age of the bundle. The use of this block is
          recommended because the bundle source does not have an accurate
          clock (as indicated by the DTN time of 0).
            </t>
            <t indent="0" pn="section-appendix.a.3.1.2-2">
          Because this block is specified at the time the bundle is being
          forwarded, the bundle age represents the time that has elapsed 
          from the time the bundle was created to the time it is being prepared
          for forwarding.  In this case, the value is given as 300 milliseconds. 
            </t>
            <t indent="0" pn="section-appendix.a.3.1.2-3">
          The Bundle Age extension block is provided as follows.

            </t>
            <figure anchor="ex_bdl_age" align="left" suppress-title="false" pn="figure-14">
              <name slugifiedName="name-bundle-age-block-cbor-diagn">Bundle Age Block (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" markers="false" pn="section-appendix.a.3.1.2-4.1">
[
  7,      / type code: Bundle Age Block    /
  2,      / block number                   /
  0,      / block processing control flags /
  0,      / CRC type                       /
  &lt;&lt;300&gt;&gt; / type-specific-data: age        /
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.3.1.2-5">
            The CBOR encoding of the Bundle Age Block is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.3.1.2-6">
0x85070200004319012c
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.3.1.3">
            <name slugifiedName="name-payload-block-3">Payload Block</name>
            <t indent="0" pn="section-appendix.a.3.1.3-1">
           The payload block used in this example is identical to the payload block
           presented for Example 1 in <xref target="ex_payload_block" format="default" sectionFormat="of" derivedContent="Appendix A.1.1.2"/>.
            </t>
            <t indent="0" pn="section-appendix.a.3.1.3-2"> 
            In summary, the CBOR encoding of the payload block is: 
            </t>
            <sourcecode markers="false" pn="section-appendix.a.3.1.3-3">
0x85010100005823526561647920746f2067656e657261746520612033322d627974
65207061796c6f6164
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.3.1.4">
            <name slugifiedName="name-bundle-cbor-representation-3">Bundle CBOR Representation</name>
            <t indent="0" pn="section-appendix.a.3.1.4-1">
            A BPv7 bundle is represented as an indefinite-length array consisting
            of the blocks comprising the bundle, with a terminator character at
            the end. 
            </t>
            <t indent="0" pn="section-appendix.a.3.1.4-2">
            The CBOR encoding of the original bundle is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.3.1.4-3">
0x9f88070000820282010282028202018202820201820018281a000f424085070200
004319012c85010100005823526561647920746f2067656e65726174652061203332
2d62797465207061796c6f6164ff
</sourcecode>
          </section>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.3.2">
          <name slugifiedName="name-security-operation-overview-3">Security Operation Overview</name>
          <t indent="0" pn="section-appendix.a.3.2-1">
          This example provides:

          </t>
          <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-appendix.a.3.2-2">
            <li pn="section-appendix.a.3.2-2.1"> 
              a BIB with the BIB-HMAC-SHA2 security context to provide an 
              integrity mechanism over the primary block and Bundle Age 
              Block. 
            </li>
            <li pn="section-appendix.a.3.2-2.2">
              a BCB with the BCB-AES-GCM security context to provide a
              confidentiality mechanism over the payload block.
            </li>
          </ul>
          <t indent="0" pn="section-appendix.a.3.2-3">
          The following diagram shows the resulting bundle after the 
          security blocks are added.
          </t>
          <figure align="left" suppress-title="false" pn="figure-15">
            <name slugifiedName="name-example-3-resulting-bundle">Example 3 - Resulting Bundle</name>
            <artwork align="center" pn="section-appendix.a.3.2-4.1">
                  Block                    Block   Block
                in Bundle                  Type    Number
+========================================+=======+========+
|  Primary Block                         |  N/A  |    0   |
+----------------------------------------+-------+--------+
|  Block Integrity Block                 |   11  |    3   |
|  OP(bib-integrity, targets=0, 2)       |       |        |
+----------------------------------------+-------+--------+
|  Block Confidentiality Block           |   12  |    4   |
|  OP(bcb-confidentiality, target=1)     |       |        |
+----------------------------------------+-------+--------+
|  Extension Block: Bundle Age Block     |   7   |    2   |
+----------------------------------------+-------+--------+
|  Payload Block (Encrypted)             |   1   |    1   |
+----------------------------------------+-------+--------+
	    </artwork>
          </figure>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.3.3">
          <name slugifiedName="name-block-integrity-block-2">Block Integrity Block</name>
          <t indent="0" pn="section-appendix.a.3.3-1">
          In this example, a BIB is used to carry an integrity signature over
          the Bundle Age Block and an additional signature over the 
          payload block. The BIB is added by a waypoint node -- ipn:3.0.
          </t>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.3.3.1">
            <name slugifiedName="name-configuration-parameters-and-">Configuration, Parameters, and Results</name>
            <t indent="0" pn="section-appendix.a.3.3.1-1">
            For this example, the following configuration and security context
            parameters are used to generate the security results
            indicated.
            </t>
            <t indent="0" pn="section-appendix.a.3.3.1-2">
            This BIB has two security targets and includes two
            security results, holding the calculated signatures over
            the Bundle Age Block and primary block.
            </t>
            <figure anchor="ex3_bib_cpr" align="left" suppress-title="false" pn="figure-16">
              <name slugifiedName="name-example-3-configuration-par">Example 3 - Configuration, Parameters, and Results for the BIB</name>
              <artwork align="center" name="" type="" alt="" pn="section-appendix.a.3.3.1-3.1">
                Key: h'1a2b1a2b1a2b1a2b1a2b1a2b1a2b1a2b' 
        SHA Variant: HMAC 256/256                        
        Scope Flags: 0x00                                
 Primary Block Data: h'88070000820282010282028202018202  
                       820201820018281a000f4240'         
 Bundle Age Block                                        
               Data: h'4319012c'     
 Primary Block IPPT: h'00581c88070000820282010282028202
                       018202820201820018281a000f4240'
Bundle Age Block 
               IPPT: h'004319012c'
 Primary Block                                           
          Signature: h'cac6ce8e4c5dae57988b757e49a6dd14
                       31dc04763541b2845098265bc817241b' 
 Bundle Age Block                                        
          Signature: h'3ed614c0d97f49b3633627779aa18a33
                       8d212bf3c92b97759d9739cd50725596'  
        </artwork>
            </figure>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.3.3.2">
            <name slugifiedName="name-abstract-security-block-3">Abstract Security Block</name>
            <t indent="0" pn="section-appendix.a.3.3.2-1">
            The abstract security block structure of the BIB's
            block-type-specific data field for this application is as follows.

            </t>
            <figure anchor="ex3_bib_asb" align="left" suppress-title="false" pn="figure-17">
              <name slugifiedName="name-example-3-bib-abstract-secu">Example 3 - BIB Abstract Security Block (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" markers="false" pn="section-appendix.a.3.3.2-2.1">
[0, 2],         / Security Targets                             /
1,              / Security Context ID    - BIB-HMAC-SHA2       /
1,              / Security Context Flags - Parameters Present  /
[2,[3, 0]],     / Security Source        - ipn:3.0             /
[               / Security Parameters    - 2 Parameters        /
   [1, 5],      / SHA Variant            - HMAC 256            /
   [3, 0]       / Scope Flags            - No Additional Scope /
],
[               / Security Results: 2 Results                  /
   [            / Primary Block Results                        /
       [1, h'cac6ce8e4c5dae57988b757e49a6dd14
             31dc04763541b2845098265bc817241b']       / MAC    /
    ],
    [           / Bundle Age Block Results                     /
       [1, h'3ed614c0d97f49b3633627779aa18a33
             8d212bf3c92b97759d9739cd50725596']       / MAC    /
    ]
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.3.3.2-3">
            The CBOR encoding of the BIB block-type-specific data field (the abstract security block) is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.3.3.2-4">
0x8200020101820282030082820105820300828182015820cac6ce8e4c5dae57988b
757e49a6dd1431dc04763541b2845098265bc817241b81820158203ed614c0d97f49
b3633627779aa18a338d212bf3c92b97759d9739cd50725596
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.3.3.3">
            <name slugifiedName="name-representations-3">Representations</name>
            <t indent="0" pn="section-appendix.a.3.3.3-1">
            The complete BIB is as follows.

            </t>
            <figure anchor="ex3_bib" align="left" suppress-title="false" pn="figure-18">
              <name slugifiedName="name-example-3-bib-cbor-diagnost">Example 3 - BIB (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" markers="false" pn="section-appendix.a.3.3.3-2.1">
[
  11, / type code    /
  3,  / block number /
  0,  / flags        /
  0,  / CRC type     /
  h'8200020101820282030082820105820300828182015820cac6ce8e4c5dae5798
  8b757e49a6dd1431dc04763541b2845098265bc817241b81820158203ed614c0d9
  7f49b3633627779aa18a338d212bf3c92b97759d9739cd50725596'
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.3.3.3-3">
            The CBOR encoding of the BIB block is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.3.3.3-4">
0x850b030000585c8200020101820282030082820105820300828182015820cac6ce
8e4c5dae57988b757e49a6dd1431dc04763541b2845098265bc817241b8182015820
3ed614c0d97f49b3633627779aa18a338d212bf3c92b97759d9739cd50725596
</sourcecode>
          </section>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.3.4">
          <name slugifiedName="name-block-confidentiality-block-2">Block Confidentiality Block</name>
          <t indent="0" pn="section-appendix.a.3.4-1">
          In this example, a BCB is used encrypt the payload
          block. The BCB is added by the bundle source node, ipn:2.1.
          </t>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.3.4.1">
            <name slugifiedName="name-configuration-parameters-and-r">Configuration, Parameters, and Results</name>
            <t indent="0" pn="section-appendix.a.3.4.1-1">
            For this example, the following configuration and security context
            parameters are used to generate the security results
            indicated.
            </t>
            <t indent="0" pn="section-appendix.a.3.4.1-2">
            This BCB has a single target, the payload block. 
            Two security results are generated: ciphertext that 
            replaces the plaintext block-type-specific data to
            encrypt the payload block and an authentication tag.
            </t>
            <figure anchor="ex3_bcb_cpr" align="left" suppress-title="false" pn="figure-19">
              <name slugifiedName="name-example-3-configuration-para">Example 3 - Configuration, Parameters, and Results for the BCB</name>
              <artwork align="center" name="" type="" alt="" pn="section-appendix.a.3.4.1-3.1">
 Content Encryption                                     
                Key: h'71776572747975696f70617364666768'
                 IV: h'5477656c7665313231323132'        
        AES Variant: A128GCM                            
        Scope Flags: 0x00                               
       Payload Data: h'526561647920746f2067656e65726174 
                       6520612033322d62797465207061796c
                       6f6164'
                AAD: h'00'
 Authentication Tag: h'efa4b5ac0108e3816c5606479801bc04'
 Payload Ciphertext: h'3a09c1e63fe23a7f66a59c7303837241
                       e070b02619fc59c5214a22f08cd70795
                       e73e9a' 
        </artwork>
            </figure>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.3.4.2">
            <name slugifiedName="name-abstract-security-block-4">Abstract Security Block</name>
            <t indent="0" pn="section-appendix.a.3.4.2-1">
            The abstract security block structure of the BCB's
            block-type-specific data field for this application is as follows.

            </t>
            <figure anchor="ex3_bcb_asb" align="left" suppress-title="false" pn="figure-20">
              <name slugifiedName="name-example-3-bcb-abstract-secu">Example 3 - BCB Abstract Security Block (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" markers="false" pn="section-appendix.a.3.4.2-2.1">
[1],             / Security Target        - Payload block      /
2,               / Security Context ID    - BCB-AES-GCM        /
1,               / Security Context Flags - Parameters Present /
[2,[2, 1]],      / Security Source        - ipn:2.1            /
[                / Security Parameters    - 3 Parameters       /
  [1, h'5477656c7665313231323132'],    / Initialization Vector /
  [2, 1],                              / AES Variant - AES 128 /
  [4, 0]                   / Scope Flags - No Additional Scope /
],
[                                 / Security Results: 1 Result /
  [
     [1, h'efa4b5ac0108e3816c5606479801bc04'] / Payload Auth. Tag /
  ]
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.3.4.2-3">
            The CBOR encoding of the BCB block-type-specific data field 
            (the abstract security block) is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.3.4.2-4">
0x8101020182028202018382014c5477656c76653132313231328202018204008181
820150efa4b5ac0108e3816c5606479801bc04
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.3.4.3">
            <name slugifiedName="name-representations-4">Representations</name>
            <t indent="0" pn="section-appendix.a.3.4.3-1">
            The complete BCB is as follows.

            </t>
            <figure anchor="ex3_bcb" align="left" suppress-title="false" pn="figure-21">
              <name slugifiedName="name-example-3-bcb-cbor-diagnost">Example 3 - BCB (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" markers="false" pn="section-appendix.a.3.4.3-2.1">
[
  12, / type code                                          /
  4,  / block number                                       /
  1,  / flags - block must be replicated in every fragment /
  0,  / CRC type                                           /
  h'8101020182028202018382014c5477656c766531323132313282020182040081
    81820150efa4b5ac0108e3816c5606479801bc04'
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.3.4.3-3">
            The CBOR encoding of the BCB block is: 
            </t>
            <sourcecode markers="false" pn="section-appendix.a.3.4.3-4">
0x850c04010058348101020182028202018382014c5477656c766531323132313282
02018204008181820150efa4b5ac0108e3816c5606479801bc04
</sourcecode>
          </section>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.3.5">
          <name slugifiedName="name-final-bundle-3">Final Bundle</name>
          <t indent="0" pn="section-appendix.a.3.5-1">
          The CBOR encoding of the full output bundle, with the BIB and BCB added is: 
          </t>
          <sourcecode markers="false" pn="section-appendix.a.3.5-2">
0x9f88070000820282010282028202018202820201820018281a000f4240850b0300
00585c8200020101820282030082820105820300828182015820cac6ce8e4c5dae57
988b757e49a6dd1431dc04763541b2845098265bc817241b81820158203ed614c0d9
7f49b3633627779aa18a338d212bf3c92b97759d9739cd50725596850c0401005834
8101020182028202018382014c5477656c7665313231323132820201820400818182
0150efa4b5ac0108e3816c5606479801bc0485070200004319012c85010100005823
3a09c1e63fe23a7f66a59c7303837241e070b02619fc59c5214a22f08cd70795e73e
9aff
</sourcecode>
        </section>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.4">
        <name slugifiedName="name-example-4-security-blocks-w">Example 4 - Security Blocks with Full Scope</name>
        <t indent="0" pn="section-appendix.a.4-1">
        This example shows the addition of a BIB and BCB to 
        a sample bundle. A BIB is added to provide integrity 
        over the payload block, and a BCB is added for 
        confidentiality over the payload and BIB.
        </t>
        <t indent="0" pn="section-appendix.a.4-2">
        The integrity scope and additional authentication data 
        will bind the primary block, target header, and the 
        security header.
        </t>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.4.1">
          <name slugifiedName="name-original-bundle-4">Original Bundle</name>
          <t indent="0" pn="section-appendix.a.4.1-1">
          The following diagram shows the original bundle before the
          security blocks have been added.
          </t>
          <figure align="left" suppress-title="false" pn="figure-22">
            <name slugifiedName="name-example-4-original-bundle">Example 4 - Original Bundle</name>
            <artwork align="center" pn="section-appendix.a.4.1-2.1">
                  Block                    Block   Block
                in Bundle                  Type    Number
+========================================+=======+========+
|  Primary Block                         |  N/A  |    0   |
+----------------------------------------+-------+--------+
|  Payload Block                         |   1   |    1   |
+----------------------------------------+-------+--------+
	    </artwork>
          </figure>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.4.1.1">
            <name slugifiedName="name-primary-block-4">Primary Block</name>
            <t indent="0" pn="section-appendix.a.4.1.1-1">
           The primary block used in this example is identical to the primary block
           presented for Example 1 in <xref target="ex_primary_block" format="default" sectionFormat="of" derivedContent="Appendix A.1.1.1"/>.
            </t>
            <t indent="0" pn="section-appendix.a.4.1.1-2"> 
            In summary, the CBOR encoding of the primary block is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.4.1.1-3">
0x88070000820282010282028202018202820201820018281a000f4240
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.4.1.2">
            <name slugifiedName="name-payload-block-4">Payload Block</name>
            <t indent="0" pn="section-appendix.a.4.1.2-1">
           The payload block used in this example is identical to the payload block
           presented for Example 1 in <xref target="ex_payload_block" format="default" sectionFormat="of" derivedContent="Appendix A.1.1.2"/>.
            </t>
            <t indent="0" pn="section-appendix.a.4.1.2-2"> 
            In summary, the CBOR encoding of the payload block is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.4.1.2-3">
0x85010100005823526561647920746f2067656e657261746520612033322d627974
65207061796c6f6164
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.4.1.3">
            <name slugifiedName="name-bundle-cbor-representation-4">Bundle CBOR Representation</name>
            <t indent="0" pn="section-appendix.a.4.1.3-1">
            A BPv7 bundle is represented as an indefinite-length array consisting
            of the blocks comprising the bundle, with a terminator character at
            the end. 
            </t>
            <t indent="0" pn="section-appendix.a.4.1.3-2">
            The CBOR encoding of the original bundle is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.4.1.3-3">
0x9f88070000820282010282028202018202820201820018281a000f424085010100
005823526561647920746f2067656e657261746520612033322d6279746520706179
6c6f6164ff
</sourcecode>
          </section>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.4.2">
          <name slugifiedName="name-security-operation-overview-4">Security Operation Overview</name>
          <t indent="0" pn="section-appendix.a.4.2-1">
          This example provides:

          </t>
          <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-appendix.a.4.2-2">
            <li pn="section-appendix.a.4.2-2.1"> 
              a BIB with the BIB-HMAC-SHA2 security context to provide an 
              integrity mechanism over the payload block.
            </li>
            <li pn="section-appendix.a.4.2-2.2">
              a BCB with the BCB-AES-GCM security context to provide a
              confidentiality mechanism over the payload block and BIB.
            </li>
          </ul>
          <t indent="0" pn="section-appendix.a.4.2-3">
          The following diagram shows the resulting bundle after the 
          security blocks are added.
          </t>
          <figure align="left" suppress-title="false" pn="figure-23">
            <name slugifiedName="name-example-4-resulting-bundle">Example 4 - Resulting Bundle</name>
            <artwork align="center" pn="section-appendix.a.4.2-4.1">
                  Block                    Block   Block
                in Bundle                  Type    Number
+========================================+=======+========+
|  Primary Block                         |  N/A  |    0   |
+----------------------------------------+-------+--------+
|  Block Integrity Block (Encrypted)     |   11  |    3   |
|  OP(bib-integrity, target=1)           |       |        |
+----------------------------------------+-------+--------+
|  Block Confidentiality Block           |   12  |    2   |
|  OP(bcb-confidentiality, targets=1, 3) |       |        |
+----------------------------------------+-------+--------+
|  Payload Block (Encrypted)             |   1   |    1   |
+----------------------------------------+-------+--------+
	    </artwork>
          </figure>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.4.3">
          <name slugifiedName="name-block-integrity-block-3">Block Integrity Block</name>
          <t indent="0" pn="section-appendix.a.4.3-1">
          In this example, a BIB is used to carry an integrity signature over
          the payload block. The IPPT contains the block-type-specific data
          of the payload block, the primary block data, the payload block
          header, and the BIB header. That is, all additional headers are
          included in the IPPT.
          </t>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.4.3.1">
            <name slugifiedName="name-configuration-parameters-and-re">Configuration, Parameters, and Results</name>
            <t indent="0" pn="section-appendix.a.4.3.1-1">
            For this example, the following configuration and security context
            parameters are used to generate the security results
            indicated.
            </t>
            <t indent="0" pn="section-appendix.a.4.3.1-2">
            This BIB has a single target and includes a single security
            result: the calculated signature over the Payload block.
            </t>
            <figure anchor="ex4_bib_cpr" align="left" suppress-title="false" pn="figure-24">
              <name slugifiedName="name-example-4-configuration-par">Example 4 - Configuration, Parameters, and Results for the BIB</name>
              <artwork name="" type="" alt="" align="center" pn="section-appendix.a.4.3.1-3.1">
               Key: h'1a2b1a2b1a2b1a2b1a2b1a2b1a2b1a2b'
       SHA Variant: HMAC 384/384                       
       Scope Flags: 0x07  (all additional headers)     
Primary Block Data: h'88070000820282010282028202018202
                      820201820018281a000f4240'         
      Payload Data: h'526561647920746f2067656e65726174
                      6520612033322d62797465207061796c
                      6f6164'
    Payload Header: h'010100'
        BIB Header: h'0b0300'
              IPPT: h'07880700008202820102820282020182
                      02820201820018281a000f4240010100
                      0b03005823526561647920746f206765
                      6e657261746520612033322d62797465
                      207061796c6f6164'
 Payload Signature: h'f75fe4c37f76f046165855bd5ff72fbf
                      d4e3a64b4695c40e2b787da005ae819f
                      0a2e30a2e8b325527de8aefb52e73d71,
        </artwork>
            </figure>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.4.3.2">
            <name slugifiedName="name-abstract-security-block-5">Abstract Security Block</name>
            <t indent="0" pn="section-appendix.a.4.3.2-1">
            The abstract security block structure of the BIB's
            block-type-specific data field for this application is as follows.

            </t>
            <figure anchor="ex4_bib_asb" align="left" suppress-title="false" pn="figure-25">
              <name slugifiedName="name-example-4-bib-abstract-secu">Example 4 - BIB Abstract Security Block (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" markers="false" pn="section-appendix.a.4.3.2-2.1">
[1],           / Security Target          - Payload block          /
1,             / Security Context ID      - BIB-HMAC-SHA2          /
1,             / Security Context Flags   - Parameters Present     /
[2,[2, 1]],    / Security Source          - ipn:2.1                /
[              / Security Parameters      - 2 Parameters           /
   [1, 6],     / SHA Variant              - HMAC 384/384           /
   [3, 0x07]   / Scope Flags              - All additional headers /
],
[              / Security Results: 1 Result                        /
  [            / Target 1 Results                                  /
    [1, h'f75fe4c37f76f046165855bd5ff72fbf         / MAC           /
          d4e3a64b4695c40e2b787da005ae819f
          0a2e30a2e8b325527de8aefb52e73d71']
  ]
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.4.3.2-3">

            The CBOR encoding of the BIB block-type-specific data field (the abstract security block) is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.4.3.2-4">
0x81010101820282020182820106820307818182015830f75fe4c37f76f046165855
bd5ff72fbfd4e3a64b4695c40e2b787da005ae819f0a2e30a2e8b325527de8aefb52
e73d71
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.4.3.3">
            <name slugifiedName="name-representations-5">Representations</name>
            <t indent="0" pn="section-appendix.a.4.3.3-1">
            The complete BIB is as follows.

            </t>
            <figure anchor="ex4_bib" align="left" suppress-title="false" pn="figure-26">
              <name slugifiedName="name-example-4-bib-cbor-diagnost">Example 4 - BIB (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" name="" markers="false" pn="section-appendix.a.4.3.3-2.1">
[
  11, / type code    /
  3,  / block number /
  0,  / flags        /
  0,  / CRC type     /
  h'81010101820282020182820106820307818182015830f75fe4c37f76f0461658
    55bd5ff72fbfd4e3a64b4695c40e2b787da005ae819f0a2e30a2e8b325527de8
    aefb52e73d71'
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.4.3.3-3">
            The CBOR encoding of the BIB block is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.4.3.3-4">
0x850b030000584681010101820282020182820106820307818182015830f75fe4c3
7f76f046165855bd5ff72fbfd4e3a64b4695c40e2b787da005ae819f0a2e30a2e8b3
25527de8aefb52e73d71
</sourcecode>
          </section>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.4.4">
          <name slugifiedName="name-block-confidentiality-block-3">Block Confidentiality Block</name>
          <t indent="0" pn="section-appendix.a.4.4-1">
        In this example, a BCB is used encrypt the payload
        block and the BIB that provides integrity over
        the payload. 
          </t>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.4.4.1">
            <name slugifiedName="name-configuration-parameters-and-res">Configuration, Parameters, and Results</name>
            <t indent="0" pn="section-appendix.a.4.4.1-1">
            For this example, the following configuration and security context
            parameters are used to generate the security results
            indicated.
            </t>
            <t indent="0" pn="section-appendix.a.4.4.1-2">
          This BCB has two targets: the payload block and BIB. Four
          security results are generated: ciphertext that
          replaces the plaintext block-type-specific data of the 
          payload block, ciphertext to encrypt the BIB, and authentication
          tags for both the payload block and BIB.
            </t>
            <figure anchor="ex4_bcb_cpr" align="left" suppress-title="false" pn="figure-27">
              <name slugifiedName="name-example-4-configuration-para">Example 4 - Configuration, Parameters, and Results for the BCB</name>
              <artwork name="" type="ascii-art" alt="" align="center" pn="section-appendix.a.4.4.1-3.1">
               Key: h'71776572747975696f70617364666768
                      71776572747975696f70617364666768'
                IV: h'5477656c7665313231323132'
       AES Variant: A256GCM
       Scope Flags: 0x07  (All additional headers)
      Payload Data: h'526561647920746f2067656e65726174
                      6520612033322d62797465207061796c
                      6f6164'
          BIB Data: h'81010101820282020182820106820307
                      818182015830f75fe4c37f76f0461658
                      55bd5ff72fbfd4e3a64b4695c40e2b78
                      7da005ae819f0a2e30a2e8b325527de8
                      aefb52e73d71'
 Primary Block Data: h'88070000820282010282028202018202
                       820201820018281a000f4240'
     Payload Header: h'010100'
         BIB Header: h'0b0300'
         BCB Header: h'0c0201'
        Payload AAD: h'07880700008202820102820282020182
                       02820201820018281a000f4240010100
                       0c0201'
            BIB AAD: h'07880700008202820102820282020182
                       02820201820018281a000f42400b0300
                       0c0201'
     Payload Block
Authentication Tag: h'd2c51cb2481792dae8b21d848cede99b'
               BIB
Authentication Tag: h'220ffc45c8a901999ecc60991dd78b29'
Payload Ciphertext: h'90eab6457593379298a8724e16e61f83
                      7488e127212b59ac91f8a86287b7d076
                      30a122'
    BIB Ciphertext: h'438ed6208eb1c1ffb94d952175167df0
                      902902064a2983910c4fb2340790bf42
                      0a7d1921d5bf7c4721e02ab87a93ab1e
                      0b75cf62e4948727c8b5dae46ed2af05
                      439b88029191'
</artwork>
            </figure>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.4.4.2">
            <name slugifiedName="name-abstract-security-block-6">Abstract Security Block</name>
            <t indent="0" pn="section-appendix.a.4.4.2-1">
          The abstract security block structure of the BCB's
          block-type-specific data field for this application is as follows.

            </t>
            <figure anchor="ex4_bcb_asb" align="left" suppress-title="false" pn="figure-28">
              <name slugifiedName="name-example-4-bcb-abstract-secu">Example 4 - BCB Abstract Security Block (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" markers="false" pn="section-appendix.a.4.4.2-2.1">
[3, 1],          / Security Targets                            /
2,               / Security Context ID    - BCB-AES-GCM        /
1,               / Security Context Flags - Parameters Present /
[2,[2, 1]],      / Security Source        - ipn:2.1            /
[                / Security Parameters    - 3 Parameters       /
  [1, h'5477656c7665313231323132'],    / Initialization Vector /
  [2, 3],                              / AES Variant - AES 256 /
  [4, 0x07]            / Scope Flags - All headers in SHA hash /
],
[                                / Security Results: 2 Results /
  [
     [1, h'220ffc45c8a901999ecc60991dd78b29']  / BIB Auth. Tag /
  ],
  [
     [1, h'd2c51cb2481792dae8b21d848cede99b'] / Payload Auth. Tag /
  ]
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.4.4.2-3">

          The CBOR encoding of the BCB block-type-specific data field 
          (the abstract security block) is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.4.4.2-4">
0x820301020182028202018382014c5477656c766531323132313282020382040782
81820150220ffc45c8a901999ecc60991dd78b2981820150d2c51cb2481792dae8b2
1d848cede99b
</sourcecode>
          </section>
          <section numbered="true" toc="exclude" removeInRFC="false" pn="section-appendix.a.4.4.3">
            <name slugifiedName="name-representations-6">Representations</name>
            <t indent="0" pn="section-appendix.a.4.4.3-1">
          The complete BCB is as follows.

            </t>
            <figure anchor="ex4_bcb" align="left" suppress-title="false" pn="figure-29">
              <name slugifiedName="name-example-4-bcb-cbor-diagnost">Example 4 - BCB (CBOR Diagnostic Notation)</name>
              <sourcecode type="cbor-diag" markers="false" pn="section-appendix.a.4.4.3-2.1">
[
  12, / type code                                          /
  2,  / block number                                       /
  1,  / flags - block must be replicated in every fragment /
  0,  / CRC type                                           /
  h'820301020182028202018382014c5477656c7665313231323132820203820407
    8281820150220ffc45c8a901999ecc60991dd78b2981820150d2c51cb2481792
    dae8b21d848cede99b'
]
</sourcecode>
            </figure>
            <t indent="0" pn="section-appendix.a.4.4.3-3">
            The CBOR encoding of the BCB block is:
            </t>
            <sourcecode markers="false" pn="section-appendix.a.4.4.3-4">
0x850c0201005849820301020182028202018382014c5477656c7665313231323132
8202038204078281820150220ffc45c8a901999ecc60991dd78b2981820150d2c51c
b2481792dae8b21d848cede99b
</sourcecode>
          </section>
        </section>
        <section numbered="true" toc="include" removeInRFC="false" pn="section-appendix.a.4.5">
          <name slugifiedName="name-final-bundle-4">Final Bundle</name>
          <t indent="0" pn="section-appendix.a.4.5-1">
        The CBOR encoding of the full output bundle, with the security blocks added and payload block and BIB encrypted is:</t>
          <sourcecode markers="false" pn="section-appendix.a.4.5-2">
0x9f88070000820282010282028202018202820201820018281a000f4240850b0300
005846438ed6208eb1c1ffb94d952175167df0902902064a2983910c4fb2340790bf
420a7d1921d5bf7c4721e02ab87a93ab1e0b75cf62e4948727c8b5dae46ed2af0543
9b88029191850c0201005849820301020182028202018382014c5477656c76653132
313231328202038204078281820150220ffc45c8a901999ecc60991dd78b29818201
50d2c51cb2481792dae8b21d848cede99b8501010000582390eab6457593379298a8
724e16e61f837488e127212b59ac91f8a86287b7d07630a122ff
</sourcecode>
        </section>
      </section>
    </section>
    <section anchor="cddl" toc="include" numbered="true" removeInRFC="false" pn="section-appendix.b">
      <name slugifiedName="name-cddl-expression">CDDL Expression</name>
      <t indent="0" pn="section-appendix.b-1"> 
  For informational purposes, this section contains an  
  expression of the IPPT and AAD structures using the Concise Data  
  Definition Language (CDDL). 
      </t>
      <t indent="0" pn="section-appendix.b-2">NOTES:</t>
      <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-appendix.b-3">
        <li pn="section-appendix.b-3.1">Wherever the CDDL expression is in disagreement with the textual representation of
      the security block specification presented in earlier sections of this document, 
      the textual representation rules.
      </li>
        <li pn="section-appendix.b-3.2">
      The structure of BP bundles and BPSec security blocks are provided by other
      specifications; this appendix only provides the CDDL expression for structures uniquely
      defined in this specification. Items related to elements of a bundle, such as "primary-block",
      are defined in <xref target="RFC9171" sectionFormat="of" section="B" format="default" derivedLink="https://rfc-editor.org/rfc/rfc9171#appendix-B" derivedContent="RFC9171">the Bundle Protocol version 7</xref>. 
      </li>
        <li pn="section-appendix.b-3.3">
      The CDDL itself does not have the concept of unadorned CBOR sequences as
      a top-level subject of a specification. The current best practice, as documented in 
      <xref target="RFC8742" sectionFormat="of" section="4.1" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8742#section-4.1" derivedContent="RFC8742"/>, requires representing the sequence as an
      array with a comment in the CDDL noting that the array represents a CBOR sequence.
      </li>
      </ul>
      <figure anchor="appendix_b" align="left" suppress-title="false" pn="figure-30">
        <name slugifiedName="name-ippt-and-aad-expressions">IPPT and AAD Expressions</name>
        <sourcecode type="cddl" name="" markers="false" pn="section-appendix.b-4.1">
start = scope / AAD-list / IPPT-list ; satisfy CDDL decoders

scope = uint .bits scope-flags
scope-flags = &amp;(
    has-primary-ctx: 0,
    has-target-ctx: 1,
    has-security-ctx: 2,
)

; Encoded as a CBOR sequence
AAD-list = [
    AAD-structure
]

; Encoded as a CBOR sequence
IPPT-list = [
    AAD-structure,
    target-btsd: bstr ; block-type-specific data of the target block.
]

AAD-structure = (
    scope,
    ? primary-block,  ; present if has-primary-ctx flag set
    ? block-metadata, ; present if has-target-ctx flag set
    ? block-metadata, ; present if has-security-ctx flag set
)

; Selected fields of a canonical block
block-metadata = (
    block-type-code: uint,
    block-number: uint,
    block-control-flags,
)
</sourcecode>
      </figure>
    </section>
    <section anchor="contr" toc="include" numbered="false" removeInRFC="false" pn="section-appendix.c">
      <name slugifiedName="name-acknowledgments">Acknowledgments</name>
      <t indent="0" pn="section-appendix.c-1">
         <contact fullname="Amy Alford"/> of the Johns Hopkins University Applied Physics 
         Laboratory contributed useful review and analysis of these
         security contexts. 
      </t>
      <t indent="0" pn="section-appendix.c-2"><contact fullname="Brian Sipos"/> kindly provided the CDDL expression in <xref target="cddl" format="default" sectionFormat="of" derivedContent="Appendix B"/>.
      </t>
    </section>
    <section anchor="authors-addresses" numbered="false" removeInRFC="false" toc="include" pn="section-appendix.d">
      <name slugifiedName="name-authors-addresses">Authors' Addresses</name>
      <author initials="E." surname="Birrane, III" fullname="Edward J. Birrane, III">
        <organization abbrev="JHU/APL" showOnFrontPage="true">The Johns Hopkins University Applied Physics Laboratory</organization>
        <address>
          <postal>
            <street>11100 Johns Hopkins Rd.</street>
            <city>Laurel</city>
            <region>MD</region>
            <code>20723</code>
            <country>US</country>
          </postal>
          <phone>+1 443 778 7423</phone>
          <email>Edward.Birrane@jhuapl.edu</email>
        </address>
      </author>
      <author fullname="Alex White" initials="A." surname="White">
        <organization abbrev="JHU/APL" showOnFrontPage="true">The Johns Hopkins University Applied Physics Laboratory</organization>
        <address>
          <postal>
            <street>11100 Johns Hopkins Rd.</street>
            <city>Laurel</city>
            <region>MD</region>
            <code>20723</code>
            <country>US</country>
          </postal>
          <phone>+1 443 778 0845</phone>
          <email>Alex.White@jhuapl.edu</email>
        </address>
      </author>
      <author fullname="Sarah Heiner" initials="S." surname="Heiner">
        <organization abbrev="JHU/APL" showOnFrontPage="true">The Johns Hopkins University Applied Physics Laboratory</organization>
        <address>
          <postal>
            <street>11100 Johns Hopkins Rd.</street>
            <city>Laurel</city>
            <region>MD</region>
            <code>20723</code>
            <country>US</country>
          </postal>
          <phone>+1 240 592 3704</phone>
          <email>Sarah.Heiner@jhuapl.edu</email>
        </address>
      </author>
    </section>
  </back>
</rfc>
