1

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.

4

1 に答える 1

0

これはまさに私が探していたものです:

Net::SSLeay::CTX_use_RSAPrivateKey_file($ctx, $key, &Net::SSLeay::FILETYPE_PEM)
    and die_if_ssl_error("private key");
Net::SSLeay::CTX_use_certificate_chain_file($ctx, $crt)
    and die_if_ssl_error("CTX_use_certificate_chain_file");

$crt には 2 つの証明書が含まれています。最初はクライアント証明書で、その後に中間証明書が続きます。

于 2013-02-18T09:04:32.343 に答える