summaryrefslogtreecommitdiff
path: root/include/ssl_key_handler.hpp
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@linux.intel.com>2020-03-09 20:56:53 +0300
committerVernon Mauery <vernon.mauery@linux.intel.com>2020-03-09 20:56:53 +0300
commit0185c7f163a850216437be23111e2bfdd874cd11 (patch)
treecd0de5320744ee73afe4fca1b0fa9dce9fc881b8 /include/ssl_key_handler.hpp
parentaaf3206f0ef74a02b22c3e563a0babc3af4b2e3a (diff)
downloadbmcweb-0185c7f163a850216437be23111e2bfdd874cd11.tar.xz
Remove RSA comments and variable names
In code that is clearly working with EC keys, but once was used for RSA keys, remove the incorrectly named RSA names and comments to reduce confusion. Change-Id: Ide6909bb80fea18bfc51bd3376ae8a51be6baa05 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Diffstat (limited to 'include/ssl_key_handler.hpp')
-rw-r--r--include/ssl_key_handler.hpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp
index 0240712735..57c96a5cde 100644
--- a/include/ssl_key_handler.hpp
+++ b/include/ssl_key_handler.hpp
@@ -180,12 +180,9 @@ inline void generateSslCertificate(const std::string &filepath)
std::cout << "Generating new keys\n";
initOpenssl();
- // std::cerr << "Generating RSA key";
- // EVP_PKEY *pRsaPrivKey = create_rsa_key();
-
std::cerr << "Generating EC key\n";
- EVP_PKEY *pRsaPrivKey = createEcKey();
- if (pRsaPrivKey != nullptr)
+ EVP_PKEY *pPrivKey = createEcKey();
+ if (pPrivKey != nullptr)
{
std::cerr << "Generating x509 Certificate\n";
// Use this code to directly generate a certificate
@@ -208,7 +205,7 @@ inline void generateSslCertificate(const std::string &filepath)
60L * 60L * 24L * 365L * 10L);
// set the public key to the key we just generated
- X509_set_pubkey(x509, pRsaPrivKey);
+ X509_set_pubkey(x509, pPrivKey);
// get the subject name
X509_NAME *name;
@@ -227,13 +224,13 @@ inline void generateSslCertificate(const std::string &filepath)
X509_set_issuer_name(x509, name);
// Sign the certificate with our private key
- X509_sign(x509, pRsaPrivKey, EVP_sha256());
+ X509_sign(x509, pPrivKey, EVP_sha256());
pFile = fopen(filepath.c_str(), "wt");
if (pFile != nullptr)
{
- PEM_write_PrivateKey(pFile, pRsaPrivKey, nullptr, nullptr, 0,
+ PEM_write_PrivateKey(pFile, pPrivKey, nullptr, nullptr, 0,
nullptr, nullptr);
PEM_write_X509(pFile, x509);
@@ -244,8 +241,8 @@ inline void generateSslCertificate(const std::string &filepath)
X509_free(x509);
}
- EVP_PKEY_free(pRsaPrivKey);
- pRsaPrivKey = nullptr;
+ EVP_PKEY_free(pPrivKey);
+ pPrivKey = nullptr;
}
// cleanup_openssl();
@@ -267,7 +264,7 @@ EVP_PKEY *createEcKey()
{
if (EVP_PKEY_assign_EC_KEY(pKey, myecc))
{
- /* pKey owns pRSA from now */
+ /* pKey owns myecc from now */
if (EC_KEY_check_key(myecc) <= 0)
{
fprintf(stderr, "EC_check_key failed.\n");