diff --git a/src/management/nfd-control-command.cpp b/src/management/nfd-control-command.cpp
index d92245c..3c87d3f 100644
--- a/src/management/nfd-control-command.cpp
+++ b/src/management/nfd-control-command.cpp
@@ -65,24 +65,6 @@
   return name;
 }
 
-const Name&
-ControlCommand::getPrefix() const
-{
-  // m_prefix is needed because we can't return a local variable as a reference,
-  // and changing the "const Name&" return type to "Name" may cause incompatibility
-  if (m_prefix.empty()) {
-    m_prefix.append(CommandOptions::DEFAULT_PREFIX);
-    m_prefix.append(m_module).append(m_verb);
-  }
-  return m_prefix;
-}
-
-Name
-ControlCommand::getRequestName(const ControlParameters& parameters) const
-{
-  return this->getRequestName(CommandOptions::DEFAULT_PREFIX, parameters);
-}
-
 ControlCommand::FieldValidator::FieldValidator()
   : m_required(CONTROL_PARAMETER_UBOUND)
   , m_optional(CONTROL_PARAMETER_UBOUND)
diff --git a/src/management/nfd-control-command.hpp b/src/management/nfd-control-command.hpp
index 9c1d2ea..a7b8bc6 100644
--- a/src/management/nfd-control-command.hpp
+++ b/src/management/nfd-control-command.hpp
@@ -75,22 +75,6 @@
   Name
   getRequestName(const Name& commandPrefix, const ControlParameters& parameters) const;
 
-public: // deprecated
-  /** \return Name prefix of this ControlCommand
-   *  \deprecated use getRequestName
-   */
-  DEPRECATED(
-  const Name&
-  getPrefix() const);
-
-  /** \brief construct the Name for a request Interest
-   *  \throw ArgumentError if parameters are invalid
-   *  \deprecated use the two-argument overload
-   */
-  DEPRECATED(
-  Name
-  getRequestName(const ControlParameters& parameters) const);
-
 protected:
   ControlCommand(const std::string& module, const std::string& verb);
 
@@ -144,10 +128,6 @@
 private:
   name::Component m_module;
   name::Component m_verb;
-
-  /** \deprecated kept to support getPrefix
-   */
-  mutable Name m_prefix;
 };
 
 
diff --git a/src/management/nfd-controller.cpp b/src/management/nfd-controller.cpp
index 90cd454..c5d06d4 100644
--- a/src/management/nfd-controller.cpp
+++ b/src/management/nfd-controller.cpp
@@ -29,13 +29,6 @@
 const uint32_t Controller::ERROR_SERVER = 500;
 const uint32_t Controller::ERROR_LBOUND = 400;
 
-Controller::Controller(Face& face)
-  : m_face(face)
-  , m_internalKeyChain(make_shared<KeyChain>())
-  , m_keyChain(*m_internalKeyChain)
-{
-}
-
 Controller::Controller(Face& face, KeyChain& keyChain)
   : m_face(face)
   , m_keyChain(keyChain)
@@ -75,27 +68,6 @@
 }
 
 void
-Controller::startCommand(const shared_ptr<ControlCommand>& command,
-                         const ControlParameters& parameters,
-                         const CommandSucceedCallback& onSuccess,
-                         const CommandFailCallback& onFailure,
-                         const Sign& sign,
-                         const time::milliseconds& timeout)
-{
-  BOOST_ASSERT(timeout > time::milliseconds::zero());
-
-  Name requestName = command->getRequestName(CommandOptions::DEFAULT_PREFIX, parameters);
-  Interest interest(requestName);
-  interest.setInterestLifetime(timeout);
-  sign(interest);
-
-  m_face.expressInterest(interest,
-                         bind(&Controller::processCommandResponse, this, _2,
-                              command, onSuccess, onFailure),
-                         bind(onFailure, ERROR_TIMEOUT, "request timed out"));
-}
-
-void
 Controller::processCommandResponse(const Data& data,
                                    const shared_ptr<ControlCommand>& command,
                                    const CommandSucceedCallback& onSuccess,
@@ -143,6 +115,5 @@
     onSuccess(parameters);
 }
 
-
 } // namespace nfd
 } // namespace ndn
diff --git a/src/management/nfd-controller.hpp b/src/management/nfd-controller.hpp
index a7d1290..48bf041 100644
--- a/src/management/nfd-controller.hpp
+++ b/src/management/nfd-controller.hpp
@@ -49,19 +49,6 @@
    */
   typedef function<void(uint32_t/*code*/,const std::string&/*reason*/)> CommandFailCallback;
 
-  /** \brief a function to sign the request Interest
-   *  \deprecated arbitrary signing function is no longer supported
-   */
-  typedef function<void(Interest&)> Sign;
-
-  /** \brief construct a Controller that uses face for transport,
-   *         and has an internal default KeyChain to sign commands
-   *  \deprecated use two-parameter overload
-   */
-  DEPRECATED(
-  explicit
-  Controller(Face& face));
-
   /** \brief construct a Controller that uses face for transport,
    *         and uses the passed KeyChain to sign commands
    */
@@ -80,62 +67,6 @@
     this->startCommand(command, parameters, onSuccess, onFailure, options);
   }
 
