Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for libsodium encryption with Windows PowerShell #239

Closed
aprajitapriya opened this issue Dec 14, 2023 · 17 comments
Closed

Add support for libsodium encryption with Windows PowerShell #239

aprajitapriya opened this issue Dec 14, 2023 · 17 comments
Assignees
Labels
enhancement New feature or request

Comments

@aprajitapriya
Copy link

Environment

Operating System: Windows
VenafiPS version: 6.0.6
PowerShell version: 5.1
TPP version (if applicable):

Steps to reproduce

New-VenafiSession -VaasKey ''
Export-VcCertificate -ID '
' -OutPath '' -PrivateKeyPassword '****'

Expected behavior

The .pem file gets downloaded with private keys in it.

Actual behavior

Getting below error:
"ConvertTo-SodiumEncryptedString : Could not initialize platform-specific components. libsodium-core may not be supported on this platform. See
https://github.com/ektrah/libsodium-core/blob/master/INSTALL.md for more information."

Without passing the privatekeypassword the .pem file gets downloaded fine. But I need the private keys in the file to be able to convert it into a pfx or pkcs12 file.

Screenshots

image

@gdbarron
Copy link
Collaborator

@aprajitapriya it's currently on the backlog to support Windows PowerShell when encryption is required with TLSPC. For now, PowerShell Core, v7, will need to be installed.

@gdbarron gdbarron changed the title Cannot Get the Private Key While Downloading .PEM File Add support for libsodium encryption with Windows PowerShell Dec 15, 2023
@gdbarron gdbarron added the enhancement New feature or request label Dec 15, 2023
@gdbarron
Copy link
Collaborator

@aprajitapriya, I see you are running Windows, but which version?

@aprajitapriya
Copy link
Author

Trying with Powershell v7 too, but I get the same error:
image

@aprajitapriya
Copy link
Author

@aprajitapriya, I see you are running Windows, but which version?

I am currently running this on Windows Server 2016

@aprajitapriya
Copy link
Author

@gdbarron Is there a timeline when it will be possible to download pkcs12/pfx using VenafiPS module?

@gdbarron
Copy link
Collaborator

libsodium-core has a requirement, just for Windows, of installing the Visual C++ redist. I was able to reproduce your issue and installing that redist fixed it.

@aprajitapriya
Copy link
Author

Oh ok. I had tried downloading libsodium library and placing it in System32 folder but still it didn't work for me. If you have plans to include this functionality in windows PowerShell in near future, I can wait for it, instead of installing all the dependencies to support the current version.

@gdbarron
Copy link
Collaborator

The only dependency that needs to be installed is the visual c++ runtime. libsodium is already included with the module and does not need to be installed separately. I'll give some thought as to the best way to handle the runtime going forward. For the short term, if using Windows, I'd install manually.

@aprajitapriya
Copy link
Author

aprajitapriya commented Dec 28, 2023

Hello @gdbarron, There is another issue I am coming across while using Export-VcCertificate command. I get this error irrespective of whether I supply a value for OutPath parameter or not.
image

In Export-VcCertificate.ps1 (line 197), there is command to create a new temporary file.

@gdbarron
Copy link
Collaborator

gdbarron commented Dec 29, 2023

Thanks for reporting this. This is related to PS5 and all PS5 related items will be resolved with the new PR, #243; this error is already fixed. Please feel free to test the new PR.

@aprajitapriya
Copy link
Author

@gdbarron I am having trouble updating the manifest using the latest PR. Do you have an ETA when this PR will be merged and have the changes in new version of VenafiPS?

@gdbarron
Copy link
Collaborator

gdbarron commented Jan 7, 2024

@aprajitapriya v6.1.0 has been released. PS7 as well as VC++ runtime, on Windows, is required for those functions utilizing Sodium encryption. I will continue to work on adding support for PS5.

@aprajitapriya
Copy link
Author

Thank you @gdbarron. Yes I could download the private keys too using the new VenafiPS version. However I am not getting the right openssl cmdlet to use to convert it to pfx or pkcs12 format.

@gdbarron
Copy link
Collaborator

No guarantees, but give the following a shot:
openssl pkcs12 -export -out result.pfx -inkey mypemfile.pem -in mypemfile.pem

@aprajitapriya
Copy link
Author

Yeah I tried this. It didn't work. I will wait for the functionality of downloading pkcs12/pfx files added in VenafiPS module.

@gdbarron
Copy link
Collaborator

You tried it with the password parameter as well? I believe that's required when using -inkey.

@aprajitapriya
Copy link
Author

Yes I tried with password parameter as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants