view release on metacpan or search on metacpan
examples/gce_sa_explicit.pl view on Meta::CPAN
#the repositories, but you can see the tags of a repo if you know its name
my $repo = $ARGV[0];
my $sa = Docker::Registry::Auth::GCEServiceAccount->new(
client_email => $ce,
private_key => $pk,
);
my $r = Docker::Registry::GCE->new(
auth => $sa,
);
view all matches for this distribution
view release on metacpan or search on metacpan
_Deparsed_XSubs.pm view on Meta::CPAN
sub COMP_add_compression_method($$) ;
sub CTX_add_client_CA($$) ;
sub CTX_add_extra_chain_cert($$) ;
sub CTX_add_session($$) ;
sub CTX_callback_ctrl($$$) ;
sub CTX_check_private_key($) ;
sub CTX_ctrl($$$$) ;
sub CTX_flush_sessions($$) ;
sub CTX_free($) ;
sub CTX_get0_param($) ;
sub CTX_get_app_data($) ;
_Deparsed_XSubs.pm view on Meta::CPAN
sub alert_desc_string($) ;
sub alert_desc_string_long($) ;
sub alert_type_string($) ;
sub alert_type_string_long($) ;
sub callback_ctrl($$$) ;
sub check_private_key($) ;
sub clear($) ;
sub clear_num_renegotiations($) ;
sub client_version($) ;
sub connect($) ;
sub constant($) ;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EAI/Wrap.pm view on Meta::CPAN
# site.config
%config = (
sensitive => {
dbSys => {user => "DBuser", pwd => "DBPwd"},
ftpSystem1 => {user => "FTPuser", pwd => "FTPPwd", privKey => 'path_to_private_key', hostkey =>'hostkey'},
},
checkLookup => {"task_script.pl" => {errmailaddress => "test\@test.com", errmailsubject => "testjob failed", timeToCheck => "0800", freqToCheck => "B", logFileToCheck => "test.log", logcheck => "started.*"}},
executeOnInit => sub {$execute{addToScriptName} = "doWhateverHereToModifySettings";},
folderEnvironmentMapping => {Test => "Test", Dev => "Dev", "" => "Prod"},
errmailaddress => 'your@mail.address',
lib/EAI/Wrap.pm view on Meta::CPAN
FTP => {
remoteHost => {"Prod" => "ftp.com", "Test" => "ftp-test.com"},
remoteDir => "/reports",
port => 22,
user => "myuser",
privKey => 'C:/keystore/my_private_key.ppk',
FTPdebugLevel => 0, # ~(1|2|4|8|16|1024|2048)
},
DB => {
tablename => "ValueTable",
deleteBeforeInsertSelector => "rptDate = ?",
view all matches for this distribution
view release on metacpan or search on metacpan
deps/hiredis/hiredis_ssl.h view on Meta::CPAN
/* Options to create an OpenSSL context. */
typedef struct {
const char *cacert_filename;
const char *capath;
const char *cert_filename;
const char *private_key_filename;
const char *server_name;
int verify_mode;
} redisSSLOptions;
/**
deps/hiredis/hiredis_ssl.h view on Meta::CPAN
* and use for validation.
*
* capath is an optional directory path where trusted CA certificate files are
* stored in an OpenSSL-compatible structure.
*
* cert_filename and private_key_filename are optional names of a client side
* certificate and private key files to use for authentication. They need to
* be both specified or omitted.
*
* server_name is an optional and will be used as a server name indication
* (SNI) TLS extension.
deps/hiredis/hiredis_ssl.h view on Meta::CPAN
* If error is non-null, it will be populated in case the context creation fails
* (returning a NULL).
*/
redisSSLContext *redisCreateSSLContext(const char *cacert_filename, const char *capath,
const char *cert_filename, const char *private_key_filename,
const char *server_name, redisSSLContextError *error);
/**
* Helper function to initialize an OpenSSL context that can be used
* to initiate SSL connections. This is a more extensible version of redisCreateSSLContext().
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Experian/IDAuth.pm view on Meta::CPAN
sub defaults {
my $self = shift;
return (
username => 'experian_user',
password => '?',
private_key => 'private_key',
public_key => 'public_key',
members_url => 'https://proveid.experian.com',
api_uri => 'http://corpwsdl.oneninetwo',
api_proxy => 'https://xml.proveid.experian.com/IDSearch.cfc',
header_ns_url => 'http://xml.proveid.experian.com/xsd/Headers',
lib/Experian/IDAuth.pm view on Meta::CPAN
sub _2fa_header {
my $self = shift;
my $loginid = $self->{username};
my $password = $self->{password};
my $private_key = $self->{private_key};
my $public_key = $self->{public_key};
my $timestamp = time();
my $hash = hmac_sha256_base64($loginid, $password, $timestamp, $private_key);
# Digest::SHA doesn't pad it's outputs so we have to do it manually.
while (length($hash) % 4) {
$hash .= '=';
}
view all matches for this distribution
view release on metacpan or search on metacpan
Ezmlm/GpgKeyRing.pm view on Meta::CPAN
Refer to the documentation of gnupg for the format of the arguments.
=cut
sub generate_private_key {
my ($self, $name, $comment, $email, $keysize, $expire) = @_;
my $gpg = $self->_get_gpg_object();
my $gpgoption = "--gen-key";
my $gpgcommand = $gpg->gpgbin() . " " . $gpg->gpgopts() . " $gpgoption";
my $pid = open(INPUT, "| $gpgcommand");
Ezmlm/GpgKeyRing.pm view on Meta::CPAN
my @keys = $self->_get_keys("pub");
return @keys;
}
# == get_private_keys ==
# see above for POD (get_public_keys)
sub get_secret_keys {
my ($self) = @_;
my @keys = $self->_get_keys("sec");
return @keys;
view all matches for this distribution
view release on metacpan or search on metacpan
deps/libfido2/src/es256.c view on Meta::CPAN
fido_log_debug("%s: EVP_PKEY_keygen", __func__);
goto fail;
}
if ((ec = EVP_PKEY_get0_EC_KEY(k)) == NULL ||
(d = EC_KEY_get0_private_key(ec)) == NULL ||
(n = BN_num_bytes(d)) < 0 || (size_t)n > sizeof(key->d) ||
(n = BN_bn2bin(d, key->d)) < 0 || (size_t)n > sizeof(key->d)) {
fido_log_debug("%s: EC_KEY_get0_private_key", __func__);
goto fail;
}
ok = 0;
fail:
deps/libfido2/src/es256.c view on Meta::CPAN
fido_log_debug("%s: BN_bin2bn", __func__);
goto fail;
}
if ((ec = EC_KEY_new_by_curve_name(nid)) == NULL ||
EC_KEY_set_private_key(ec, d) == 0) {
fido_log_debug("%s: EC_KEY_set_private_key", __func__);
goto fail;
}
if ((pkey = EVP_PKEY_new()) == NULL ||
EVP_PKEY_assign_EC_KEY(pkey, ec) == 0) {
view all matches for this distribution
view release on metacpan or search on metacpan
libtomcrypt/src/headers/tomcrypt_pk.h view on Meta::CPAN
int dh_set_pg_groupsize(int groupsize, dh_key *key);
int dh_set_key(const unsigned char *in, unsigned long inlen, int type, dh_key *key);
int dh_generate_key(prng_state *prng, int wprng, dh_key *key);
int dh_shared_secret(const dh_key *private_key, const dh_key *public_key,
unsigned char *out, unsigned long *outlen);
void dh_free(dh_key *key);
int dh_export_key(void *out, unsigned long *outlen, int type, const dh_key *key);
libtomcrypt/src/headers/tomcrypt_pk.h view on Meta::CPAN
int ecc_export_openssl(unsigned char *out, unsigned long *outlen, int type, const ecc_key *key);
int ecc_import_openssl(const unsigned char *in, unsigned long inlen, ecc_key *key);
int ecc_import_pkcs8(const unsigned char *in, unsigned long inlen, const void *pwd, unsigned long pwdlen, ecc_key *key);
int ecc_import_x509(const unsigned char *in, unsigned long inlen, ecc_key *key);
int ecc_shared_secret(const ecc_key *private_key, const ecc_key *public_key,
unsigned char *out, unsigned long *outlen);
int ecc_encrypt_key(const unsigned char *in, unsigned long inlen,
unsigned char *out, unsigned long *outlen,
prng_state *prng, int wprng, int hash,
libtomcrypt/src/headers/tomcrypt_pk.h view on Meta::CPAN
const void *pwd, unsigned long pwdlen,
curve25519_key *key);
int ed25519_sign(const unsigned char *msg, unsigned long msglen,
unsigned char *sig, unsigned long *siglen,
const curve25519_key *private_key);
int ed25519_verify(const unsigned char *msg, unsigned long msglen,
const unsigned char *sig, unsigned long siglen,
int *stat, const curve25519_key *public_key);
libtomcrypt/src/headers/tomcrypt_pk.h view on Meta::CPAN
int x25519_import_x509(const unsigned char *in, unsigned long inlen, curve25519_key *key);
int x25519_import_pkcs8(const unsigned char *in, unsigned long inlen,
const void *pwd, unsigned long pwdlen,
curve25519_key *key);
int x25519_shared_secret(const curve25519_key *private_key,
const curve25519_key *public_key,
unsigned char *out, unsigned long *outlen);
#endif /* LTC_CURVE25519 */
libtomcrypt/src/headers/tomcrypt_pk.h view on Meta::CPAN
const dsa_key *key);
int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key);
int dsa_export(unsigned char *out, unsigned long *outlen, int type, const dsa_key *key);
int dsa_verify_key(const dsa_key *key, int *stat);
int dsa_shared_secret(void *private_key, void *base,
const dsa_key *public_key,
unsigned char *out, unsigned long *outlen);
#endif /* LTC_MDSA */
#ifdef LTC_DER
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/Libdogecoin/FFI.pm view on Meta::CPAN
is two strings in base-58 encoding. Do not share the private key. Do not lose
the private key.
The public key is a valid P2PKH address.
=head3 C<verify_key_pair( $private_key, $public_key, $is_testnet )>
The boolean C<$is_testnet> argument is optional; the default value is false.
Given two strings in base-58 encoding, returns a boolean value to indicate
whether the pair is valid for the given network.
lib/Finance/Libdogecoin/FFI.pm view on Meta::CPAN
Generates and returns a private/public key hierarchical deterministic pair for
the network. The return value is two strings in base-58 encoding. Do not share
the private key. Do not lose the private key.
=head3 C<generate_derived_hd_pub_key( $master_private_key )>
Given a master key hierarchical deterministic key, derive and return a public
key associated with the master.
=head3 C<verify_master_priv_pub_keypair( $master_private_key, $master_public_key, $is_testnet )>
The boolean C<$is_testnet> argument is optional; the default value is false.
Given two strings representing hierarchical deterministic keys (a master
public key and a master private key) in base-58 encoding, returns a boolean
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Firefox/Marionette.pm view on Meta::CPAN
}
if ( defined $parameters{user} ) {
$parameters{user} =
MIME::Base64::encode_base64url( $parameters{user} );
}
if ( !defined $parameters{private_key} ) {
$parameters{private_key} = {};
}
if ( ref $parameters{private_key} eq 'HASH' ) {
my $script = <<'_JS_';
let privateKeyArguments = {};
if (arguments[0]["name"]) {
privateKeyArguments["name"] = arguments[0]["name"];
} else {
lib/Firefox/Marionette.pm view on Meta::CPAN
return urlSafeKey;
})();
return privateKey;
_JS_
my $old = $self->_context('chrome');
$parameters{private_key} = $self->script(
$self->_compress_script($script),
args => [ $parameters{private_key} ]
);
$self->_context($old);
}
if ( !defined $parameters{sign_count} ) {
$parameters{sign_count} = 0;
lib/Firefox/Marionette.pm view on Meta::CPAN
my %credential_parameters = (
authenticatorId => $authenticator->id(),
credentialId => $parameters{id},
isResidentCredential => $parameters{is_resident},
rpId => $parameters{host},
privateKey => $parameters{private_key},
signCount => $parameters{sign_count},
userHandle => $parameters{user},
);
my $message_id = $self->_new_message_id();
$self->_send_request(
lib/Firefox/Marionette.pm view on Meta::CPAN
=item * id - contains the unique id for this credential, also known as the L<Credential ID|https://www.w3.org/TR/webauthn-2/#credential-id>. If this is not supplied, one will be generated.
=item * is_resident - contains a boolean that if set to true, a L<client-side discoverable credential|https://w3c.github.io/webauthn/#client-side-discoverable-credential> is created. If set to false, a L<server-side credential|https://w3c.github.io/w...
=item * private_key - either a L<RFC5958|https://www.rfc-editor.org/rfc/rfc5958> encoded private key encoded using L<encode_base64url|MIME::Base64::encode_base64url> or a hash containing the following keys;
=over 8
=item * name - contains the name of the private key algorithm, such as "RSA-PSS" (the default), "RSASSA-PKCS1-v1_5", "ECDSA" or "ECDH".
lib/Firefox/Marionette.pm view on Meta::CPAN
$firefox->add_webauthn_credential(
id => $credential->id(),
host => $credential->host(),
user => $credential->user(),
private_key => $credential->private_key(),
is_resident => $credential->is_resident(),
sign_count => $credential->sign_count(),
);
}
$firefox->go('about:blank');
view all matches for this distribution
view release on metacpan or search on metacpan
resources/ssl/cnf/ca.cnf view on Meta::CPAN
default_ca = default_ca
[ default_ca ]
dir = .
certificate = $dir/crt/ca.pem
private_key = $dir/key/ca.pem
certs = $dir/crt # Where the issued certs are kept
serial = $dir/serial # The current serial number
database = $dir/index.txt # database index file.
new_certs_dir = $dir/new # default place for new certs.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Google/Ads/Common/OAuth2ServiceAccountsHandler.pm view on Meta::CPAN
\"iat\":${iat}
}";
my $encoded_header = __encode_base64_url($header);
my $encoded_claims = __encode_base64_url($claims);
my $key = $self->get___crypt_module()->new_private_key($file) || return 0;
$key->use_pkcs1_padding();
$key->use_sha256_hash();
my $signature = $key->sign("${encoded_header}.${encoded_claims}");
my $encoded_signature = __encode_base64_url($signature);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Game/Tibia/Packet/Login.pm view on Meta::CPAN
sub import {
(undef, %params) = (shift, %params, @_);
die "Malformed Tibia version\n" if exists $params{tibia} && $params{tibia} !~ /^\d+$/;
}
my $otserv = Crypt::OpenSSL::RSA->new_private_key(
do { local $/; open my $rsa, '<', dist_file('Game-Tibia-Packet', 'otserv.private') or die "Couldn't open private key $!"; <$rsa>; }
);
=head1 METHODS AND ARGUMENTS
lib/Game/Tibia/Packet/Login.pm view on Meta::CPAN
$self->{versions}{client} = Game::Tibia::Packet::version($self->{version});
if ($self->{versions}{client}{rsa}) {
if (defined $self->{rsa} and !blessed $self->{rsa}) {
$self->{rsa} = Crypt::OpenSSL::RSA->new_private_key($self->{rsa});
}
$self->{rsa}->use_no_padding if defined $self->{rsa};
}
if (defined $self->{packet}) {
lib/Game/Tibia/Packet/Login.pm view on Meta::CPAN
$self->{rsa}->use_no_padding if defined $self->{rsa};
$self->{versions}{client} = Game::Tibia::Packet::version $self->{versions}{client} unless ref $self->{versions}{client};
my $payload = '';
if ($self->{versions}{client}{rsa}) {
$rsa = Crypt::OpenSSL::RSA->new_private_key($rsa) unless blessed $rsa;
$rsa->size == 128
or croak "Protocol $self->{versions}{client}{VERSION} expects 128 bit RSA key, but ${\($rsa->size*8)} bit were provided";
$payload .= "\0";
}
view all matches for this distribution
view release on metacpan or search on metacpan
scripts/find-secret-leakage-in-git-diff.pl view on Meta::CPAN
Sometimes you can't put the mark in the same line. Lines beginning private keys,
for example, do not have room for anything else. In these cases you can skip a
whole block marking its beginning and end like this:
## not a secret leak begin
my $rsa_private_key = <<EOS;
-----BEGIN RSA PRIVATE KEY-----
izfrNTmQLnfsLzi2Wb9xPz2Qj9fQYGgeug3N2MkDuVHwpPcgkhHkJgCQuuvT+qZI
MbS2U6wTS24SZk5RunJIUkitRKeWWMS28SLGfkDs1bBYlSPa5smAd3/q1OePi4ae
<...>
8S86b6zEmkser+SDYgGketS2DZ4hB+vh2ujSXmS8Gkwrn+BfHMzkbtio8lWbGw0l
view all matches for this distribution
view release on metacpan or search on metacpan
t/10-clone.t view on Meta::CPAN
my $ssh_dir = catfile($ENV{HOME}, '.ssh');
ok -e $ssh_dir;
my $public_key = catfile($ssh_dir, 'id_rsa.pub');
my $private_key = catfile($ssh_dir, 'id_rsa');
ok -f $public_key;
ok -f $private_key;
is $user, $ENV{USER};
is $url, $remote_url;
return Git::Raw::Cred -> sshkey(
$user,
$public_key,
$private_key
);
},
'certificate_check' => sub {
my ($cert, $valid) = @_;
$certificate_check_fired = 1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/GitHub/Apps/Auth.pm view on Meta::CPAN
our $VERSION = "0.04";
use Class::Accessor::Lite (
rw => [qw/token expires installation_id/],
ro => [qw/_furl private_key app_id/],
);
use Carp;
use Crypt::PK::RSA;
use Crypt::JWT qw/encode_jwt/;
lib/GitHub/Apps/Auth.pm view on Meta::CPAN
_lazy { "$self" . "$other" };
};
sub new {
my ($class, %args) = @_;
if (!exists $args{private_key} || !$args{private_key}) {
croak "private_key is required.";
}
if (!exists $args{app_id} || !$args{app_id}) {
croak "app_id is required.";
}
if (!$args{installation_id} && !$args{login}) {
croak "must be set installation_id or login.";
}
my $pk = Crypt::PK::RSA->new($args{private_key});
my $klass = {
private_key => $pk,
installation_id => $args{installation_id},
app_id => $args{app_id},
expires => 0,
_furl => Furl->new,
};
lib/GitHub/Apps/Auth.pm view on Meta::CPAN
iat => time(),
exp => time() + 60,
iss => $self->app_id,
},
alg => "RS256",
key => $self->private_key,
);
return $jwt;
}
lib/GitHub/Apps/Auth.pm view on Meta::CPAN
=head1 SYNOPSIS
use GitHub::Apps::Auth;
my $auth = GitHub::Apps::Auth->new(
private_key => "<filename>", # when read private key from file
private_key => \$pk, # when read private key from variable
app_id => <app_id>,
login => <organization or user>
);
# This method returns the cached token inside an object.
# However, refresh expired token automatically.
lib/GitHub/Apps/Auth.pm view on Meta::CPAN
=head1 CONSTRUCTOR
=head2 new
my $auth = GitHub::Apps::Auth->new(
private_key => "<filename>",
app_id => <app_id>,
installation_id => <installation_id>
);
Constructs an instance of C<GitHub::Apps::Auth> from credentials.
=head3 parameters
=head4 private_key
B<Required: true>
This parameter is a private key of the GitHub Apps.
view all matches for this distribution
view release on metacpan or search on metacpan
eg/service_accounts/reseller.pl view on Meta::CPAN
'https://www.googleapis.com/auth/apps.order'
);
my $auth_driver = Google::API::OAuth2::SignedJWT->new({
service_account_name => '<< service account email here >>',
private_key => "$FindBin::<<private key path here >>",
sub => '<< sub is optional, but can be here... >>',
scopes => join(" ", @scopes)
});
my $response = $service->customers->get((
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Google/Ads/Common/OAuth2ServiceAccountsHandler.pm view on Meta::CPAN
}";
my $encoded_header = __encode_base64_url($header);
my $encoded_claims = __encode_base64_url($claims);
my $key = $self->get___crypt_module()->new_private_key($file) || return 0;
$key->use_pkcs1_padding();
$key->use_sha256_hash();
my $signature = $key->sign("${encoded_header}.${encoded_claims}");
my $encoded_signature = __encode_base64_url($signature);
lib/Google/Ads/Common/OAuth2ServiceAccountsHandler.pm view on Meta::CPAN
}
# Return the private key string from either the PEM file or JSON file specified.
sub __read_certificate_file {
my $self = shift;
my $private_key;
if (!$self->get_pem_file() and !$self->get_json_file()) {
return 0;
}
lib/Google/Ads/Common/OAuth2ServiceAccountsHandler.pm view on Meta::CPAN
open(MYFILE, $self->get_json_file()) || return 0;
while (<MYFILE>) {
$file_str .= $_;
}
my $json_values = parse_json ($file_str);
$private_key = $json_values->{'private_key'};
$self->set_email_address($json_values->{'client_email'});
close(MYFILE);
}
# PEM File
else {
open(MYFILE, $self->get_pem_file()) || return 0;
while (<MYFILE>) {
$private_key .= $_;
}
close(MYFILE);
}
return $private_key;
}
sub __encode_base64_url($) {
my ($s) = shift;
$s = encode_base64($s);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Google/Ads/GoogleAds/OAuth2ServiceAccountsHandler.pm view on Meta::CPAN
aud => Google::Ads::GoogleAds::Constants::OAUTH2_BASE_URL . "/token",
exp => $time + 3600,
iat => $time,
sub => $self->get_impersonated_email()
},
$json_key->{private_key},
"RS256"
);
my $response = $self->get___lwp_agent()->post(
Google::Ads::GoogleAds::Constants::OAUTH2_BASE_URL . "/token",
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Google/BigQuery.pm view on Meta::CPAN
sub new {
my ($class, %args) = @_;
die "undefined client_eamil" if !defined $args{client_email};
die "undefined private_key_file" if !defined $args{private_key_file};
die "not found private_key_file" if !-f $args{private_key_file};
my $self = bless { %args }, $class;
$self->{GOOGLE_API_TOKEN_URI} = 'https://accounts.google.com/o/oauth2/token';
$self->{GOOGLE_API_GRANT_TYPE} = 'urn:ietf:params:oauth:grant-type:jwt-bearer';
if ($self->{private_key_file} =~ /\.json$/) {
open my $in, "<", $self->{private_key_file} or die "can't open $self->{private_key_file} : $!";
my $private_key_json = decode_json(join('', <$in>));
close $in;
$self->{private_key} = $private_key_json->{private_key};
} elsif ($self->{private_key_file} =~ /\.p12$/) {
my $password = "notasecret";
my $pkcs12 = Crypt::OpenSSL::PKCS12->new_from_file($self->{private_key_file});
$self->{private_key} = $pkcs12->private_key($password);
} else {
die "invalid private_key_file format";
}
$self->_auth;
$self->_set_rest_description;
lib/Google/BigQuery.pm view on Meta::CPAN
aud => $self->{GOOGLE_API_TOKEN_URI},
exp => $self->{exp},
iat => $self->{iat},
};
my $jwt = JSON::WebToken::encode_jwt($claim, $self->{private_key}, 'RS256', { type => 'JWT' });
my $response = $self->{ua}->post(
$self->{GOOGLE_API_TOKEN_URI},
{ grant_type => $self->{GOOGLE_API_GRANT_TYPE}, assertion => $jwt }
);
lib/Google/BigQuery.pm view on Meta::CPAN
=head1 SYNOPSIS
use Google::BigQuery;
my $client_email = <YOUR CLIENT EMAIL ADDRESS>;
my $private_key_file = <YOUR PRIVATE KEY FILE>;
my $project_id = <YOUR PROJECT ID>;
# create a instance
my $bq = Google::BigQuery::create(
client_email => $client_email,
private_key_file => $private_key_file,
project_id => $project_id,
);
# create a dataset
my $dataset_id = <YOUR DATASET ID>;
lib/Google/BigQuery.pm view on Meta::CPAN
Create a instance.
my $bq = Google::BigQuery::create(
client_email => $client_email, # required
private_key_file => $private_key_file, # required
project_id => $project_id, # optional
dataset_id => $dataset_id, # optional
scope => \@scope, # optional (default is 'https://www.googleapis.com/auth/bigquery')
version => $version, # optional (only 'v2')
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Google/ContentAPI.pm view on Meta::CPAN
scope => $gapiContentScope,
aud => $gapiTokenURI,
exp => $time + 3660, # max 60 minutes
iat => $time
},
key => \$self->{config}->{private_key},
alg => 'RS256'
);
# 2) Request an access token
#
lib/Google/ContentAPI.pm view on Meta::CPAN
{
"endpoint": "https://www.googleapis.com/content/v2.1",
"merchant_id": "123456789",
"type": "service_account",
"project_id": "content-api-194321",
"private_key_id": "11b8e20c2540c788e98b49e623ae8167dc3e4a6f",
"private_key": "-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----\n",
"client_email": "google@content-api.iam.gserviceaccount.com",
"client_id": "999999999",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Google/SAML/Response.pm view on Meta::CPAN
sub _load_rsa_key {
my $self = shift;
my $key_text = shift;
my $rsa_key = Crypt::OpenSSL::RSA->new_private_key( $key_text );
if ( $rsa_key ) {
$self->{ key_obj } = $rsa_key;
my $big_num = ( $rsa_key->get_key_parameters )[ 1 ];
view all matches for this distribution
view release on metacpan or search on metacpan
ext/channel_credentials.xs view on Meta::CPAN
if ( items % 2 ) {
croak("Expecting a hash as input to channel credentials constructor");
}
// @param string pem_root_certs PEM encoding of the server root certificates
// @param string pem_private_key PEM encoding of the client's private key
// (optional)
// @param string pem_cert_chain PEM encoding of the client's certificate chain
// (optional)
// @return ChannelCredentials The new SSL credentials object
const char* pem_root_certs = NULL;
grpc_ssl_pem_key_cert_pair pem_key_cert_pair;
pem_key_cert_pair.private_key = pem_key_cert_pair.cert_chain = NULL;
int i;
for (i = 0; i < items; i += 2 ) {
const char *key = SvPV_nolen(ST(i));
if (!strcmp( key, "pem_root_certs")) {
if (SvOK(ST(i+1)))
pem_root_certs = SvPV_nolen(ST(i+1));
} else if (!strcmp( key, "pem_private_key")) {
if (SvOK(ST(i+1)))
pem_key_cert_pair.private_key = SvPV_nolen(ST(i+1));
} else if (!strcmp( key, "pem_cert_chain")) {
if (SvOK(ST(i+1)))
pem_key_cert_pair.cert_chain = SvPV_nolen(ST(i+1));
}
}
ctx->wrapped = grpc_ssl_credentials_create(
pem_root_certs,
pem_key_cert_pair.private_key == NULL ? NULL : &pem_key_cert_pair, NULL
#ifdef GRPC_SSL_CREDENTIALS_HAS_4_ARGS
, NULL
#endif
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HEAT/Crypto.pm view on Meta::CPAN
use Carp;
use HEAT::Crypto::X25519;
use Crypt::Mode::CBC;
use Exporter qw(import);
our @EXPORT_OK = qw(hash heat_key get_private_key keygen priv_to_pub_key
shared_key sign verify encrypt decrypt account_id random_bytes tohex unhex);
our $VERSION = '0.04';
my $cbc = Crypt::Mode::CBC->new('AES');
lib/HEAT/Crypto.pm view on Meta::CPAN
} else {
croak('invalid key spec: %q', $spec);
}
}
sub get_private_key($)
{
my $spec = shift;
if ($spec =~ /^([a-z]{3,12}( |\Z)){12}$/) {
return HEAT::Crypto::X25519::keyhash($spec);
lib/HEAT/Crypto.pm view on Meta::CPAN
}
}
sub priv_to_pub_key($)
{
my $p = get_private_key($_[0]);
my $r = HEAT::Crypto::X25519::keygen($p);
return tohex($r->{p});
}
sub account_id($)
lib/HEAT/Crypto.pm view on Meta::CPAN
};
}
sub shared_key($$)
{
my $k = get_private_key($_[0]);
my $p = heat_key($_[1]);
return tohex(HEAT::Crypto::X25519::shared($k, $p));
}
sub sign($$)
{
my $k = get_private_key($_[0]);
my $msg = $_[1];
return tohex(HEAT::Crypto::X25519::sign($k, $msg));
}
sub verify($$$)
lib/HEAT/Crypto.pm view on Meta::CPAN
p => <public key bytes>,
k => <private key bytes>,
s => <signing key bytes>,
}
=item shared_key( $private_key, $public_key );
Compute shared secret.
Returns the key as a hexadecimal string.
=item sign( $private_key, $message );
Sign message with the private key.
Returns the signature as a hexadecimal string.
lib/HEAT/Crypto.pm view on Meta::CPAN
Decrypts data with the given key. Data is expected to be returned by encrypt();
It returns the decrypted data on success. This function might die in case of errors.
=item priv_to_pub_key( $private_key )
Derives the public key from the private key.
Returns the public key as a hexadecimal string.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HEAT/Crypto.pm view on Meta::CPAN
p => <public key bytes>,
k => <private key bytes>,
s => <signing key bytes>,
}
=item shared_key( $private_key, $public_key );
Computes shared secret.
Returns the key bytes.
=item sign( $private_key, $message );
Sign message with the private key.
Returns the signature bytes.
lib/HEAT/Crypto.pm view on Meta::CPAN
Decrypts data with the given key. Data is expected to be in the format returned
by encrypt();
It returns the decrypted data on success or undefined in case of failure.
=item priv_to_pub_key( $private_key )
Derives the public key from the private key.
=item account_id( $public_key )
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTML/FormFu/Constraint/reCAPTCHA.pm view on Meta::CPAN
= blessed($query)
&& $query->can('secure')
&& $query->can('address');
my $captcha = Captcha::reCAPTCHA->new;
my $privkey = $self->parent->private_key || $ENV{RECAPTCHA_PRIVATE_KEY};
my $remoteip
= $catalyst_compatible
? $query->address
: $ENV{REMOTE_ADDR};
view all matches for this distribution
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
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
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