Perl newbie here. I need to chain an intermediate CA x509 certificate to my client certificate.
Net::SSLeay::set_cert_and_key($ctx, $crt, $key);
my $bio = Net::SSLeay::BIO_new_file("subca.crt", 'r');
my $x509 = Net::SSLeay::PEM_read_bio_X509($bio);
Net::SSLeay::CTX_add_extra_chain_cert($ctx, $x509)
and die_if_ssl_error("CTX_add_extra_chain_cert"); # It dies here.
The certificate is in pem format. Can anyone help?
Edit: I have found that the call to "Net::SSLeay::PEM_read_bio_X509()" returns 0, which is an error condition.