Article 52XAP How to install .pfx file as certificate on Centos/Jenkins

How to install .pfx file as certificate on Centos/Jenkins

by
coolx
from LinuxQuestions.org on (#52XAP)
Hi

My company sent me a "cert.pfx" file with password. I don't know how to use this file with Jenkins? My server is Centos 7.

Before that I used the commands below for self-signed certificates.
openssl req -new > new.ssl.csr
openssl rsa -in privkey.pem -out new.cert.key
openssl x509 -in new.ssl.csr -out new.cert.cert -req -signkey new.cert.key \-days 3650

openssl pkcs12 -export -out jenkins_keystore.p12 -passout 'passass' \-inkey new.cert.key -in new.cert.cert -name domain.com

keytool -importkeystore -srckeystore jenkins_keystore.p12 \-srcstorepass 'pass' -srcstoretype PKCS12 \-srcalias domain.com -deststoretype PKCS12 \-destkeystore jenkins_keystore.jks -deststorepass 'pass' \-destalias domain.com
How can I install this "cert.pfx" file on Jenkins?

When I tried the command in this page, I receive the error below in Jenkins log.

https://wiki.jenkins.io/pages/viewpa...geId=135468777
java.io.IOException: Failed to start a listener: winstone.HttpsConnectorFactory
at winstone.Launcher.spawnListener(Launcher.java:218)
at winstone.Launcher.<init>(Launcher.java:178)
at winstone.Launcher.main(Launcher.java:359)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Main._main(Main.java:375)
at Main.main(Main.java:151)
Caused by: winstone.WinstoneException: Error getting the SSL context object
at winstone.AbstractSecuredConnectorFactory.getSSLContext(AbstractSecuredConnectorFactory.java:229)
at winstone.HttpsConnectorFactory.createConnector(HttpsConnectorFactory.java:56)
at winstone.HttpsConnectorFactory.start(HttpsConnectorFactory.java:41)
at winstone.Launcher.spawnListener(Launcher.java:216)
... 8 more
Caused by: java.security.UnrecoverableKeyException: Cannot recover key
at sun.security.provider.KeyProtector.recover(KeyProtector.java:315)
at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:141)
at sun.security.provider.JavaKeyStore$JKS.engineGetKey(JavaKeyStore.java:56)
at sun.security.provider.KeyStoreDelegator.engineGetKey(KeyStoreDelegator.java:96)
at sun.security.provider.JavaKeyStore$DualFormatJKS.engineGetKey(JavaKeyStore.java:70)
at java.security.KeyStore.getKey(KeyStore.java:1023)
at sun.security.ssl.SunX509KeyManagerImpl.<init>(SunX509KeyManagerImpl.java:133)
at sun.security.ssl.KeyManagerFactoryImpl$SunX509.engineInit(KeyManagerFactoryImpl.java:70)

winstone.AbstractSecuredConnectorFactory.getSSLContext(AbstractSecuredConnectorFactory.java:190)
Thanks!latest?d=yIl2AUoC8zA latest?i=KqrW7heLetI:KI857GMeZSA:F7zBnMy latest?i=KqrW7heLetI:KI857GMeZSA:V_sGLiP latest?d=qj6IDK7rITs latest?i=KqrW7heLetI:KI857GMeZSA:gIN9vFwKqrW7heLetI
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments