Replace all uses of BOOST_THROW_EXCEPTION with NDN_THROW
Refs: #4834
Change-Id: Ic63e276b7174f3af12af67daa9cad4586b43b9e6
diff --git a/src/access-manager.cpp b/src/access-manager.cpp
index 368c44a..a759f2d 100644
--- a/src/access-manager.cpp
+++ b/src/access-manager.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-2020, Regents of the University of California
*
* NAC 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
@@ -20,6 +20,7 @@
#include "access-manager.hpp"
#include "encrypted-content.hpp"
+#include <ndn-cxx/security/signing-helpers.hpp>
#include <ndn-cxx/util/logger.hpp>
NDN_LOG_INIT(nac.AccessManager);
diff --git a/src/common.hpp b/src/common.hpp
index 0c762ce..1f95504 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2020, Regents of the University of California
*
* NAC library is free software: you can redistribute it and/or modify it under the
@@ -48,13 +48,9 @@
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/ims/in-memory-storage-persistent.hpp>
#include <ndn-cxx/interest.hpp>
-#include <ndn-cxx/link.hpp>
#include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/security/signing-helpers.hpp>
-#include <ndn-cxx/security/transform/block-cipher.hpp>
-#include <ndn-cxx/security/transform/buffer-source.hpp>
+#include <ndn-cxx/security/signing-info.hpp>
#include <ndn-cxx/security/transform/public-key.hpp>
-#include <ndn-cxx/security/transform/stream-sink.hpp>
#include <ndn-cxx/security/validation-callback.hpp>
#include <ndn-cxx/security/validation-error.hpp>
#include <ndn-cxx/security/validator-null.hpp>
@@ -63,7 +59,6 @@
#include <ndn-cxx/util/signal.hpp>
#include <boost/algorithm/string.hpp>
-#include <boost/asio.hpp>
#include <boost/assert.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/noncopyable.hpp>
@@ -131,8 +126,7 @@
EncryptionFailure = 103
};
-using ErrorCallback = std::function<void (const ErrorCode&, const std::string&)>;
-
+using ErrorCallback = std::function<void(const ErrorCode&, const std::string&)>;
class Error : public std::runtime_error
{
diff --git a/src/decryptor.cpp b/src/decryptor.cpp
index 80ccb93..1630080 100644
--- a/src/decryptor.cpp
+++ b/src/decryptor.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-2020, Regents of the University of California
*
* NAC 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
@@ -19,6 +19,10 @@
#include "decryptor.hpp"
+#include <ndn-cxx/security/transform/block-cipher.hpp>
+#include <ndn-cxx/security/transform/buffer-source.hpp>
+#include <ndn-cxx/security/transform/stream-sink.hpp>
+#include <ndn-cxx/util/exception.hpp>
#include <ndn-cxx/util/logger.hpp>
namespace ndn {
@@ -251,7 +255,7 @@
const ErrorCallback& onFailure)
{
if (!content.hasIv()) {
- BOOST_THROW_EXCEPTION(Error("Expecting Initial Vector in the encrypted content, but it is not present"));
+ NDN_THROW(Error("Expecting Initialization Vector in the encrypted content, but it is not present"));
}
OBufferStream os;
diff --git a/src/encrypted-content.cpp b/src/encrypted-content.cpp
index 20c9886..4bc3d44 100644
--- a/src/encrypted-content.cpp
+++ b/src/encrypted-content.cpp
@@ -21,6 +21,7 @@
#include <ndn-cxx/encoding/block-helpers.hpp>
#include <ndn-cxx/util/concepts.hpp>
+#include <ndn-cxx/util/exception.hpp>
namespace ndn {
namespace nac {
@@ -153,7 +154,7 @@
totalLength += block.prependBlock(m_payload);
}
else {
- BOOST_THROW_EXCEPTION(Error("Required EncryptedPayload is not set on EncryptedContent"));
+ NDN_THROW(Error("Required EncryptedPayload is not set on EncryptedContent"));
}
totalLength += block.prependVarNumber(totalLength);
@@ -181,7 +182,7 @@
EncryptedContent::wireDecode(const Block& wire)
{
if (!wire.hasWire()) {
- BOOST_THROW_EXCEPTION(Error("The supplied block does not contain wire format"));
+ NDN_THROW(Error("The supplied block does not contain wire format"));
}
m_payload.reset();
@@ -192,8 +193,8 @@
m_wire.parse();
if (m_wire.type() != tlv::EncryptedContent) {
- BOOST_THROW_EXCEPTION(Error("Unexpected TLV type (expecting EncryptedContent, got" +
- ndn::to_string(m_wire.type()) + ")"));
+ NDN_THROW(Error("Unexpected TLV type (expecting EncryptedContent, got " +
+ ndn::to_string(m_wire.type()) + ")"));
}
auto block = m_wire.find(tlv::EncryptedPayload);
@@ -201,7 +202,7 @@
m_payload = *block;
}
else {
- BOOST_THROW_EXCEPTION(Error("Required EncryptedPayload not found in EncryptedContent"));
+ NDN_THROW(Error("Required EncryptedPayload not found in EncryptedContent"));
}
block = m_wire.find(tlv::InitializationVector);
diff --git a/src/encryptor.cpp b/src/encryptor.cpp
index efee391..5059eba 100644
--- a/src/encryptor.cpp
+++ b/src/encryptor.cpp
@@ -19,8 +19,10 @@
#include "encryptor.hpp"
+#include <ndn-cxx/security/transform/block-cipher.hpp>
+#include <ndn-cxx/security/transform/buffer-source.hpp>
+#include <ndn-cxx/security/transform/stream-sink.hpp>
#include <ndn-cxx/util/logger.hpp>
-#include <boost/lexical_cast.hpp>
namespace ndn {
namespace nac {
@@ -112,7 +114,7 @@
EncryptedContent
Encryptor::encrypt(const uint8_t* data, size_t size)
{
- // Generate initial vector
+ // Generate IV
auto iv = make_shared<Buffer>(AES_IV_SIZE);
random::generateSecureBytes(iv->data(), iv->size());