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

Set-NexusCert.ps1 does not work #138

Open
Tabiskabis opened this issue Jun 9, 2022 · 2 comments
Open

Set-NexusCert.ps1 does not work #138

Tabiskabis opened this issue Jun 9, 2022 · 2 comments
Labels
0 - _Triaging New tickets that need to be hashed out a bit more before they hit the backlog.

Comments

@Tabiskabis
Copy link

Tabiskabis commented Jun 9, 2022

"chocolatey" | & $KeyTool -list -v -keystore C:\cert.pfx
results in
Enter keystore password: keytool error: java.io.IOException: keystore password was incorrect java.io.IOException: keystore password was incorrect at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:2069) at sun.security.provider.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:238) at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(JavaKeyStore.java:71) at java.security.KeyStore.load(KeyStore.java:1445) at sun.security.tools.keytool.Main.doCommands(Main.java:928) at sun.security.tools.keytool.Main.run(Main.java:368) at sun.security.tools.keytool.Main.main(Main.java:361) Caused by: java.security.UnrecoverableKeyException: failed to decrypt safe contents entry: java.io.IOException: getSecretKey failed: Password is not ASCII ... 7 more

System Details

  • OS Build Windows Server 2019 10.0.17763.0
  • Windows PowerShell version 5.1.17763.2867 (Edition: Desktop)
  • Chocolatey version 1.1.0
@ryanrichter94
Copy link
Member

@Tabiskabis Can you confirm what version of nexus-repository you are running please? Also does the certificate you are inputting into the script have a certificate password associated to it?

@Tabiskabis
Copy link
Author

@ryanrichter94 We're on OSS 3.38.1, yes the pfx is encrypted with the expected password
Apparently, keytool.exe does not read passwords from stdin.

Workaround/fix: change the line $string = ("chocolatey" | & $KeyTool -list -v -keystore C:\cert.pfx) -match '^Alias.*'
to $string = (& $KeyTool -list -v -keystore C:\cert.pfx -storepass "chocolatey") -match '^Alias.*'

@pauby pauby added 0 - _Triaging New tickets that need to be hashed out a bit more before they hit the backlog. and removed question labels Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - _Triaging New tickets that need to be hashed out a bit more before they hit the backlog.
Projects
None yet
Development

No branches or pull requests

3 participants