Result:
found 278 distributions and 1026 files matching your query ! ( run in 0.921 )


HTML-FormHandlerX-Field-reCAPTCHA

 view release on metacpan or  search on metacpan

lib/HTML/FormHandlerX/Field/reCAPTCHA.pm  view on Meta::CPAN

our $AUTHORITY = 'cpan:JJNAPIORK';

has '+widget' => ( default => 'reCAPTCHA' );
has '+input_param' => ( default => 'recaptcha_response_field' );

has [qw/public_key private_key/] => (is=>'rw', isa=>'Str', lazy_build=>1);
has 'use_ssl' => (is=>'rw', isa=>'Bool', required=>1, default=>0);
has 'remote_address' => (is=>'rw', isa=>'Str', lazy_build=>1);
has 'recaptcha_options' => (is=>'rw', isa=>'HashRef', required=>1, default=>sub{ +{} });
has 'recaptcha_message' => (is=>'rw', isa=>'Str', default=>'Error validating reCAPTCHA');
has 'recaptcha_instance' => (is=>'ro', init_arg=>undef, lazy_build=>1);

lib/HTML/FormHandlerX/Field/reCAPTCHA.pm  view on Meta::CPAN

    } else {
        die "You either have to set the 'public_key' field option or defined a $method method in your form!";
    }
}

sub _build_private_key {
    my $self = shift @_;
    my $form = $self->form;
    my $method = $self->name.'_private_key';
    if ($form->can($method)) {
        return $form->$method;
    } else {
        die "You either have to set the 'private_key' field option or defined a $method method in your form!";
    }
}

sub _build_encrypter {
    my $self = shift @_;
    my $key = pack("H16",$self->private_key);
    return Crypt::CBC->new(-key=>$key,-cipher=>"Blowfish");   
}

sub _build_remote_address {
    $ENV{REMOTE_ADDR};

lib/HTML/FormHandlerX/Field/reCAPTCHA.pm  view on Meta::CPAN

}

sub prepare_private_recaptcha_args {
    my $self = shift @_;
    return (
        $self->private_key,
        $self->prepare_recaptcha_args,
    );
}

sub prepare_recaptcha_args {

lib/HTML/FormHandlerX/Field/reCAPTCHA.pm  view on Meta::CPAN

In your L<HTML::FormHandler> subclass, "MyApp::HTML::Forms::MyForm":

    has_field 'recaptcha' => (
        type=>'reCAPTCHA', 
        public_key=>'[YOUR PUBLIC KEY]',
        private_key=>'[YOUR PRIVATE KEY]',
        recaptcha_message => "You're failed to prove your Humanity!",
        required=>1,
    ); 

Example L<Catalyst> controller:

lib/HTML/FormHandlerX/Field/reCAPTCHA.pm  view on Meta::CPAN


=head2 public_key

The public key you get when you create an account on L<http://recaptcha.net/>

=head2 private_key

The private key you get when you create an account on L<http://recaptcha.net/>

=head2 use_ssl

lib/HTML/FormHandlerX/Field/reCAPTCHA.pm  view on Meta::CPAN

=head1 FORM METHODS

The following methods or attributes can be set in the form which contains the
recapcha field.

=head2 $name_public_key or $name_private_key

"$name" is the name you gave to the reCAPTCHA field (the word directy after the
"has_field" command.

You may wish to set your public key from a method or attribute contained from
within the form.  This would make it easier to have one form class and use
configuration tools, such as what L<Catalyst> offers, to set the pubic key.
For example:

    ## In my form "MyApp::Form::MyForm
    has ['MY_recaptcha_public_key', 'MY_recapcha_private_key'] => (
        is=>'ro', isa=>'Str', required=>1,
    );
    has_field 'MY_recaptcha' => (
        type=>'reCAPTCHA', 
        recaptcha_message => "You're failed to prove your Humanity!",

lib/HTML/FormHandlerX/Field/reCAPTCHA.pm  view on Meta::CPAN


Then you might construct this in a L<Catalyst::Controller>:

    my $form = MyApp::Form::MyForm->new(
        MY_recaptcha_public_key => $self->controller_public_key,
        MY_recaptcha_private_key => $self->controller_private_key,
    );

    ## 'process', etc.

Then your controller could populate the attributes 'controller_public_key' and
'controller_private_key' from your global L<Catalyst> configuration, allowing
you to use one set of keys in development and another for production, or even 
use different keys for different forms if you wish.

=head1 SEE ALSO

 view all matches for this distribution


HTTP-PublicKeyPins

 view release on metacpan or  search on metacpan

lib/HTTP/PublicKeyPins.pm  view on Meta::CPAN

        /^[-]{5}BEGIN[ ](?:RSA[ ])?(PUBLIC|PRIVATE)[ ]KEY[-]{5}/smx )
    {
        my ($type) = ($1);
        if ( $type eq 'PRIVATE' ) {
            $pem_encoded_public_key_string =
              _process_pem_private_key( $handle, $file_header, $path );
        }
        else {
            $pem_encoded_public_key_string =
              _process_pem_public_key( $handle, $file_header, $path );
        }

lib/HTTP/PublicKeyPins.pm  view on Meta::CPAN

    }
    else {
        $pem_encoded_public_key_string =
          _check_for_der_encoded_x509_certificate( $handle, $file_header,
            $path )
          || _check_for_der_encoded_private_key( $handle, $file_header, $path )
          || _check_for_der_pkcs10_certificate_request( $handle, $file_header,
            $path )
          || _check_for_der_encoded_public_key( $handle, $file_header, $path );
        if ( !defined $pem_encoded_public_key_string ) {
            Carp::croak("$path is not an X.509 Certificate");

lib/HTTP/PublicKeyPins.pm  view on Meta::CPAN

        return;
    };
    return $pem_encoded_public_key_string;
}

sub _check_for_der_encoded_private_key {
    my ( $handle, $file_header, $path ) = @_;
    my $pem_encoded_public_key_string;
    seek $handle, 0, Fcntl::SEEK_SET()
      or Carp::croak("Failed to seek to start of $path:$EXTENDED_OS_ERROR");
    defined read $handle, my $der_encoded_private_key_string,
      _MAX_PUBLIC_KEY_SIZE()
      or Carp::croak("Failed to read from $path:$EXTENDED_OS_ERROR");
    my $pem_encoded_private_key_string =
        "-----BEGIN RSA PRIVATE KEY-----\n"
      . MIME::Base64::encode_base64($der_encoded_private_key_string)
      . "-----END RSA PRIVATE KEY-----\n";
    eval {
        my $privkey =
          Crypt::OpenSSL::RSA->new_private_key($pem_encoded_private_key_string);
        $pem_encoded_public_key_string = $privkey->get_public_key_x509_string();
    } or do {
        return;
    };
    return $pem_encoded_public_key_string;
}

sub _process_pem_private_key {
    my ( $handle, $file_header, $path ) = @_;
    my $pem_encoded_public_key_string;
    seek $handle, 0, Fcntl::SEEK_SET()
      or Carp::croak("Failed to seek to start of $path:$EXTENDED_OS_ERROR");
    defined read $handle, my $rsa_private_key_string, _MAX_PUBLIC_KEY_SIZE()
      or Carp::croak("Failed to read from $path:$EXTENDED_OS_ERROR");
    my $privkey = Crypt::OpenSSL::RSA->new_private_key($rsa_private_key_string);
    $pem_encoded_public_key_string = $privkey->get_public_key_x509_string();
    return $pem_encoded_public_key_string;
}

sub _process_pem_public_key {

 view all matches for this distribution


IBM-SONAS

 view release on metacpan or  search on metacpan

lib/IBM/SONAS.pm  view on Meta::CPAN

	# Create an IBM::SONAS object

	my $ibm = IBM::SONAS->new(
				user     => 'admin',
				host     => 'my-sonas.company.com',
				key_path => '/path/to/my/.ssh/private_key'
		) or die "Couldn't create object! $!\n";

=head1 METHODS

=head3 new ( %ARGS )

	my $ibm = IBM::SONAS->new(      
				user     => 'admin',
				host     => 'my-sonas.company.com',
				key_path => '/path/to/my/.ssh/private_key'
		) or die "Couldn't create object! $!\n";

Constructor - creates a new IBM::SONAS object.  This method accepts three 
mandatory parameters and one optional parameter, the three mandatory 
parameters are:

 view all matches for this distribution


IBM-StorageSystem

 view release on metacpan or  search on metacpan

lib/IBM/StorageSystem.pm  view on Meta::CPAN


	# Create a IBM::StorageSystem object
	my $ibm = IBM::StorageSystem->new(	
					user		=> 'admin',
					host		=> 'my-StorageSystem',
					key_path	=> '/path/to/my/.ssh/private_key'
			) or die "Couldn't create object! $!\n";

	# Get a list of our enclosures as IBM::StorageSystem::Enclosure objects
	my @enclosures = $ibm->get_enclosures;

lib/IBM/StorageSystem.pm  view on Meta::CPAN

=head3 new 

	my $ibm = IBM::StorageSystem->new(	
					user		=> 'admin',
					host		=> 'my-StorageSystem',
					key_path	=> '/path/to/my/.ssh/private_key'
			) or die "Couldn't create object! $!\n";

Constructor - creates a new IBM::StorageSystem object.  This method accepts three mandatory parameters
and one optional parameter, the three mandatory parameters are:

lib/IBM/StorageSystem.pm  view on Meta::CPAN

        use Date::Calc qw(date_to_Time Today_and_Now);

        my $ibm = IBM::StorageSystem->new(      
                                        user            => 'admin',
                                        host            => 'my-v7000',
                                        key_path        => '/path/to/my/.ssh/private_key'
                                ) or die "Couldn't create object! $!\n";

        # Generate an alert for any replication errors in the last six hours

        foreach my $task ( $ibm->get_replications ) {

 view all matches for this distribution


IBM-V7000

 view release on metacpan or  search on metacpan

lib/IBM/V7000.pm  view on Meta::CPAN


=head3 new 

        my $ibm = IBM::V7000->new(      user            => 'admin',
                                        host            => 'my-v7000.company.com',
                                        key_path        => '/path/to/my/.ssh/private_key'
                        ) or die "Couldn't create object! $!\n";

Constructor - creates a new IBM::V7000 object.  This method accepts three mandatory parameters
and one optional parameter, the three mandatory parameters are:

 view all matches for this distribution


IBM-V7000Unified

 view release on metacpan or  search on metacpan

lib/IBM/V7000Unified.pm  view on Meta::CPAN

=head3 new 

        my $ibm = IBM::V7000Unified->new(
				user     => 'admin',
				host     => 'my-v7000-unified.company.com',
				key_path => '/path/to/my/.ssh/private_key'
			) or die "Couldn't create object! $!\n";

Constructor - creates a new IBM::V7000Unified object.  This method accepts 
three mandatory parameters and one optional parameter, the three mandatory 
parameters are:

 view all matches for this distribution


IPC-Transit

 view release on metacpan or  search on metacpan

ex/crypto.pl  view on Meta::CPAN


#note that this code will not work exactly as written, because it needs
#to run on two different boxes.


my ($sender_public_key, $sender_private_key) = IPC::Transit::gen_key_pair();
my ($receiver_public_key, $receiver_private_key) = IPC::Transit::gen_key_pair();


$IPC::Transit::my_hostname = 'sender.hostname.com';
$IPC::Transit::my_keys->{public} = $sender_public_key;
$IPC::Transit::my_keys->{private} = $sender_private_key;
$IPC::Transit::public_keys->{'receiver.hostname.com'} = $receiver_public_key;


IPC::Transit::send(
    message => {foo => 'bar'},

ex/crypto.pl  view on Meta::CPAN


#teleport over to the receiver, magically using keys generated above

$IPC::Transit::my_hostname = 'receiver.hostname.com';
$IPC::Transit::my_keys->{public} = $receiver_public_key;
$IPC::Transit::my_keys->{private} = $receiver_private_key;
$IPC::Transit::public_keys->{'sender.hostname.com'} = $sender_public_key;

my $message = IPC::Transit::receiver(
    qname => 'some_qname'
);

 view all matches for this distribution


JIRA-REST-OAuth

 view release on metacpan or  search on metacpan

lib/JIRA/REST/OAuth.pm  view on Meta::CPAN

    else {
        %args = @_;
    }

    # remove arguments for this subclass
    my @opts = qw( rsa_private_key oauth_token oauth_token_secret consumer_key );
    my %a;
    foreach my $opt (@opts) {
        croak __PACKAGE__.'::new requires argument '.$opt unless defined $args{$opt};
        $a{$opt} = delete $args{$opt};
    }

lib/JIRA/REST/OAuth.pm  view on Meta::CPAN

    my $url  = $args{url} if exists $args{url};
    my $self = $class->SUPER::new(\%args);
    $$self{url} = $url;

    # handle our options
    if (-e $a{rsa_private_key}) {
        open(my $fh, '<', $a{rsa_private_key}) or die "Unable to read $a{rsa_private_key}! $!";
        local $/ = undef;
        my $data = <$fh>;
        close($fh);

        $a{rsa_private_key} = Crypt::OpenSSL::RSA->new_private_key($data);
    }
    else {
        $a{rsa_private_key} = Crypt::OpenSSL::RSA->new_private_key($a{rsa_private_key});
    }

    foreach my $opt (@opts) {
        $$self{$opt} = delete $a{$opt};
    }

lib/JIRA/REST/OAuth.pm  view on Meta::CPAN


        consumer_key     => $$self{consumer_key},
        consumer_secret  => 'ignore',
        signature_method => 'RSA-SHA1',
        protocol_version => Net::OAuth::PROTOCOL_VERSION_1_0,
        signature_key    => $$self{rsa_private_key},
        token            => $$self{oauth_token},
        token_secret     => $$self{oauth_token_secret},

        timestamp => time,
        nonce     => int(rand(2**32)),

lib/JIRA/REST/OAuth.pm  view on Meta::CPAN


    use JIRA::REST::OAuth;
    my $jira = JIRA::REST::OAuth->new(
        {
            url                => 'https://jira.example.net',
            rsa_private_key    => '/path/to/private/key.pem',
            oauth_token        => '<oauth_token>',
            oauth_token_secret => '<oauth_token_secrete>',
            consumer_key       => '<key>',
        }
    );

 view all matches for this distribution


JSON-WebEncryption

 view release on metacpan or  search on metacpan

lib/JSON/WebEncryption.pm  view on Meta::CPAN

    my $self =  bless {}, $caller;

    $self->{alg}         = $arg{alg};
    $self->{enc}         = $arg{enc};
    $self->{key}         = $arg{key};
    $self->{private_key} = $arg{private_key};
    $self->{public_key}  = $arg{public_key};

    return $self;
}

lib/JSON/WebEncryption.pm  view on Meta::CPAN


# -----------------------------------------------------------------------------

sub _alg_RSA1_5_decode
{
    my ( $self, $enc_params, $private_key, $iv, $ciphertext, $encrypted_key  ) = @_;

    $private_key //= $self->{private_key};

    my $cipherType = $enc_params->[0];
    my $keysize    = $enc_params->[1] / 8; # /8 to get it in bytes
    my $padding    = $crypt_padding_map{ $enc_params->[3] };

    # Decrypt the encryption key using the Private Key
    my $rsa = Crypt::OpenSSL::RSA->new_private_key( $private_key ); # Key passed in is a Private Key
    $rsa->use_pkcs1_oaep_padding;
    my $CEK = $rsa->decrypt( $encrypted_key );

    # Use the encryption key to decrypt the message
    my $cipher = _getCipher( $cipherType, $CEK, $padding, $iv, $keysize );

 view all matches for this distribution


JSON-WebToken

 view release on metacpan or  search on metacpan

lib/JSON/WebToken/Crypt/RSA.pm  view on Meta::CPAN

};

sub sign {
    my ($class, $algorithm, $message, $key) = @_;

    my $private_key = Crypt::OpenSSL::RSA->new_private_key($key);
    my $method = $ALGORITHM2SIGNING_METHOD_MAP->{$algorithm};
    $private_key->$method;
    return $private_key->sign($message);
}

sub verify {
    my ($class, $algorithm, $message, $key, $signature) = @_;

 view all matches for this distribution


Jifty-Plugin-OAuth

 view release on metacpan or  search on metacpan

t/lib/TestApp/Plugin/OAuth/Test.pm  view on Meta::CPAN


    my $signature;

    if ($sig_method eq 'RSA-SHA1') {
        require Crypt::OpenSSL::RSA;
        my $pubkey = Crypt::OpenSSL::RSA->new_private_key($key);
        $signature = encode_base64($pubkey->sign($signature_base_string), "");
    }
    elsif ($sig_method eq 'HMAC-SHA1') {
        my $key = join '&',
          map { Jifty->web->escape_uri($_||'') }

 view all matches for this distribution


LaTeXML-Plugin-LtxMojo

 view release on metacpan or  search on metacpan

lib/LaTeXML/Plugin/LtxMojo/public/js/external/ace-min/mode-php.js  view on Meta::CPAN

define("ace/mode/php",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/php_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cs...

 view all matches for this distribution


Lemonldap-NG-Common

 view release on metacpan or  search on metacpan

lib/Lemonldap/NG/Common/Util/Crypto.pm  view on Meta::CPAN

    my ( $key_size, $password ) = @_;

    my $rsa = Crypt::OpenSSL::RSA->generate_key( $key_size );

    my $keys  = {
        'private' => $rsa->get_private_key_string(),
        'public'  => $rsa->get_public_key_x509_string(),
        'hash'    => md5_base64( $rsa->get_public_key_string() ),
    };
    if ( $password ) {
        my $pem = Convert::PEM->new(

 view all matches for this distribution


Lemonldap-NG-Manager

 view release on metacpan or  search on metacpan

lib/Lemonldap/NG/Manager/Attributes.pm  view on Meta::CPAN

                {
                    'k' => 'client_secret_jwt',
                    'v' => 'client_secret_jwt'
                },
                {
                    'k' => 'private_key_jwt',
                    'v' => 'private_key_jwt'
                }
            ],
            'type' => 'select'
        },
        'oidcOPMetaDataOptionsTooltip' => {

lib/Lemonldap/NG/Manager/Attributes.pm  view on Meta::CPAN

                {
                    'k' => 'client_secret_jwt',
                    'v' => 'client_secret_jwt'
                },
                {
                    'k' => 'private_key_jwt',
                    'v' => 'private_key_jwt'
                }
            ],
            'type' => 'select'
        },
        'oidcRPMetaDataOptionsAuthnLevel' => {

 view all matches for this distribution


Lemonldap-NG-Portal

 view release on metacpan or  search on metacpan

lib/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm  view on Meta::CPAN

            $self->logger->debug("JWT signature request verified");

            $authMethod =
              $alg =~ /^HS/i
              ? 'client_secret_jwt'
              : 'private_key_jwt';

            # Override OIDC parameters by request content
            foreach ( keys %$request ) {
                $self->logger->debug( "Override $_ OIDC param"
                      . " by value present in request parameter" );

 view all matches for this distribution


Lexical-Attributes

 view release on metacpan or  search on metacpan

t/BusyDestroy.pm  view on Meta::CPAN


use strict;
use warnings;
use Lexical::Attributes;

has $.private_key;
has $.simple_key   is ro;
has $.settable_key is rw;

sub new {
    bless [] => shift;
}

method load_me {
    $.private_key  = $_ [0] if @_;
    $.simple_key   = $_ [1] if @_ > 1;
    $.settable_key = $_ [2] if @_ > 2;
}

sub count_keys {
   (scalar keys %simple_key,
    scalar keys %private_key,
    scalar keys %settable_key,)
}

method DESTRUCT {
    1;

 view all matches for this distribution


Linux-WireGuard

 view release on metacpan or  search on metacpan

lib/Linux/WireGuard.pm  view on Meta::CPAN


=item * C<name>

=item * C<ifindex>

=item * C<public_key> and C<private_key> (raw strings, or undef)

=item * C<fwmark> (can be undef)

=item * C<listen_port> (can be undef)

lib/Linux/WireGuard.pm  view on Meta::CPAN


=head2 del_device( $NAME )

Deletes a WireGuard device with the given $NAME.

=head2 $bin = generate_private_key()

Returns a newly-generated private key (raw string).

=head2 $bin = generate_public_key( $PRIVATE_KEY )

 view all matches for this distribution


Mail-DKIM-Iterator

 view release on metacpan or  search on metacpan

lib/Mail/DKIM/Iterator.pm  view on Meta::CPAN

	return;
    };
    my $hash = _compute_hdrhash($hdr,
	$sig{'h:list'},$sig->{'a:hash'},$sig->{'c:hdr'},$dkh);

    my $priv = ref($key) ? $key : Crypt::OpenSSL::RSA->new_private_key($key);
    $priv or do {
	$$error = "using private key failed";
	return;
    };
    $priv->use_no_padding;

 view all matches for this distribution


Mail-DKIM

 view release on metacpan or  search on metacpan

lib/Mail/DKIM/Algorithm/Base.pm  view on Meta::CPAN


Call this method when all the headers have been submitted.

=head2 sign() - generates a signature using a private key

  $base64 = $algorithm->sign($private_key);

=head2 signature() - get/set the signature worked on by this algorithm

  my $old_signature = $algorithm->signature;
  $algorithm->signature($new_signature);

 view all matches for this distribution


Mail-Decency

 view release on metacpan or  search on metacpan

lib/Mail/Decency/Policy.pm  view on Meta::CPAN

    close $fh;
    
    # try load rsa and init private key
    my $load_rsa = eval "use Crypt::OpenSSL::RSA; 1;";
    if ( $load_rsa ) {
        $self->forward_sign_key_priv( Crypt::OpenSSL::RSA->new_private_key( $key_content ) );
    }
    
    # failure in loading -> bye
    else {
        die "Could not load Crypt::OpenSSL::RSA, cannot sign headers! Error: $@\n";

 view all matches for this distribution


Mail-DomainKeys

 view release on metacpan or  search on metacpan

lib/Mail/DomainKeys/Key/Private.pm  view on Meta::CPAN


	
	my $cork;

	eval {
		$cork = new_private_key Crypt::OpenSSL::RSA($pkcs);
	};

	$@ and
		$self->errorstr($@),
		return;

 view all matches for this distribution


Mail-Milter-Authentication-Handler-BIMI

 view release on metacpan or  search on metacpan

t/04-unit-handler-bimi.t  view on Meta::CPAN

use Test::More;
use Mail::DKIM::Signer;
use Mail::DKIM::ARC::Signer;
use Mail::DKIM::PrivateKey;

my $private_key = Mail::DKIM::PrivateKey->load(Data=>'MIICXQIBAAKBgQDErv0qLGKJ933gdhx2MUBqb/XhTloMjJhH0kdQsxkVuhRFzINgDzMGOq83xEwNEk4jC/J+E49fNQ+TSVymq+XGvrkeW7/7llEOTFosY6OGlwdeUZyyUCEM6SIYIBeHuIQn4Ohwhq7P0nZFfXNAG7Wrlxx1O+E881wTRhFOBxAjdQIDAQABAoGA...

sub signed {
  my ( $text, %args ) = @_;
  my $dkim = Mail::DKIM::Signer->new(
    Algorithm => 'rsa-sha256',
    Method => 'relaxed',
    Domain => $args{domain},
    Selector => $args{selector},
    Key => $private_key,
    Headers => $args{headers},
  );
  my $signtext = $text;
  $signtext =~ s/\n/\r\n/g;
  $dkim->PRINT( $signtext );

t/04-unit-handler-bimi.t  view on Meta::CPAN

  my $arc = Mail::DKIM::ARC::Signer->new(
    Algorithm => 'rsa-sha256',
    SrvId => $args{srvid},,
    Domain => $args{domain},
    Selector => $args{selector},
    Key => $private_key,
    Chain => 'none',
    Timestamp => time(),
  );
  my $signtext = $text;
  $signtext =~ s/\n/\r\n/g;

 view all matches for this distribution


Mail-Simple-DKIM-Signer

 view release on metacpan or  search on metacpan

lib/Mail/Simple/DKIM/Signer.pm  view on Meta::CPAN


    my $class = shift;
    my $options = shift;
    my $self = {};
    
    my $private_key = $options->{key};
    $self->{headers} = $options->{headers};
    
    my $rsa_priv = new_private_key Crypt::OpenSSL::RSA($private_key);
    
    $self->{rsa} = $rsa_priv;
    
    $self->{BodyCanonicalization} = 'simplebody';
    $self->{HeadersCanonicalization} = 'simpleheader';

lib/Mail/Simple/DKIM/Signer.pm  view on Meta::CPAN

    
    use Mail::Simple::DKIM::Signer;
    
    my $dkim = Mail::Simple::DKIM::Signer->new({
        
        key => $private_key, #private key string
        domain => 'example.com',
        selector => 'dkim',
        c => 'simple/simple', ###simple/simple is the only supported Canonicalization
        a => 'rsa-sha1', ##rsa-sha1 is the only supported method
        i => '@example.com',

 view all matches for this distribution


Mail-SpamAssassin

 view release on metacpan or  search on metacpan

spamc/libspamc.c  view on Meta::CPAN

	    libspamc_log(flags, LOG_ERR,
			 "unable to load key file %s: %s",
			 tp->ssl_key_file, _ssl_err_as_string());
	    return EX_OSERR;
	}
	if (!SSL_CTX_check_private_key(ctx)) {
	    libspamc_log(flags, LOG_ERR,
			 "key file %s and cert file %s do not match: %s",
			 tp->ssl_key_file, tp->ssl_cert_file,
			 _ssl_err_as_string());
	    return EX_OSERR;

 view all matches for this distribution


Manta-Client

 view release on metacpan or  search on metacpan

lib/Manta/Client.pm  view on Meta::CPAN

	my $date_header = "date: $date";
	open F, "<$self->{key_file}";
	my $key = join '', <F>;
	close F;
	my $fingerprint = Net::SSH::Perl::Key->read_private("RSA", $self->{key_file})->fingerprint("md5");
	my $privatekey = Crypt::OpenSSL::RSA->new_private_key($key);
	$privatekey->use_sha256_hash();
	my $signature = encode_base64($privatekey->sign($date_header), "");
	my $h = HTTP::Headers->new(%{$params{headers}});
	$h->header(date => $date);
	$h->header('Authorization' => "Signature keyId=\"/$self->{user}/keys/$fingerprint\",algorithm=\"rsa-sha256\",signature=\"$signature\"");

 view all matches for this distribution


Metabrik-Repository

 view release on metacpan or  search on metacpan

lib/Metabrik/Crypto/X509.pm  view on Meta::CPAN

      "dir              =  $ca_directory",
      "certificate      =  $ca_cert",
      "database         =  \$dir/index.txt",
      "#certs            =  \$dir/cert-csr",
      "new_certs_dir    =  \$dir/certs",
      "private_key      =  $ca_key",
      "serial           =  \$dir/serial",
      "default_crl_days = 7",
      "default_days     = 3650",
      "#default_md       = md5",
      "default_md       = sha1",

 view all matches for this distribution


MicroECC

 view release on metacpan or  search on metacpan

lib/MicroECC.pm  view on Meta::CPAN

# This allows declaration	use MicroECC ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw(
  secp160r1 secp192r1 secp224r1 secp256r1 secp256k1
  make_key valid_public_key shared_secret curve_public_key_size curve_private_key_size
  compute_public_key verify sign
) ] );

our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

lib/MicroECC.pm  view on Meta::CPAN

  use Digest::SHA qw/sha1 sha256/;

  #curves: secp160r1 secp192r1 secp224r1 secp256r1 secp256k1
  my $curve = MicroECC::secp160r1();
  printf "Public key size: %d, private key size: %d.\n", 
	  MicroECC::curve_public_key_size($curve), MicroECC::curve_private_key_size($curve);

  my ($pubkey, $privkey) = MicroECC::make_key($curve);
  if(!MicroECC::valid_public_key($pubkey, $curve)){
	  print "Invalid public key.\n";
  }

 view all matches for this distribution


Mobile-Executive

 view release on metacpan or  search on metacpan

Executive.pm  view on Meta::CPAN


our @EXPORT       = qw( 
                         relocate
                         $absolute_fn
                         $public_key
                         $private_key
                      );

our @EXPORT_OK    = qw(
                      );
                      

Executive.pm  view on Meta::CPAN


    our $absolute_fn = File::Spec->rel2abs( File::Spec->curdir ) . '/' . $0;

    my $rsa = new Crypt::RSA;

    our ( $public_key, $private_key ) = 
            $rsa->keygen(
                Identity  => KEY_ID . "$$" . "$0",
                Size      => KEY_SIZE,
                Password  => KEY_PASS . "$0" . "$$",
                Verbosity => FALSE

Executive.pm  view on Meta::CPAN


and it takes two parameters: a IP address (or name) of the remote Location, and the protocol port number that the Location is listening on.

=head1 Internal methods/subroutines

A Perl B<BEGIN> block determines the absolute path to the mobile agents source code file, and puts it into the B<$absolute_fn> scalar (which is automatically exported).  This block also generates a PK+/PK- pairing (in B<$public_key> and B<$private_ke...

=head1 RULES FOR WRITING MOBILE AGENTS

There used to be loads, but now there is only one.  Read the B<Scooby Guide>, available on-line at: B<http://glasnost.itcarlow.ie/~scooby/guide.html>.

 view all matches for this distribution


Mojar-Google-Analytics

 view release on metacpan or  search on metacpan

lib/Mojar/Auth/Jwt.pm  view on Meta::CPAN

has iat => sub { time };
has duration => 60*60;  # 1 hour
has exp => sub { time + $_[0]->duration };

# JWT Signature
has 'private_key';

# Mogrified chunks

sub header {
  my $self = shift;

lib/Mojar/Auth/Jwt.pm  view on Meta::CPAN

  return $self;
}

has cipher => sub {
  my $self = shift;
  foreach ('private_key') {
    croak qq{Missing required field ($_)} unless defined $self->$_;
  }

  my $cipher = Crypt::OpenSSL::RSA->new_private_key($self->private_key);
  $cipher->use_pkcs1_padding;
  $cipher->use_sha256_hash;  # Requires openssl v0.9.8+
  return $cipher;
};

lib/Mojar/Auth/Jwt.pm  view on Meta::CPAN

=head1 SYNOPSIS

  use Mojar::Auth::Jwt;
  $jwt = Mojar::Auth::Jwt->new(
    iss => $auth_user,
    private_key => $private_key
  );
  $tx = $ua->post_form($jwt->aud, 'UTF-8', {
    grant_type => $grant_type,
    assertion => $jwt->encode
  });

lib/Mojar/Auth/Jwt.pm  view on Meta::CPAN


=item exp

Expiry time (epoch seconds).  Defaults to now + duration.

=item private_key

Private key.

=item header

lib/Mojar/Auth/Jwt.pm  view on Meta::CPAN

Signed encapsulation of header + body

=item cipher

Cipher object, built from Crypt::OpenSSL::RSA.  Before accessing, ensure
C<private_key> has been set.

=back

=head1 METHODS

=over 4

=item new

Constructor; typically only C<iss> and C<private_key> are needed.

=item reset

Clear out stale fields.

 view all matches for this distribution


Mojo-ACME

 view release on metacpan or  search on metacpan

lib/Mojo/ACME/Key.pm  view on Meta::CPAN

use Crypt::OpenSSL::Bignum; # get_key_parameters
use Digest::SHA 'sha256';
use MIME::Base64 'encode_base64url';

has 'generated';
has string => sub { shift->key->get_private_key_string };
has key => sub {
  my $self = shift;
  my $path = $self->path;
  my $rsa;
  if ($path && -e $path) {
    my $string = Mojo::File->new($path)->slurp;
    $rsa = Crypt::OpenSSL::RSA->new_private_key($string);
    $self->generated(0);
  } else {
    $rsa = Crypt::OpenSSL::RSA->generate_key(4096);
    $self->generated(1);
  }

lib/Mojo/ACME/Key.pm  view on Meta::CPAN

  return encode_base64url( sha256($json) );
};

# TODO remove this once https://rt.cpan.org/Ticket/Display.html?id=111829&results=dcfe848f59fceab0efed819d62b70447
# is resolved and dependency on PKCS10 is bumped
sub key_clone { Crypt::OpenSSL::RSA->new_private_key(shift->string) }

sub sign {
  my ($self, $content) = @_;
  my $key = $self->key;
  $key->use_sha256_hash;

 view all matches for this distribution


( run in 0.921 second using v1.01-cache-2.11-cpan-2b1a40005be )