1717
1818class ManageCert
1919{
20- private string $ tempDir , $ originalCertContent , $ password , $ hashKey ;
20+ private string $ tempDir ;
21+ private string $ originalCertContent ;
22+ private string $ password ;
23+ private string $ hashKey ;
2124
2225 private bool $ preservePfx = false ;
26+ private bool $ isLegacy = false ;
2327
2428 private array $ parsedData ;
2529
2630 private OpenSSLCertificate |bool $ certContent ;
2731
2832 const CIPHER = 'aes-128-cbc ' ;
33+ const LEGACY_FLAG = '-legacy ' ;
2934
3035 private Encrypter $ encrypter ;
3136
@@ -45,6 +50,12 @@ public function setPreservePfx(bool $preservePfx = true): self
4550 return $ this ;
4651 }
4752
53+ public function setIsLegacy (bool $ isLegacy = true ): self
54+ {
55+ $ this ->isLegacy = $ isLegacy ;
56+ return $ this ;
57+ }
58+
4859 /**
4960 * @throws CertificateOutputNotFoundException
5061 * @throws FileNotFoundException
@@ -64,8 +75,9 @@ public function fromPfx(string $pfxPath, string $password): self
6475 }
6576
6677 $ this ->password = $ password ;
67- $ output = a1TempDir (true , '.crt ' );
68- $ openSslCommand = "openssl pkcs12 -in {$ pfxPath } -out {$ output } -nodes -password pass:' {$ this ->password }' " ;
78+ $ output = a1TempDir (true , '.crt ' );
79+ $ legacyFlag = $ this ->isLegacy ? self ::LEGACY_FLAG : '' ;
80+ $ openSslCommand = "openssl pkcs12 -in {$ pfxPath } -out {$ output } -nodes -password pass:' {$ this ->password }' {$ legacyFlag }" ;
6981
7082 runCliCommandProcesses ($ openSslCommand );
7183
0 commit comments