Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new_from_file should fail on an incorrect certificate file #49

Open
salaun-urennes1 opened this issue Jan 13, 2016 · 0 comments
Open

new_from_file should fail on an incorrect certificate file #49

salaun-urennes1 opened this issue Jan 13, 2016 · 0 comments

Comments

@salaun-urennes1
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants