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/Hypersonic/TLS.pm view on Meta::CPAN
->line(' g_ssl_ctx = NULL;')
->line(' return -3;')
->line(' }')
->line('')
->line(' /* Verify private key matches certificate */')
->line(' if (!SSL_CTX_check_private_key(g_ssl_ctx)) {')
->line(' SSL_CTX_free(g_ssl_ctx);')
->line(' g_ssl_ctx = NULL;')
->line(' return -4;')
->line(' }')
->line('')
lib/Hypersonic/TLS.pm view on Meta::CPAN
g_ssl_ctx = NULL;
return -3;
}
/* Verify private key matches certificate */
if (!SSL_CTX_check_private_key(g_ssl_ctx)) {
SSL_CTX_free(g_ssl_ctx);
g_ssl_ctx = NULL;
return -4;
}
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
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
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
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
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
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
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
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
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
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
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
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'
},
'oidcOPMetaDataOptionsTokenEndpointAuthSigAlg' => {
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
view release on metacpan or search on metacpan
lib/Lemonldap/NG/Portal/Issuer/JitsiMeetTokens.pm view on Meta::CPAN
if ( !$key_id ) {
$self->logger->error("jitsiSigningKey is not set");
return PE_ERROR;
}
my $pkey = $self->get_private_key($key_id);
if ( !$pkey ) {
$self->logger->error("Jitsi signing key $key_id was not found");
return PE_ERROR;
}
view all matches for this distribution
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
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
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
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
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