tools: Fix bugs in cert-gen

Change-Id: I13ed1d71b4970166135e32e2196ac9c67ad60fd3
Refs: #4202
diff --git a/src/security/v2/additional-description.hpp b/src/security/v2/additional-description.hpp
index ad9df37..5e16132 100644
--- a/src/security/v2/additional-description.hpp
+++ b/src/security/v2/additional-description.hpp
@@ -78,6 +78,12 @@
     return m_info.size();
   }
 
+  bool
+  empty() const
+  {
+    return m_info.empty();
+  }
+
   iterator
   begin();
 
diff --git a/tools/ndnsec/cert-gen.cpp b/tools/ndnsec/cert-gen.cpp
index c1f8868..f63a2ea 100644
--- a/tools/ndnsec/cert-gen.cpp
+++ b/tools/ndnsec/cert-gen.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -85,13 +85,6 @@
     return 0;
   }
 
-  if (vm.count("subject-name") == 0) {
-    std::cerr << "ERROR: subject name must be specified" << std::endl
-              << std::endl
-              << description << std::endl;
-    return 1;
-  }
-
   security::v2::AdditionalDescription additionalDescription;
 
   for (const auto& info : infos) {
@@ -165,6 +158,9 @@
 
   SignatureInfo signatureInfo;
   signatureInfo.setValidityPeriod(security::ValidityPeriod(notBefore, notAfter));
+  if (!additionalDescription.empty()) {
+    signatureInfo.appendTypeSpecificTlv(additionalDescription.wireEncode());
+  }
 
   security::Identity identity;
   if (vm.count("sign-id") == 0) {