I have InstallScript MSI installer project in InstallShield. I wanted to create Self-Sign certificate during the installation of my product. So is there any windows APIs I can use in InstallScript code OR are there any InstallScript functions using which I can create Self-Sign certificate during installation.
2 Answers
Not sure if you can handle it from InstallShield. Can you please give us more details about your scenario?
To generate a self-signed certificate you can use a powershell cmdlet. The New-SelfSignedCertificate cmdlet allows to create a self-signed certificate for testing purpose (may required administrator rights).
You can also take a look on the Generate a self-signed certificate for code signing article which may be useful to you.

- 454
- 3
- 9
-
Yes, I wanted to create a self-sign certificate. – Ajit Medhekar Apr 29 '19 at 14:37
While I think it's likely that you can do this with UseDLL and friends in InstallScript, by the time you're done prototype-ing the relevant structures and functions, you'll probably be happier with a pure C++ implementation.
For either the InstallScript or C++ route, you'll have to understand the C++ layer. The core of it is CertCreateSelfSignCertificate from wincrypt.h. You'll note very quickly that CertCreateSelfSignCertificate requires several parameters, some of which need to have been initialized by calling other functions. So, for a little while, understanding or implementing this is going to feel like diving down a rabbit hole.
But there's an example in the SDK: cryptoapi/CreateCertificate. It's only 549 lines, and a significant chunk of that is for handling command lines. And you can find several other examples by searching for 'CreateSelfSignCertificate example'. But regardless, it's still not a trivial task to do correctly.
So you may well be happiest with an alternate approach like J. Tribbiani's suggestion of using PowerShell.

- 15,737
- 2
- 28
- 44