interest: remove deprecated setDefaultCanBePrefix()

Change-Id: Ifaffb7cc7772a31c3b396c60b816e783d70b7041
diff --git a/docs/examples.rst b/docs/examples.rst
index 7f0b2b4..08b3bdb 100644
--- a/docs/examples.rst
+++ b/docs/examples.rst
@@ -18,7 +18,7 @@
 .. literalinclude:: ../examples/consumer.cpp
    :language: c++
    :linenos:
-   :emphasize-lines: 43-49,52-55,63,77,83
+   :emphasize-lines: 43-48,51-54,62,76,82
 
 Trivial producer
 ----------------
@@ -64,4 +64,4 @@
 .. literalinclude:: ../examples/consumer-with-timer.cpp
    :language: c++
    :linenos:
-   :emphasize-lines: 37-38,54-57,60,91,104-107,112-114
+   :emphasize-lines: 47-50,53,84,96-99,104-106
diff --git a/examples/consumer-with-timer.cpp b/examples/consumer-with-timer.cpp
index 985b77e..87abfa9 100644
--- a/examples/consumer-with-timer.cpp
+++ b/examples/consumer-with-timer.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -33,12 +33,6 @@
 class ConsumerWithTimer
 {
 public:
-  ConsumerWithTimer()
-    : m_face(m_ioService) // Create face with io_service object
-    , m_scheduler(m_ioService)
-  {
-  }
-
   void
   run()
   {
@@ -46,7 +40,6 @@
     interestName.appendVersion();
 
     Interest interest(interestName);
-    interest.setCanBePrefix(false);
     interest.setMustBeFresh(true);
     interest.setInterestLifetime(2_s);
 
@@ -96,7 +89,6 @@
     interestName.appendVersion();
 
     Interest interest(interestName);
-    interest.setCanBePrefix(false);
     interest.setMustBeFresh(true);
     interest.setInterestLifetime(2_s);
 
@@ -110,8 +102,8 @@
 private:
   // Explicitly create io_service object, which will be shared between Face and Scheduler
   boost::asio::io_service m_ioService;
-  Face m_face;
-  Scheduler m_scheduler;
+  Face m_face{m_ioService};
+  Scheduler m_scheduler{m_ioService};
 };
 
 } // namespace examples
diff --git a/examples/consumer.cpp b/examples/consumer.cpp
index 6643812..f524962 100644
--- a/examples/consumer.cpp
+++ b/examples/consumer.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -44,7 +44,6 @@
     interestName.appendVersion();
 
     Interest interest(interestName);
-    interest.setCanBePrefix(false);
     interest.setMustBeFresh(true);
     interest.setInterestLifetime(6_s); // The default is 4 seconds
 
diff --git a/ndn-cxx/interest.cpp b/ndn-cxx/interest.cpp
index 8edb092..ad4b40e 100644
--- a/ndn-cxx/interest.cpp
+++ b/ndn-cxx/interest.cpp
@@ -40,17 +40,12 @@
 static_assert(std::is_base_of<tlv::Error, Interest::Error>::value,
               "Interest::Error must inherit from tlv::Error");
 
-boost::logic::tribool Interest::s_defaultCanBePrefix = boost::logic::indeterminate;
 bool Interest::s_autoCheckParametersDigest = true;
 
 Interest::Interest(const Name& name, time::milliseconds lifetime)
 {
   setName(name);
   setInterestLifetime(lifetime);
-
-  if (!boost::logic::indeterminate(s_defaultCanBePrefix)) {
-    setCanBePrefix(bool(s_defaultCanBePrefix));
-  }
 }
 
 Interest::Interest(const Block& wire)
diff --git a/ndn-cxx/interest.hpp b/ndn-cxx/interest.hpp
index e470aa8..92bb582 100644
--- a/ndn-cxx/interest.hpp
+++ b/ndn-cxx/interest.hpp
@@ -32,7 +32,6 @@
 #include <array>
 
 #include <boost/endian/conversion.hpp>
