perl-crypt-openssl-x509 icon indicating copy to clipboard operation
perl-crypt-openssl-x509 copied to clipboard

new_from_file should fail on an incorrect certificate file

Open salaun-urennes1 opened this issue 9 years ago • 0 comments

Hello,

I'm using Crypt::OpenSSL::X509 version 1.804 on an ubuntu server. I have a badly formated certificate file and I expect the new_from_file() call to fail while loading it. However it doesn't, even though command-line call to openssl on the same server fails. See below.

perl

use Crypt::OpenSSL::X509; $x509 = Crypt::OpenSSL::X509->new_from_file('should_raise_an_error.crt',Crypt::OpenSSL::X509::FORMAT_PEM);

openssl x509 -in should_raise_an_error.crt -text

unable to load certificate 140622884865696:error:0D07209B:asn1 encoding routines:ASN1_get_object:too long:asn1_lib.c:142: 140622884865696:error:0D068066:asn1 encoding routines:ASN1_CHECK_TLEN:bad object header:tasn_dec.c:1327: 140622884865696:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:390:Type=X509_CERT_AUX 140622884865696:error:0906700D:PEM routines:PEM_ASN1_read_bio:ASN1 lib:pem_oth.c:83:

Attached is the should_raise_an_error.crt file. should_raise_an_error.crt.txt

Is there some type or error handling I should use to trigger an error?

Regards

salaun-urennes1 avatar Jan 13 '16 12:01 salaun-urennes1