17
17
18
18
class ManageCert
19
19
{
20
- private string $ tempDir , $ originalCertContent , $ password , $ hashKey ;
20
+ private string $ tempDir ;
21
+ private string $ originalCertContent ;
22
+ private string $ password ;
23
+ private string $ hashKey ;
21
24
22
25
private bool $ preservePfx = false ;
26
+ private bool $ isLegacy = false ;
23
27
24
28
private array $ parsedData ;
25
29
26
30
private OpenSSLCertificate |bool $ certContent ;
27
31
28
32
const CIPHER = 'aes-128-cbc ' ;
33
+ const LEGACY_FLAG = '-legacy ' ;
29
34
30
35
private Encrypter $ encrypter ;
31
36
@@ -45,6 +50,12 @@ public function setPreservePfx(bool $preservePfx = true): self
45
50
return $ this ;
46
51
}
47
52
53
+ public function setIsLegacy (bool $ isLegacy = true ): self
54
+ {
55
+ $ this ->isLegacy = $ isLegacy ;
56
+ return $ this ;
57
+ }
58
+
48
59
/**
49
60
* @throws CertificateOutputNotFoundException
50
61
* @throws FileNotFoundException
@@ -64,8 +75,9 @@ public function fromPfx(string $pfxPath, string $password): self
64
75
}
65
76
66
77
$ 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 }" ;
69
81
70
82
runCliCommandProcesses ($ openSslCommand );
71
83
0 commit comments