-#include <boost/logic/tribool.hpp>
 
 namespace ndn {
 
@@ -181,26 +180,6 @@
   Interest&
   setName(const Name& name);
 
-  /** @brief Declare the default CanBePrefix setting of the application.
-   *
-   *  As part of transitioning to NDN Packet Format v0.3, the default setting for CanBePrefix
-   *  has been changed from "true" to "false". Application developers are advised to review all
-   *  Interests expressed by their applications and decide what CanBePrefix setting is appropriate
-   *  for each Interest. Applications must set CanBePrefix on a per-Interest basis, if different
-   *  from the default value. Changing the application-wide default CanBePrefix setting via this
-   *  function is deprecated.
-   *
-   *  @deprecated
-   *  @note This function should not be used in libraries or in ndn-cxx unit tests.
-   *  @sa https://redmine.named-data.net/projects/nfd/wiki/Packet03Transition
-   */
-  [[deprecated]]
-  static void
-  setDefaultCanBePrefix(bool canBePrefix)
-  {
-    s_defaultCanBePrefix = canBePrefix;
-  }
-
   /** @brief Check whether the CanBePrefix element is present.
    */
   bool
@@ -489,7 +468,6 @@
   findFirstParameter(uint32_t type) const;
 
 private:
-  static boost::logic::tribool s_defaultCanBePrefix;
   static bool s_autoCheckParametersDigest;
 
   Name m_name;
diff --git a/ndn-cxx/security/interest-signer.cpp b/ndn-cxx/security/interest-signer.cpp
index 31f1427..5b12c83 100644
--- a/ndn-cxx/security/interest-signer.cpp
+++ b/ndn-cxx/security/interest-signer.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -69,7 +69,6 @@
     .append(name::Component::fromNumber(random::generateWord64())) // nonce
     ;
   interest.setName(name);
-  interest.setCanBePrefix(false);
   m_keyChain.sign(interest, params);
   return interest;
 }
diff --git a/ndn-cxx/util/notification-subscriber.cpp b/ndn-cxx/util/notification-subscriber.cpp
index ce9b395..deaf8be 100644
--- a/ndn-cxx/util/notification-subscriber.cpp
+++ b/ndn-cxx/util/notification-subscriber.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019 Regents of the University of California,
+ * Copyright (c) 2014-2022 Regents of the University of California,
  *                         Arizona Board of Regents,
  *                         Colorado State University,
  *                         University Pierre & Marie Curie, Sorbonne University,
@@ -91,7 +91,6 @@
   nextName.appendSequenceNumber(m_lastSequenceNum + 1);
 
   auto interest = make_shared<Interest>(nextName);
-  interest->setCanBePrefix(false);
   interest->setInterestLifetime(m_interestLifetime);
   sendInterest(*interest);
 }
