Troubles with Self signed certificate in Office Addin for testing

lars wissler 26 Reputation points
2022-03-11T17:26:12.54+00:00

My previous self signed certificate has expired and I just cannot get a new one to work even after following multiple tutorials. This one was the latest. Whenever I try to use the localhost server, Office refuses to load the addin, because the certificate is invalid.

I think the issue is: When I import the certificate in Edge, it states "Import successful", but the certificate will not appear in the certificates list. I read here, that a missing private key might cause that issue. I tried fixing that with digicert utils, as suggested. But importing the certificate in digicert only shows the message "The file does not have any SSL or code signing enabled certificates contained in it."

My certificate looks valid, except it does not show the "protected by private key" info. It looks like that issue here. If I try to repair as proposed in that link, certutil asks to connect a smart card. Never heard of that.

As per the first tutorial, I created a root certification authority with key and imported it into the Trusted Root Certification Authorities. I the used the root.pem to create localhost.key/.csr and finally localhost.crt. I cannot see a fault with the process or the certificate except for the missing private key information (see attached image, Edit: Image upload does nothing, here is the link to the image.).

Please help, I am going nuts over this. Why does it not say there is a corresponding private key or if that is outdated, why is it not importing into Edge. Do I even need to get it imported into Edge for Office JS Addings to work. I am utterly confused by now. The commands I used to create the files are:

openssl genrsa -des3 -out rootSSL.key 2048
openssl req -x509 -new -nodes -key rootSSL.key -sha256 -days 10240 -out rootSSL.pem
<---Import--->
openssl req -new -sha256 -nodes -out localhost.csr -newkey rsa:2048 -keyout localhost.key
openssl x509 -req -in localhost.csr -CA rootSSL.pem -CAkey rootSSL.key -CAcreateserial -out localhost.crt -days 50000 -sha256

Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,180 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
905 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,595 questions
{count} votes

1 answer

Sort by: Most helpful
  1. lars wissler 26 Reputation points
    2022-03-24T11:17:29.267+00:00

    With some help I managed the correct certificat and import procedure. The solution can be found here: https://stackoverflow.com/questions/71470513/selfsignedcertificate-not-accepted-in-ms-edge-win-10/71487759#71487759

    0 comments No comments