4

Trying to use google-compute-engine provider for jclouds there appears to be a problem when putting the pem extracted from the .p12 into the credential section of my jenkins config.xml

Followed these instruction https://github.com/jclouds/jclouds-labs-google/tree/master/google-compute-engine to extract the pem file from the p12

Error is see when trying to test connection: Cannot connect to specified cloud, please check the identity and credentials: chars -----BEGIN RSA PRIVATE KEY----- HIDDEN -----END RSA PRIVATE KEY----- doesn't contain % line [-----END ] If I remove the "-----BEGIN RSA", jclouds correctly tells me that % doesnt contain the line -----BEGIN but it seems to be barfing on parsing the "-----END" part

I thought It might have to do with pasting the key into the Credential section of the configure jenkins U/I, but I placed the key directly into the config.xml's section, and I'm getting the same error.

jenkins-1.583-1.1.noarch with Jclouds plugin 2.8

Any ideas?

-Aric

Aric
  • 63
  • 4

3 Answers3

0

Convert the p12 file into pem format (it will ask for the keystore password, which is usually "notasecret"):

 openssl pkcs12 -in my_keystore.p12 -out my_keystore.pem -nodes
  1. Extract only the pk and remove passphrase

    openssl rsa -in my_keystore.pem -out my_key.pem

Then you can use this key and problem will be solved.

Asanka sanjaya
  • 1,461
  • 3
  • 17
  • 35
0

The solution on my side is to use the Textarea. FYI: JENKINS-25283 and reason is losing the new line character. Hope this help you.

Y. Bino
  • 31
  • 3
0

I was having a similar problem after reading the key from a user interface.

The fix for me was:

privatekey = privatekey.replace("\\\n", System.lineSeparator());

This ensures the key includes system specific line-break characters.

Aleks
  • 4,866
  • 3
  • 38
  • 69