Anaplan Certificate Authentication using python

Options
timmapuramreddy
timmapuramreddy Member, ALL USERS Posts: 3 New Contributor

Hello everyone,

 

We are working on POC to integrate Anaplan with the other system in the enterprise, We are using Python, and currently struck at the Certificate Authentication

 

We are using the below Code to Test the Authentication using the Certificate (public Key), Private Key and we are following, Please find the attached python script that we are using

 

Code Reference: https://community.anaplan.com/t5/Best-Practices/Transactional-API-Tutor/ta-p/90275

 

 

below is the error

 

C:\python> python auth_test.py
Enter PEM pass phrase:
Traceback (most recent call last):
File "auth_test.py", line 47, in <module>
generate_ca_cert_authentication(anaplan_public_certificate,File "auth_test.py", line 24, in generate_ca_cert_authentication
key = crypto.load_privatekey(crypto.FILETYPE_PEM, st_key) File "C:\Python\venv\lib\site-packages\OpenSSL\crypto.py", line 2916, in load_privatekey
_raise_current_error() File "C:\Python\venv\lib\site-packages\OpenSSL\_util.py", line 57, in exception_from_error_queue
raise exception_type(errors)
OpenSSL.crypto.Error: [('digital envelope routines', 'EVP_DecryptFinal_ex', 'bad decrypt'), ('PKCS12 routines', 'PKCS12_pbe_crypt', 'pkcs12 cipherfinal error'), ('PKCS12 routines', 'PKCS12_item_decrypt_d2i', 'pkcs12 pbe crypt error'), ('PEM routines', 'PEM_read_bio_PrivateKey', 'ASN1 lib')]