Net-SSLeay

 view release on metacpan or  search on metacpan

SSLeay.xs  view on Meta::CPAN

            BIO_free(bp);
        }

int
CTX_use_PKCS12_file(ctx, file, password=NULL)
        SSL_CTX *ctx
        char *file
        char *password
    PREINIT:
        PKCS12 *p12;
        EVP_PKEY *private_key;
        X509 *certificate;
        BIO *bio;
    CODE:
        RETVAL = 0;
        bio = BIO_new_file(file, "rb");
        if (bio) {
            OPENSSL_add_all_algorithms_noconf();
            if ((p12 = d2i_PKCS12_bio(bio, NULL))) {
                if (PKCS12_parse(p12, password, &private_key, &certificate, NULL)) {
                    if (private_key) {
                        if (SSL_CTX_use_PrivateKey(ctx, private_key)) RETVAL = 1;
                        EVP_PKEY_free(private_key);
                    }
                    if (certificate) {
                        if (SSL_CTX_use_certificate(ctx, certificate)) RETVAL = 1;
                        X509_free(certificate);
                    }
                }
                PKCS12_free(p12);
            }
            if (!RETVAL) ERR_print_errors_fp(stderr);
            BIO_free(bio);

lib/Net/SSLeay.pm  view on Meta::CPAN

    NID_pkcs9
    NID_pkcs9_challengePassword
    NID_pkcs9_contentType
    NID_pkcs9_countersignature
    NID_pkcs9_emailAddress
    NID_pkcs9_extCertAttributes
    NID_pkcs9_messageDigest
    NID_pkcs9_signingTime
    NID_pkcs9_unstructuredAddress
    NID_pkcs9_unstructuredName
    NID_private_key_usage_period
    NID_rc2_40_cbc
    NID_rc2_64_cbc
    NID_rc2_cbc
    NID_rc2_cfb64
    NID_rc2_ecb
    NID_rc2_ofb64
    NID_rc4
    NID_rc4_40
    NID_rc5_cbc
    NID_rc5_cfb64

lib/Net/SSLeay.pod  view on Meta::CPAN


    my $rv = Net::SSLeay::CTX_callback_ctrl($ctx, $cmd, $fp);
    # $ctx - value corresponding to openssl's SSL_CTX structure
    # $cmd - (integer) command id
    # $fp - (function pointer) ???
    #
    # returns: ???

Check openssl doc L<https://www.openssl.org/docs/manmaster/man3/SSL_CTX_ctrl.html>

=item * CTX_check_private_key

Checks the consistency of a private key with the corresponding certificate loaded into $ctx.

    my $rv = Net::SSLeay::CTX_check_private_key($ctx);
    # $ctx - value corresponding to openssl's SSL_CTX structure
    #
    # returns: 1 on success, otherwise check out the error stack to find out the reason

Check openssl doc L<https://www.openssl.org/docs/manmaster/man3/SSL_CTX_use_certificate.html>

=item * CTX_ctrl

Internal handling function for SSL_CTX objects.

t/local/21_constants.t  view on Meta::CPAN

    NID_pkcs9
    NID_pkcs9_challengePassword
    NID_pkcs9_contentType
    NID_pkcs9_countersignature
    NID_pkcs9_emailAddress
    NID_pkcs9_extCertAttributes
    NID_pkcs9_messageDigest
    NID_pkcs9_signingTime
    NID_pkcs9_unstructuredAddress
    NID_pkcs9_unstructuredName
    NID_private_key_usage_period
    NID_rc2_40_cbc
    NID_rc2_64_cbc
    NID_rc2_cbc
    NID_rc2_cfb64
    NID_rc2_ecb
    NID_rc2_ofb64
    NID_rc4
    NID_rc4_40
    NID_rc5_cbc
    NID_rc5_cfb64

t/local/36_verify.t  view on Meta::CPAN

sub run_server
{
    my $pid;
    defined($pid = fork()) or BAIL_OUT("failed to fork: $!");

    return if $pid != 0;

    $SIG{'PIPE'} = 'IGNORE';
    my $ctx = new_ctx();
    Net::SSLeay::set_cert_and_key($ctx, $cert_pem, $key_pem);
    my $ret = Net::SSLeay::CTX_check_private_key($ctx);
    BAIL_OUT("Server: CTX_check_private_key failed: $cert_pem, $key_pem") unless $ret == 1;
    if (defined &Net::SSLeay::CTX_set_num_tickets) {
        # TLS 1.3 server sends session tickets after a handhake as part of
        # the SSL_accept(). If a client finishes all its job including closing
        # TCP connectino before a server sends the tickets, SSL_accept() fails
        # with SSL_ERROR_SYSCALL and EPIPE errno and the server receives
        # SIGPIPE signal. <https://github.com/openssl/openssl/issues/6904>
        my $ret = Net::SSLeay::CTX_set_num_tickets($ctx, 0);
        BAIL_OUT("Session tickets disabled") unless $ret;
    }

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.785 second using v1.00-cache-2.02-grep-82fe00e-cpan-2cc899e4a130 )