最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Openssl script I use for PFX files (it's a script that extracts a key for a PFX file so you can use it with a new one) i

matteradmin4PV0评论

I have a script (bat file) I used at my last job to easily create new PFX files from .crt files when we didn't know the password to the old .PFX file.

Here is the script:

REM How to use:
REM 1. Export old cert with private key, remember password.
REM 2. Copy to this directory.
REM 3. Copy new cert to this directory.
REM 4. Fill out the SET variables below.
REM 5. Run this script, enter passwords. newpfx is the re-bundled cert you want to install on webserver. 

SET oldpfx=test.pfx 
SET newcert=test.crt 
SET newpfx=testa.pfx

bin\openssl.exe pkcs12 -in %oldpfx% -nocerts -out key.pem -nodes 
bin\openssl.exe pkcs12 -export -out %newpfx% -inkey key.pem -in %newcert% 

The issue with the above script is that on the last two lines, I always get "the system cannot find the path specified".

At my current job, I installed openssl via an MSI file to the c:\program files\openssl-win 64 and I place the required certs in the bin directory - that's also where the script is as well - the other directories are: exp, include, lib, & tests. Keep in mind that, that's not where it was installed at my last job, I was running he directory from c:\users\username.

The script never prompts me to enter the passwords either. This occurs whether I open the bat file in cmd prompt or powershell.

Any help would be appreciated.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far