-  /** \brief start command execution
-   *  \deprecated use the overload taking CommandOptions
-   */
-  DEPRECATED(
-  template<typename Command>
-  void
-  start(const ControlParameters& parameters,
-        const CommandSucceedCallback& onSuccess,
-        const CommandFailCallback& onFailure,
-        const time::milliseconds& timeout));
-
-  /** \brief start command execution
-   *  \param certificate the certificate used to sign request Interests.
-   *         If IdentityCertificate() is passed, the default signing certificate will be used.
-   *
-   *  \note IdentityCertificate() creates a certificate with an empty name, which is an
-   *        invalid certificate.  A valid IdentityCertificate has at least 4 name components,
-   *        as it follows `<...>/KEY/<...>/<key-id>/ID-CERT/<version>` naming model.
-   *
-   *  \deprecated use the overload taking CommandOptions
-   */
-  DEPRECATED(
-  template<typename Command>
-  void
-  start(const ControlParameters& parameters,
-        const CommandSucceedCallback& onSuccess,
-        const CommandFailCallback& onFailure,
-        const IdentityCertificate& certificate,
-        const time::milliseconds& timeout = CommandOptions::DEFAULT_TIMEOUT));
-
-  /** \brief start command execution
-   *  \param identity the identity used to sign request Interests
-   *  \deprecated use the overload taking CommandOptions
-   */
-  DEPRECATED(
-  template<typename Command>
-  void
-  start(const ControlParameters& parameters,
-        const CommandSucceedCallback& onSuccess,
-        const CommandFailCallback& onFailure,
-        const Name& identity,
-        const time::milliseconds& timeout = CommandOptions::DEFAULT_TIMEOUT));
-
-  /** \brief start command execution
-   *  \param sign a function to sign request Interests
-   *  \deprecated arbitrary signing function is no longer supported
-   */
-  DEPRECATED(
-  template<typename Command>
-  void
-  start(const ControlParameters& parameters,
-        const CommandSucceedCallback& onSuccess,
-        const CommandFailCallback& onFailure,
-        const Sign& sign,
-        const time::milliseconds& timeout = CommandOptions::DEFAULT_TIMEOUT));
-
 private:
   void
   startCommand(const shared_ptr<ControlCommand>& command,
@@ -144,16 +75,6 @@
                const CommandFailCallback& onFailure,
                const CommandOptions& options);
 
-  /** \deprecated This is to support arbitrary signing function.
-   */
-  void
-  startCommand(const shared_ptr<ControlCommand>& command,
-               const ControlParameters& parameters,
-               const CommandSucceedCallback& onSuccess,
-               const CommandFailCallback& onFailure,
-               const Sign& sign,
-               const time::milliseconds& timeout);
-
   void
   processCommandResponse(const Data& data,
                          const shared_ptr<ControlCommand>& command,
@@ -161,13 +82,6 @@
                          const CommandFailCallback& onFailure);
 
 public:
-  /** \deprecated use CommandOptions::DEFAULT_TIMEOUT
-   */
-  DEPRECATED(
-  static time::milliseconds
-  getDefaultCommandTimeout());
-
-public:
   /** \brief error code for timeout
    *  \note comes from http://msdn.microsoft.com/en-us/library/windows/desktop/ms740668.aspx
    */
@@ -183,84 +97,9 @@
 
 protected:
   Face& m_face;
-
-  /** \deprecated
-   */
-  shared_ptr<KeyChain> m_internalKeyChain;
-
   KeyChain& m_keyChain;
 };
 
-
-// deprecated methods
-
-template<typename Command>
-inline void
-Controller::start(const ControlParameters& parameters,
-                  const CommandSucceedCallback& onSuccess,
-                  const CommandFailCallback& onFailure,
-                  const time::milliseconds& timeout)
-{
-  CommandOptions options;
-  options.setTimeout(timeout);
-
-  this->start<Command>(parameters, onSuccess, onFailure, options);
-}
-
-template<typename Command>
-inline void
-Controller::start(const ControlParameters& parameters,
-                  const CommandSucceedCallback& onSuccess,
-                  const CommandFailCallback& onFailure,
-                  const IdentityCertificate& certificate,
-                  const time::milliseconds& timeout)
-{
-  CommandOptions options;
-  if (certificate.getName().empty()) {
-    options.setSigningDefault();
-  }
-  else {
-    options.setSigningCertificate(certificate);
-  }
-  options.setTimeout(timeout);
-
-  this->start<Command>(parameters, onSuccess, onFailure, options);
-}
-
-template<typename Command>
-inline void
-Controller::start(const ControlParameters& parameters,
-                  const CommandSucceedCallback& onSuccess,
-                  const CommandFailCallback& onFailure,
-                  const Name& identity,
-                  const time::milliseconds& timeout)
-{
-  CommandOptions options;
-  options.setSigningIdentity(identity);
-  options.setTimeout(timeout);
-
-  this->start<Command>(parameters, onSuccess, onFailure, options);
-}
-
-template<typename Command>
-inline void
-Controller::start(const ControlParameters& parameters,
-                  const CommandSucceedCallback& onSuccess,
-                  const CommandFailCallback& onFailure,
-                  const Sign& sign,
-                  const time::milliseconds& timeout)
-{
-  shared_ptr<ControlCommand> command = make_shared<Command>();
-  this->startCommand(command, parameters, onSuccess, onFailure, sign, timeout);
-}
-
-inline time::milliseconds
-Controller::getDefaultCommandTimeout()
-{
-  return CommandOptions::DEFAULT_TIMEOUT;
-}
-
-
 } // namespace nfd
 } // namespace ndn
 