diff --git a/tests/integration/default-can-be-prefix-0.cpp b/tests/integration/default-can-be-prefix-0.cpp
deleted file mode 100644
index 102e274..0000000
--- a/tests/integration/default-can-be-prefix-0.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2020 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#define BOOST_TEST_MODULE ndn-cxx Integration (DefaultCanBePrefix)
-#include "tests/boost-test.hpp"
-
-#include "ndn-cxx/interest.hpp"
-
-namespace ndn {
-namespace tests {
-
-BOOST_AUTO_TEST_CASE(DefaultCanBePrefix0)
-{
-  Interest::setDefaultCanBePrefix(false);
-  Interest interest1("/I");
-  Interest interest2(interest1.wireEncode());
-  BOOST_CHECK_EQUAL(interest2.getCanBePrefix(), false);
-}
-
-} // namespace tests
-} // namespace ndn
diff --git a/tests/integration/default-can-be-prefix-1.cpp b/tests/integration/default-can-be-prefix-1.cpp
deleted file mode 100644
index d5659a3..0000000
--- a/tests/integration/default-can-be-prefix-1.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2020 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#define BOOST_TEST_MODULE ndn-cxx Integration (DefaultCanBePrefix)
-#include "tests/boost-test.hpp"
-
-#include "ndn-cxx/interest.hpp"
-
-namespace ndn {
-namespace tests {
-
-BOOST_AUTO_TEST_CASE(DefaultCanBePrefix1)
-{
-  Interest::setDefaultCanBePrefix(true);
-  Interest interest1("/I");
-  Interest interest2(interest1.wireEncode());
-  BOOST_CHECK_EQUAL(interest2.getCanBePrefix(), true);
-}
-
-} // namespace tests
-} // namespace ndn
diff --git a/tests/integration/default-can-be-prefix.README.md b/tests/integration/default-can-be-prefix.README.md
deleted file mode 100644
index 23b01ae..0000000
--- a/tests/integration/default-can-be-prefix.README.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# DefaultCanBePrefix test
-
-`default-can-be-prefix-*.cpp` verifies the effect of `Interest::setDefaultCanBePrefix`.
-They are written as integration tests because ndn-cxx unit tests are prohibited from calling `Interest::setDefaultCanBePrefix`.
-
-Manual verification steps:
-
-1. `default-can-be-prefix-unset` program should print a "CanBePrefix unset" warning to stderr.
-2. `default-can-be-prefix-0` and `default-can-be-prefix-1` test cases should not print that warning.
-
diff --git a/tests/unit/interest.t.cpp b/tests/unit/interest.t.cpp
index ff50e8a..903d9bb 100644
--- a/tests/unit/interest.t.cpp
+++ b/tests/unit/interest.t.cpp
@@ -82,7 +82,6 @@
 
   Interest i1;
   i1.setName("/local/ndn/prefix");
-  i1.setCanBePrefix(false);
   i1.setNonce(0x01020304);
   BOOST_CHECK_EQUAL(i1.isParametersDigestValid(), true);
 
@@ -125,7 +124,6 @@
 
   Interest i1;
   i1.setName("/local/ndn/prefix");
-  i1.setCanBePrefix(false);
   i1.setNonce(0x1);
   i1.setApplicationParameters("2404C0C1C2C3"_block);
   BOOST_CHECK_EQUAL(i1.isParametersDigestValid(), true);
@@ -265,7 +263,6 @@
   BOOST_CHECK_EQUAL_COLLECTIONS(wire1.begin(), wire1.end(), WIRE, WIRE + sizeof(WIRE));
 
   Interest i2("/local/ndn/prefix");
-  i2.setCanBePrefix(false);
   i2.setMustBeFresh(true);
   i2.setNonce(0x4c1ecb4a);
   i2.setApplicationParameters("2404C0C1C2C3"_block);
