I have wrapped OpenSSL so it can be used within an application I am writing to create and manage certificates. I am able to load a certificate (and private key) from file and store it in a class object. I can then use the OpenSSL API to write the object to file which is successful.

What I am unable to do is extract information regarding the certificate once it has been loaded in from file.

I have created an error handling class that catches an exception and displays the error code but all that is returned are 0's.

(Error [0]: error:000000000:lib(0):func(0):reason(0) - Failed to set issuer name)

void Certificate::setIssuerName(X509_NAME* oName)
  if (X509_set_issuer_name(mptX509, oName) == 0)
    throw OpenSSLError(ERR_get_error(), "Failed to set issuer name");

X509_NAME* Certificate::getIssuerName()
  return X509_get_issuer_name(mptX509);

I have tried to isolate the issue from my application and wrote a section of code that creates to certificate objects, loads a certificate from file in to one and then try to read the issuer from it and set it on the second.

Certificate certLoad;
Certificate certTest;


X509_NAME* name = certLoad.getIssuerName();

The certificate being loaded is a valid certificate, and I am able to load it in, write it back to a file and install it on a web server and it still works correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.