Result:
found 274 distributions and 1006 files matching your query ! ( run in 1.502 )


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


Mojo-GoogleAnalytics

 view release on metacpan or  search on metacpan

lib/Mojo/GoogleAnalytics.pm  view on Meta::CPAN

);

has authorization => sub { +{} };
has client_email  => sub { Carp::confess('client_email is required') };
has client_id     => sub { Carp::confess('client_id is required') };
has private_key   => sub { Carp::confess('private_key is required') };
has ua            => sub { Mojo::UserAgent->new(max_redirects => 3) };
has view_id => '';

sub authorize {
  my ($self, $cb) = @_;

lib/Mojo/GoogleAnalytics.pm  view on Meta::CPAN


  warn "[GoogleAnalytics] Authorization exp: @{[$prev->{exp} ? $prev->{exp} : -1]} < $time\n" if DEBUG;
  return if $prev->{exp} and $time < $prev->{exp};

  $ua_args[0] = Mojo::URL->new($self->{token_uri});
  $jwt = Mojo::JWT->new->algorithm('RS256')->secret($self->private_key);

  $jwt->claims({
    aud   => $ua_args[0]->to_string,
    exp   => $time + 3600,
    iat   => $time,

lib/Mojo/GoogleAnalytics.pm  view on Meta::CPAN


  $str = $self->client_id;

Example: "103742165385019792511".

=head2 private_key

  $str = $self->private_key;

Holds the content of a pem file that looks like this:

  -----BEGIN PRIVATE KEY-----
  ...

lib/Mojo/GoogleAnalytics.pm  view on Meta::CPAN

L<https://console.developers.google.com/apis/credentials>. Example file:

  {
    "type": "service_account",
    "project_id": "cool-project-238176",
    "private_key_id": "01234abc6780dc2a3284851423099daaad8cff92",
    "private_key": "-----BEGIN PRIVATE KEY-----...\n-----END PRIVATE KEY-----\n",
    "client_email": "some-name@cool-project-238176.iam.gserviceaccount.com",
    "client_id": "103742165385019792511",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://accounts.google.com/o/oauth2/token",
  }

 view all matches for this distribution


Mojo-JWT-Google

 view release on metacpan or  search on metacpan

lib/Mojo/JWT/Google.pm  view on Meta::CPAN

sub from_json {
  my ($self, $value) = @_;
  croak 'You did not pass a filename to from_json' if not defined $value;
  croak 'Cannot find file passed to from_json' if not -f $value;
  my $json = decode_json( path($value)->slurp );
  croak 'private key was not found in file passed to from_json' unless $json->{private_key};
  croak 'from_json only works with service accounts' if $json->{type} ne 'service_account';
  $self->algorithm('RS256');
  $self->secret($json->{private_key});
  $self->client_email($json->{client_email});
  return 1
}

sub as_form_data {

 view all matches for this distribution


Mojo-JWT

 view release on metacpan or  search on metacpan

lib/Mojo/JWT.pm  view on Meta::CPAN

sub _inflate_rsa_key {
  my ($key) = @_;
  require Crypt::PK::RSA;
  return $key if $key->$isa('Crypt::PK::RSA');
  if ($key->$isa('Crypt::OpenSSL::RSA')) {
    $key = $key->is_private ? $key->get_private_key_string : $key->get_public_key_string;
  }
  return Crypt::PK::RSA->new(\$key);
}

1;

 view all matches for this distribution


( run in 1.502 second using v1.01-cache-2.11-cpan-a5abf4f5562 )