Last active
July 28, 2020 06:10
-
-
Save emanuelduss/ab6077634f1f9c132371b418db7bb1cc to your computer and use it in GitHub Desktop.
Clone a certificate using PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $original = "c:\tmp\certificate.pem" | |
| $cloned = "c:\tmp\cloned.p12" | |
| $password = "Password-1234" | |
| $cert_original = Get-PfxCertificate -FilePath $original | |
| $export_password = ConvertTo-SecureString -String $password -Force -AsPlainText | |
| $cert_cloned = New-SelfSignedCertificate -CloneCert $cert_original -CertStoreLocation "Cert:\CurrentUser\My\" | |
| $cert_cloned | Export-PfxCertificate -FilePath $cloned -Password $export_password | |
| Remove-Item $cert_cloned.PSPath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment