Net-ACME2

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "Call::Context" : "0.02",
            "Crypt::Format" : "0.06",
            "Crypt::Perl" : "0.18",
            "HTTP::Tiny" : "0.058",
            "HTTP::Tiny::UA::Response" : "0.004",
            "IO::Socket::SSL" : "0",
            "JSON" : "2.9",
            "MIME::Base64" : "3.11",
            "Module::Runtime" : "0",
            "X::Tiny" : "0.12",
            "autodie" : "0",
            "constant" : "1.23",
            "parent" : "0.225",
            "perl" : "5.008009"
         }
      },

META.yml  view on Meta::CPAN

no_index:
  directory:
    - t
    - inc
requires:
  Call::Context: '0.02'
  Crypt::Format: '0.06'
  Crypt::Perl: '0.18'
  HTTP::Tiny: '0.058'
  HTTP::Tiny::UA::Response: '0.004'
  IO::Socket::SSL: '0'
  JSON: '2.9'
  MIME::Base64: '3.11'
  Module::Runtime: '0'
  X::Tiny: '0.12'
  autodie: '0'
  constant: '1.23'
  parent: '0.225'
  perl: '5.008009'
resources:
  bugtracker: https://github.com/FGasper/p5-Net-ACME2/issues

Makefile.PL  view on Meta::CPAN

        'HTTP::Tiny'               => 0.058,
        'HTTP::Tiny::UA::Response' => 0.004,
        'JSON'                     => 2.9,
        'MIME::Base64'             => 3.11,
        'Module::Runtime'          => 0,
        'X::Tiny'                  => 0.12,

        # We need SSL to speak ACME. There is no pure Perl
        # SSL implementation, so the following will bring in
        # Net::SSLeay, which requires XS. :-(
        'IO::Socket::SSL'          => 0,
    },
    META_MERGE => {
        'meta-spec' => { version => 2 },
        resources   => {
            repository => {
                type => 'git',
                url  => 'https://github.com/FGasper/p5-Net-ACME2.git',
                web  => 'https://github.com/FGasper/p5-Net-ACME2',
            },
            bugtracker => {

examples/tls_alpn_01_client.pl  view on Meta::CPAN

# It’s useful for testing your challenge setup independently of the
# actual ACME validation.
#
# See tls_alpn_01_server.pl for a corresponding server implementation.

use constant {
    _DOMAIN => 'example.com',
};

use Crypt::OpenSSL::X509;
use IO::Socket::SSL;

use Crypt::Perl::X509::Extension::acmeValidation_v1;

die 'No ALPN support in Net::SSLeay!' if !Net::SSLeay->can('CTX_set_alpn_protos');

my $client = IO::Socket::SSL->new(
    PeerAddr => '127.0.0.1',
    PeerPort => '443',
    ReuseAddr => 1,
    SSL_alpn_protocols => [ 'acme-tls/1' ],
    SSL_hostname => _DOMAIN(),
    SSL_verify_callback => sub {
        my ($ossl_o, $cert_store, $attrs_str, $errs_str, $cert_addr) = @_;

        my $pem = Net::SSLeay::PEM_get_string_X509($cert_addr);

examples/tls_alpn_01_server.pl  view on Meta::CPAN

use strict;
use warnings;
use autodie;

# This script demonstrates the server workflow for tls-alpn-01.
# This is what ACME clients will need to set up to complete a
# tls-alpn-01 challenge.
#
# See tls_alpn_01_server.pl for a corresponding client implementation.

use IO::Socket::SSL;
use IO::Socket::SSL::Utils;

use Net::ACME2::Challenge::tls_alpn_01;

die 'No ALPN support in Net::SSLeay!' if !Net::SSLeay->can('CTX_set_alpn_protos');

# This sample certificate is for “example.com”.
my $cert = <<END;
-----BEGIN CERTIFICATE-----
MIIBbDCCAROgAwIBAgIBADAKBggqhkjOPQQDAjAWMRQwEgYDVQQDDAtleGFtcGxlLmNvbTAiGA8y
MDE4MDYxNjIyNDQzNloYDzIwMTgwNjIwMjI0NDM2WjAWMRQwEgYDVQQDDAtleGFtcGxlLmNvbTBZ
MBMGByqGSM49AgEGCCqGSM49AwEHA0IABMz7vfcn+luxABJVCbTwaiodfgHtMpKOKOO2JB/PH870
Nuv3zYtxaTV5qJgv+zeDPLnOh2Iha7zY+aitiTInMt+jTjBMMBYGA1UdEQQPMA2CC2V4YW1wbGUu
Y29tMDIGCSsGAQUFBwEeAQEB/wQiBCD62VSO3yQctnxsRD5HODf+rESG3LA/1r87NtogRts92zAK
BggqhkjOPQQDAgNHADBEAiBaT2YvK5XPp2gROihwkogKyYhIi/7j0sxq8tMJinoEsAIgXTYzuEcl
t57FEFwZ0kzWqRurHOOqoUg26gW495mhSNU=
-----END CERTIFICATE-----
END

my $server = IO::Socket::SSL->new(
    LocalAddr => '0.0.0.0',
    LocalPort => 443,
    Listen => 1,
    SSL_cert => IO::Socket::SSL::Utils::PEM_string2cert($cert),
    SSL_key => IO::Socket::SSL::Utils::PEM_string2key( Net::ACME2::Challenge::tls_alpn_01::KEY() ),
    SSL_alpn_protocols => [ 'acme-tls/1' ],
);

die "Failed to instantiate SSL server: $! ($@)" if !$server;

while ( $server->accept() ) {
    last if !fork();
}

close $server;



( run in 0.539 second using v1.01-cache-2.11-cpan-4d50c553e7e )