@@ -347,7 +344,6 @@
 {
   Interest i;
   i.setName(Name("/A").appendParametersSha256DigestPlaceholder());
-  i.setCanBePrefix(false);
   BOOST_CHECK_EQUAL(i.isParametersDigestValid(), false);
   BOOST_CHECK_EXCEPTION(i.wireEncode(), tlv::Error, [] (const auto& e) {
     return e.what() == "Interest without parameters must not have a ParametersSha256DigestComponent"s;
@@ -783,7 +779,6 @@
 BOOST_AUTO_TEST_CASE(SetNonce)
 {
   Interest i1("/A");
-  i1.setCanBePrefix(false);
   BOOST_CHECK(!i1.hasNonce());
 
   i1.setNonce(1);
@@ -820,7 +815,6 @@
 BOOST_AUTO_TEST_CASE(NonceConversions)
 {
   Interest i;
-  i.setCanBePrefix(false);
 
   // 4-arg constructor
   Interest::Nonce n1(1, 2, 3, 4);
@@ -908,7 +902,6 @@
 BOOST_AUTO_TEST_CASE(SetSignature)
 {
   Interest i;
-  i.setCanBePrefix(false);
   BOOST_CHECK(i.getSignatureInfo() == nullopt);
   BOOST_CHECK_EQUAL(i.isSigned(), false);
 
@@ -1055,7 +1048,6 @@
 BOOST_AUTO_TEST_CASE(ExtractSignedRanges)
 {
   Interest i1;
-  i1.setCanBePrefix(false);
   BOOST_CHECK_EXCEPTION(i1.extractSignedRanges(), tlv::Error, [] (const auto& e) {
     return e.what() == "Name has zero name components"s;
   });
@@ -1136,7 +1128,6 @@
 
   // Test failure with missing ParametersSha256DigestComponent
   Interest i3("/a");
-  i3.setCanBePrefix(false);
   BOOST_CHECK_EXCEPTION(i3.extractSignedRanges(), tlv::Error, [] (const auto& e) {
     return e.what() == "Interest Name must end with a ParametersSha256DigestComponent"s;
   });
@@ -1151,7 +1142,6 @@
 BOOST_AUTO_TEST_CASE(ToUri)
 {
   Interest i;
-  i.setCanBePrefix(false);
   BOOST_CHECK_EQUAL(i.toUri(), "/");
 
   i.setName("/foo");
diff --git a/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp b/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp
index 7757f5b..bc134a1 100644
--- a/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp
+++ b/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -74,9 +74,7 @@
     cache.insert(subSubIdentity.getDefaultKey().getDefaultCertificate());
 
     m_keyChain.sign(data, signingByIdentity(subSubIdentity));
-    interest.setCanBePrefix(false);
     m_keyChain.sign(interest, signingByIdentity(subSubIdentity));
-    interestNoTag.setCanBePrefix(false);
     m_keyChain.sign(interestNoTag, signingByIdentity(subSubIdentity));
 
     data.setTag(make_shared<lp::IncomingFaceIdTag>(123));
diff --git a/tests/unit/security/certificate-fetcher-from-network.t.cpp b/tests/unit/security/certificate-fetcher-from-network.t.cpp
index 36a1ae9..29d8243 100644
--- a/tests/unit/security/certificate-fetcher-from-network.t.cpp
+++ b/tests/unit/security/certificate-fetcher-from-network.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -62,7 +62,6 @@
     cache.insert(subSubIdentity.getDefaultKey().getDefaultCertificate());
 
     m_keyChain.sign(data, signingByIdentity(subSubIdentity));
-    interest.setCanBePrefix(false);
     m_keyChain.sign(interest, signingByIdentity(subSubIdentity));
 
     processInterest = [this] (const Interest& i) { makeResponse(i); };
diff --git a/tests/unit/security/interest-signer.t.cpp b/tests/unit/security/interest-signer.t.cpp
index 735668c..b4a3991 100644
--- a/tests/unit/security/interest-signer.t.cpp
+++ b/tests/unit/security/interest-signer.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -75,10 +75,9 @@
 
   InterestSigner signer(m_keyChain);
   Interest i1("/hello/world");
-  i1.setCanBePrefix(false);
   signer.makeSignedInterest(i1, SigningInfo(),
                             InterestSigner::SigningFlags::WantNonce |
-                              InterestSigner::SigningFlags::WantTime);
+                            InterestSigner::SigningFlags::WantTime);
   BOOST_TEST(i1.isSigned() == true);
   BOOST_TEST_REQUIRE(i1.getName().size() == 3);
   BOOST_TEST_REQUIRE(i1.getSignatureInfo().has_value());
@@ -88,11 +87,10 @@
   BOOST_TEST(i1.getSignatureInfo()->getSeqNum().has_value() == false);
 
   Interest i2("/hello/world/!");
-  i2.setCanBePrefix(false);
   signer.makeSignedInterest(i2, signingByIdentity("/test"),
                             InterestSigner::SigningFlags::WantNonce |
-                              InterestSigner::SigningFlags::WantTime |
-                              InterestSigner::SigningFlags::WantSeqNum);
+                            InterestSigner::SigningFlags::WantTime |
+                            InterestSigner::SigningFlags::WantSeqNum);
   BOOST_TEST(i2.isSigned() == true);
   BOOST_REQUIRE_EQUAL(i2.getName().size(), 4);
   BOOST_REQUIRE(i2.getSignatureInfo());
@@ -104,7 +102,6 @@
   advanceClocks(100_s);
 
   Interest i3("/hello/world/2");
-  i3.setCanBePrefix(false);
   signer.makeSignedInterest(i3, SigningInfo(), InterestSigner::SigningFlags::WantSeqNum);
   BOOST_TEST(i3.isSigned() == true);
   BOOST_REQUIRE_EQUAL(i3.getName().size(), 4);
diff --git a/tests/unit/security/key-chain.t.cpp b/tests/unit/security/key-chain.t.cpp
index ec40fbd..1e35aef 100644
--- a/tests/unit/security/key-chain.t.cpp
+++ b/tests/unit/security/key-chain.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -341,7 +341,7 @@
 
 struct InterestV02Pkt
 {
-  Interest packet = Interest{"/interest02"}.setCanBePrefix(false);
+  Interest packet{"/interest02"};
   SignedInterestFormat sigFormat = SignedInterestFormat::V02;
 
   SignatureInfo
@@ -353,7 +353,7 @@
 
 struct InterestV03Pkt
 {
-  Interest packet = Interest{"/interest03"}.setCanBePrefix(false);
+  Interest packet{"/interest03"};
   SignedInterestFormat sigFormat = SignedInterestFormat::V03;
 
   SignatureInfo
diff --git a/tests/unit/security/validation-policy-command-interest.t.cpp b/tests/unit/security/validation-policy-command-interest.t.cpp
index 4fe05b7..cf91ee3 100644
--- a/tests/unit/security/validation-policy-command-interest.t.cpp
+++ b/tests/unit/security/validation-policy-command-interest.t.cpp
@@ -69,7 +69,6 @@
   {
     if (wantV3) {
       Interest i(Name(identity.getName()).append("CMD"));
-      i.setCanBePrefix(false);
       m_signer.makeSignedInterest(i, signingByIdentity(identity));
       return i;
     }
@@ -113,7 +112,6 @@
   VALIDATE_SUCCESS(i2, "Should succeed (timestamp larger than previous)");
 
   Interest i3(Name(identity.getName()).append("CMD"));
-  i3.setCanBePrefix(false);
   m_signer.makeSignedInterest(i3, signingWithSha256());
   VALIDATE_FAILURE(i3, "Should fail (Sha256 signature violates policy)");
 }
diff --git a/tests/unit/security/validation-policy-config.t.cpp b/tests/unit/security/validation-policy-config.t.cpp
index 83de50e..32fbf01 100644
--- a/tests/unit/security/validation-policy-config.t.cpp
+++ b/tests/unit/security/validation-policy-config.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -56,7 +56,6 @@
   VALIDATE_FAILURE(d, "Empty policy should reject everything");
 
   Interest i("/Security/ValidationPolicyConfig/I");
-  i.setCanBePrefix(false);
   this->m_keyChain.sign(i, signingByIdentity(this->identity));
   VALIDATE_FAILURE(i, "Empty policy should reject everything");
 }
@@ -412,9 +411,6 @@
 
   using Packet = typename Policy::Packet;
   Packet unsignedPacket("/Security/ValidatorFixture/Sub1/Sub2/Packet");
-  // All of the packet types inputed to this test case template are Interests, so we can call
-  // setCanBePrefix
-  unsignedPacket.setCanBePrefix(false);
 
   Packet packet = unsignedPacket;
   VALIDATE_FAILURE(packet, "Unsigned");
@@ -484,7 +480,6 @@
 
 
   Interest interest("/Security/ValidatorFixture/Sub1/Sub2/Packet");
-  interest.setCanBePrefix(false);
   this->m_keyChain.sign(interest, signingWithSha256());
   VALIDATE_SUCCESS(interest, "Should be accepted");
 
@@ -557,7 +552,6 @@
 
 
   Interest interest("/localhost/identity/digest-sha256/foobar");
-  interest.setCanBePrefix(false);
   this->m_keyChain.sign(interest, signingWithSha256());
   VALIDATE_SUCCESS(interest, "Should be accepted");
 
@@ -630,7 +624,6 @@
 
 
   Interest interest("/localhost/identity/digest-sha256/foobar");
-  interest.setCanBePrefix(false);
   this->m_keyChain.sign(interest, signingWithSha256());
   VALIDATE_FAILURE(interest, "Signature type check should fail");
 
diff --git a/tests/unit/security/validation-policy-signed-interest.t.cpp b/tests/unit/security/validation-policy-signed-interest.t.cpp
index d9cddb5..c3d37e6 100644
--- a/tests/unit/security/validation-policy-signed-interest.t.cpp
+++ b/tests/unit/security/validation-policy-signed-interest.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -75,7 +75,6 @@
                      uint32_t signingFlags = InterestSigner::WantNonce | InterestSigner::WantTime)
   {
     Interest i(Name(identity.getName()).append("CMD"));
-    i.setCanBePrefix(false);
     m_signer.makeSignedInterest(i, signingByIdentity(identity), signingFlags);
     return i;
   }
@@ -102,7 +101,6 @@
   VALIDATE_SUCCESS(i2, "Should succeed (timestamp and sequence number larger than previous)");
 
   Interest i3(Name(identity.getName()).append("CMD"));
-  i3.setCanBePrefix(false);
   m_signer.makeSignedInterest(i3, signingWithSha256());
   VALIDATE_FAILURE(i3, "Should fail (Sha256 signature violates policy)");
 }
diff --git a/tests/unit/security/validator-config.t.cpp b/tests/unit/security/validator-config.t.cpp
index 573282f..391879d 100644
--- a/tests/unit/security/validator-config.t.cpp
+++ b/tests/unit/security/validator-config.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -157,7 +157,6 @@
 
   InterestSigner signer(m_keyChain);
   Interest i1("/hello/world");
-  i1.setCanBePrefix(false);
   signer.makeSignedInterest(i1);
   size_t nValidated = 0, nFailed = 0;
 
@@ -170,7 +169,6 @@
   BOOST_CHECK_EQUAL(nFailed, 1);
 
   Interest i2("/hello/world");
-  i2.setCanBePrefix(false);
   signer.makeSignedInterest(i2, signingWithSha256());
   validator.validate(i2, [&] (auto&&...) { ++nValidated; }, [&] (auto&&...) { ++nFailed; });
   BOOST_CHECK_EQUAL(nValidated, 2);
diff --git a/tests/unit/security/validator-fixture.cpp b/tests/unit/security/validator-fixture.cpp
index 7a7ee14..5d50794 100644
--- a/tests/unit/security/validator-fixture.cpp
+++ b/tests/unit/security/validator-fixture.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -79,7 +79,6 @@
 InterestV02Pkt::makeName(Name name, KeyChain& keyChain)
 {
   Interest interest(name);
-  interest.setCanBePrefix(false);
   SigningInfo params;
   params.setSignedInterestFormat(SignedInterestFormat::V02);
   keyChain.sign(interest, params);
@@ -90,7 +89,6 @@
 InterestV03Pkt::makeName(Name name, KeyChain& keyChain)
 {
   Interest interest(name);
-  interest.setCanBePrefix(false);
   SigningInfo params;
   params.setSignedInterestFormat(SignedInterestFormat::V03);
   keyChain.sign(interest, params);
diff --git a/tests/unit/security/validator-fixture.hpp b/tests/unit/security/validator-fixture.hpp
index c56a014..25cbe93 100644
--- a/tests/unit/security/validator-fixture.hpp
+++ b/tests/unit/security/validator-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -212,7 +212,7 @@
   static Interest
   makePacket(const Name& name)
   {
-    return Interest(name).setCanBePrefix(false);
+    return Interest(name);
   }
 
   static shared_ptr<ValidationState>
@@ -238,7 +238,7 @@
   static Interest
   makePacket(const Name& name)
   {
-    return Interest(name).setCanBePrefix(false);
+    return Interest(name);
   }
 
   static shared_ptr<ValidationState>
diff --git a/tests/unit/security/validator.t.cpp b/tests/unit/security/validator.t.cpp
index adf72d3..75ab618 100644
--- a/tests/unit/security/validator.t.cpp
+++ b/tests/unit/security/validator.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -209,7 +209,6 @@
                         HierarchicalValidatorFixture<ValidationPolicySimpleHierarchyForInterestOnly>)
 {
   Interest interest("/Security/ValidatorFixture/Sub1/Sub2/Interest");
-  interest.setCanBePrefix(false);
   Data data("/Security/ValidatorFixture/Sub1/Sub2/Interest");
 
   VALIDATE_FAILURE(interest, "Unsigned");
@@ -218,7 +217,6 @@
   face.sentInterests.clear();
 
   interest = Interest("/Security/ValidatorFixture/Sub1/Sub2/Interest");
-  interest.setCanBePrefix(false);
   m_keyChain.sign(interest, signingWithSha256());
   m_keyChain.sign(data, signingWithSha256());
   VALIDATE_FAILURE(interest, "Required KeyLocator/Name missing (not passed to policy)");
diff --git a/tests/unit/security/verification-helpers.t.cpp b/tests/unit/security/verification-helpers.t.cpp
index 5e313ec..e3ecc86 100644
--- a/tests/unit/security/verification-helpers.t.cpp
+++ b/tests/unit/security/verification-helpers.t.cpp
@@ -97,7 +97,6 @@
 //     Interest interest1(Name("/test/interest").append(type));
 //     SigningInfo signingInfoV03(signingInfo);
 //     signingInfoV03.setSignedInterestFormat(SignedInterestFormat::V03);
-//     interest1.setCanBePrefix(false);
 //     interest1.setNonce(0xF72C8A4B);
 //     m_keyChain.sign(interest1, signingInfoV03);
 //     print("goodInterest", interest1.wireEncode().wire(), interest1.wireEncode().size());
@@ -113,7 +112,6 @@
 //     Interest interest2(Name("/test/interest").append(type));
 //     SigningInfo signingInfoV02(signingInfo);
 //     signingInfoV02.setSignedInterestFormat(SignedInterestFormat::V03);
-//     interest2.setCanBePrefix(false);
 //     interest2.setNonce(0xF72C8A4B);
 //     m_keyChain.sign(interest2, signingInfoV02);
 //     print("goodInterestOldFormat", interest2.wireEncode().wire(), interest2.wireEncode().size());
@@ -580,9 +578,7 @@
 
   Data unsignedData("/some/data");
   Interest unsignedInterest1("/some/interest/with/several/name/components");
-  unsignedInterest1.setCanBePrefix(false);
   Interest unsignedInterest2("/interest-with-one-name-component");
-  unsignedInterest2.setCanBePrefix(false);
 
   BOOST_CHECK(!verifySignature(unsignedData, cert));
   BOOST_CHECK(!verifySignature(unsignedData, key));
@@ -605,9 +601,7 @@
   const Tpm& tpm = m_keyChain.getTpm();
   Data data("/data");
   Interest interest("/interest");
-  interest.setCanBePrefix(false);
   Interest interestOldFormat("/interest");
-  interestOldFormat.setCanBePrefix(false);
   SigningInfo signingInfo;
   signingInfo.setSigningHmacKey("QjM3NEEyNkE3MTQ5MDQzN0FBMDI0RTRGQURENUI0OTdGREZGMUE4RUE2RkYxMkY2"
                                 "RkI2NUFGMjcyMEI1OUNDRg==");
@@ -649,9 +643,7 @@
 
   Data unsignedData("/some/data");
   Interest unsignedInterest1("/some/interest/with/several/name/components");
-  unsignedInterest1.setCanBePrefix(false);
   Interest unsignedInterest2("/interest-with-one-name-component");
-  unsignedInterest2.setCanBePrefix(false);
 
   BOOST_CHECK(!verifySignature(unsignedData, nullopt));
   BOOST_CHECK(!verifySignature(unsignedInterest1, nullopt));