new_from_file should fail on an incorrect certificate file
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