OpenWISP
[django-x509] Improve error message of _validate_pem
Create a new x509 Certificate and Key using openssl:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365
Go to project repository: github.com/openwisp/django-x509
Star and fork the project, then clone it and install it locally on your computer using a new python virtual environment.
After successfully setting it up, runserver and add a new CA using the key generated before and enter incorrect password for the passphrase.
You'll receive an error message. image.
The task is to make this error more human readable: i.e remove []
and seperate values with ,
.
Convert:
OpenSSL 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')]
To:
OpenSSL 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')
Make sure the same fix is working while creating a new certificate.
When successfully done, make a pull request. :)
Task tags
Students who completed this task
Daniel Wang