Redfish: GenerateCSR action for HTTPS certificate

Implemented GenerateCSR action of CertificateService
for generating CSR of HTTPS certificate

CSR requests initiated through D-Bus are time-consuming
and might result D-Bus time-out error

GenerateCSR request is performed in child process in
the backend so that caller is returned immediately.

Caller need to register for "InterfacesAdded" signal
generated when a new CSR object is creatd by backend
after completion of the CSR request.

Caller initiates read on the CSR object created to
read the CSR string.

Timer is added to cancel the operation if "Interfaces
Added" signal is not received in a specified time.

Modified to support only 2048 keybit length due to
time taken in private key generation.

Tested
1) Tested schema with validator and no issues
2)
curl -c cjar -b cjar -k -H "X-Auth-Token: $bmc_token" -X POST
https://${bmc}/redfish/v1/CertificateService/Actions/CertificateService.GenerateCSR/
-d @generate_https.json
{
  "CSRString": "-----BEGIN CERTIFICATE ..."
  "CertificateCollection": {
    "@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/"
  }
}
3. generate_https.json
{
    "City": "Austin",
    "CertificateCollection": {
        "@odata.id":
"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/"
    },
    "CommonName": "www.ibm.com",
    "ContactPerson":"myname",
    "AlternativeNames":["www.ibm.com"],
    "ChallengePassword":"",
    "Email":"openbmc@in.ibm.com",
    "GivenName":"",
    "Initials":"",
    "Country": "US",
    "KeyCurveId":"",
    "KeyUsage":["KeyAgreement"],
    "KeyBitLength": 1024,
    "KeyPairAlgorithm": "RSA",
    "Organization": "IBM",
    "OrganizationalUnit": "ISL",
    "State": "AU",
    "Surname": "",
    "UnstructuredName": ""
}
4) Verified Required and Optional parameters
5) Generate EC CSR with curve ID secp224r1
curl -c cjar -b cjar -k -H "X-Auth-Token: $bmc_token" -X POST
https://${bmc}/redfish/v1/CertificateService/Actions/CertificateService.GenerateCSR/
-d @generate_https.json
{
  "CSRString": "-----BEGIN CERTIFICATE
REQUEST-----\nMIIBQzCB8wIBATCBmzEUMBIGA1UdEQwLd3d3LmlibS5jb20xDzANBgNVBAcMBkF1\nc3RpbjEUMBIGA1UEAwwLd3d3LmlibS5jb20xDzANBgNVBCkMBm15bmFtZTELMAkG\nA1UEBhMCVVMxDDAKBgQrDgMCDAJFQzEVMBMGA1UdDwwMS2V5QWdyZWVtZW50MQww\nCgYDVQQKDANJQk0xCzAJBgNVBAgMAkFVME4wEAYHKoZIzj0CAQYFK4EEACEDOgAE\n7hyL8FWmeCBRpCxWKjlce9nRghwS0lBrBdslOZ+n9+hFD+0KD8L+BORwm7dfzGlG\nTblh2G6cQ8KgADAKBggqhkjOPQQDAgM/ADA8Ahw1nlGdEFfnb+2zxdfVeTQYgCTw\nNos0t2rsGc/zAhxS9/paXZtVqR+WzdQVsjSLC/BedbXv1EmW52Uo\n-----END
CERTIFICATE REQUEST-----\n",
  "CertificateCollection": {
    "@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/"
  }
}
Change-Id: I2528c802ff3c6f63570cdb355b9c1195797a0e53
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
index 6f68611..93418e4 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
@@ -134,10 +134,9 @@
         nodes.emplace_back(std::make_unique<HTTPSCertificate>(app));
         nodes.emplace_back(std::make_unique<LDAPCertificateCollection>(app));
         nodes.emplace_back(std::make_unique<LDAPCertificate>(app));
-
+        nodes.emplace_back(std::make_unique<CertificateActionGenerateCSR>(app));
         nodes.emplace_back(std::make_unique<SystemPCIeFunction>(app));
         nodes.emplace_back(std::make_unique<SystemPCIeDevice>(app));
-
         for (const auto& node : nodes)
         {
             node->initPrivileges();