Gsutil gives Failure: PKCS12 format is not supported by PyCrpto library

I tried to set up a notification about storage of objects, as indicated in https://developers.google.com/storage/docs/object-change-notification#_Service_Account

I followed the exact steps, however, when I run the gsutil ls command, I get the following error:

/usr/local/gsutil/gsutil ls Failure: PKCS12 format is not supported by the PyCrpto library. Try converting to a "PEM" (openssl pkcs12 -in xxxxx.p12 -nodes -nocerts > privatekey.pem) or using PyOpenSSL if native code is an option.. 

I tried converting to PEM as indicated in the error message and reconfigured with gsutil config -e, but it returned the same error for the PEM format.

My gsutil version is 3.37. I compiled and installed pycrypto-2.6

Please help me get rid of this error.

+2
google-cloud-storage gsutil
source share
2 answers

So it looks like there are a few things going on behind the scenes. One of them is that the library used by gsutil reporting this error does not correctly identify the PEM files, so it still does not work after executing this command. We will work to ensure that this is fixed for the next release of gsutil.

In the short term, can you install PyOpenSSL? This should work with the PKCS12 file. You can do this with something like:

 easy_install pyOpenSSL 

or

 pip install pyOpenSSL 

(you'll probably need sudo for this).

+1
source share

The way I fixed this problem (for anyone who started working with Google) was after running the command specified by the application, I edited the key (in Vim, but any text editor should work) and deleted the additional information at the beginning of the file.

Before editing:

 Bag Attributes friendlyName: privatekey localKeyID: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Key Attributes: <No Attributes> -----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY----- 

After editing:

 -----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY----- 
+6
source share

All Articles