Skip to content

Instantly share code, notes, and snippets.

@emanuelduss
Last active July 28, 2020 06:10
Show Gist options
  • Select an option

  • Save emanuelduss/ab6077634f1f9c132371b418db7bb1cc to your computer and use it in GitHub Desktop.

Select an option

Save emanuelduss/ab6077634f1f9c132371b418db7bb1cc to your computer and use it in GitHub Desktop.
Clone a certificate using PowerShell
$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