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
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
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
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
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
view release on metacpan or search on metacpan
lib/Mojo/XMLSig.pm view on Meta::CPAN
use Mojo::XMLSig;
# sign
my $xml = ...;
my $key = Crypt::OpenSSL::RSA->new_private_key(...);
my $signed = Mojo::XMLSig::sign($xml, $key);
# verify using an embedded certificate
my $verified = Mojo::XMLSig::verify($signed);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/Captcha/reCAPTCHA.pm view on Meta::CPAN
my $conf = shift || {};
$app->log->debug("Usage of Mojolicious::Plugin::Captcha::reCAPTCHA is deprecated; you should consider switching to Mojolicious::Plugin::ReCAPTCHAv2");
die ref($self), ": need private and public key\n"
unless $conf->{private_key} and $conf->{public_key};
$app->attr(
'recaptcha_obj' => sub {
Captcha::reCAPTCHA->new;
},
);
$app->attr( recaptcha_private_key => sub { $conf->{private_key} } );
$app->attr( recaptcha_public_key => sub { $conf->{public_key} } );
$app->attr( recaptcha_use_ssl => sub { $conf->{use_ssl} } );
$app->attr( recaptcha_options => sub { $conf->{options} } );
$app->helper( recaptcha => sub { return shift->app->recaptcha_obj } );
lib/Mojolicious/Plugin/Captcha/reCAPTCHA.pm view on Meta::CPAN
);
$app->helper(
validate_recaptcha => sub {
my ( $self, $params ) = @_;
my $result = $self->recaptcha->check_answer( $self->app->recaptcha_private_key,
$self->tx->remote_address,
$params->{recaptcha_challenge_field},
$params->{recaptcha_response_field},
);
lib/Mojolicious/Plugin/Captcha/reCAPTCHA.pm view on Meta::CPAN
sub startup {
my $self = shift;
$self->plugin('Captcha::reCAPTCHA', {
private_key => 'the_public_key',
public_key => 'your_private_key',
use_ssl => 1,
options => { theme => 'white' },
});
}
C<private_key> and C<public_key> are mandatory, while C<use_ssl> and C<options> are optional.
Unless you have a specific reason to set a certain global value for C<use_ssl> you should
probably just let the plugin decide when to use HTTPS requests.
In your mojolicious controller you can control everything by yourself by directly
invoking the C<get_html()> method of the L<Captcha::reCAPTCHA> object:
lib/Mojolicious/Plugin/Captcha/reCAPTCHA.pm view on Meta::CPAN
);
Following the same pattern you can also directly invoke C<check_answer()>:
my $result = $self->recaptcha->check_answer(
$private_key,
$ip,
$value_of_challenge_field,
$value_of_response_field,
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/OAuth2/Mock.pm view on Meta::CPAN
};
require Mojo::JWT;
my $id_token = Mojo::JWT->new(
algorithm => 'RS256',
secret => $self->_rsa->get_private_key_string,
set_iat => 1,
claims => $claims,
header => {kid => 'TEST_SIGNING_KEY'}
);
lib/Mojolicious/Plugin/OAuth2/Mock.pm view on Meta::CPAN
"response_modes_supported":["query","fragment","form_post"],
"response_types_supported":["code","id_token","code id_token","id_token token"],
"scopes_supported":["openid","profile","email","offline_access"],
"subject_types_supported":["pairwise"],
"token_endpoint":"<%= $token_endpoint %>",
"token_endpoint_auth_methods_supported":["client_secret_post","private_key_jwt","client_secret_basic"]
}
@@ oauth2/mock/keys.json.ep
{
"keys":[{
"e":"<%= $e %>",
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/Recaptcha.pm view on Meta::CPAN
$conf->{'lang'} ||= 'en';
my $options = {
%$conf
};
delete $options->{'private_key'};
delete $options->{'public_key'};
delete $options->{'ssl'};
my $scheme = ($conf->{'ssl'}) ? 'https' : 'http';
lib/Mojolicious/Plugin/Recaptcha.pm view on Meta::CPAN
my ($self,$cb) = @_;
my @post_data = (
'http://www.google.com/recaptcha/api/verify',
form => {
privatekey => $conf->{'private_key'},
remoteip =>
$self->req->headers->header('X-Real-IP')
||
$self->tx->remote_address,
challenge => $self->req->param('recaptcha_challenge_field'),
lib/Mojolicious/Plugin/Recaptcha.pm view on Meta::CPAN
=head1 SYNOPSIS
# Mojolicious::Lite
plugin recaptcha => {
public_key => '...',
private_key => '...',
lang => 'ru'
};
# Mojolicious
$self->plugin(recaptcha => {
public_key => '...',
private_key => '...',
lang => 'ru',
ssl => 1, # uses https Google URLs
});
# template
view all matches for this distribution
view release on metacpan or search on metacpan
examples/app.pl view on Meta::CPAN
use Mojo::File qw(curfile path);
use Mojo::Promise;
use Mojo::SQLite;
use Mojo::JSON qw(decode_json encode_json);
my $pushkeyfile = curfile->sibling('webpush_private_key.pem')
->to_rel(path)->to_string;
if (! -f $pushkeyfile) {
die <<EOF;
No webpush private key file found in '$pushkeyfile'. Make one:
$0 webpush keygen >$pushkeyfile
examples/app.pl view on Meta::CPAN
save_endpoint => '/api/savesubs',
subs_session2user_p => \&subs_session2user_p,
subs_create_p => \&subs_create_p,
subs_read_p => \&subs_read_p,
subs_delete_p => \&subs_delete_p,
(-s $pushkeyfile ? (ecc_private_key => $pushkeyfile) : ()),
claim_sub => 'mailto:admin@example.com',
};
}
sub subs_session2user_p {
view all matches for this distribution
view release on metacpan or search on metacpan
$Rex::Logger::debug = 0;
$Rex::Logger::format = '%D - [%l] - {%h} - %s';
BEGIN {
user 'root';
private_key($ENV{PRIVATE_KEY} || die 'Missing PRIVATE_KEY');
public_key(
(
-r $ENV{PRIVATE_KEY} . '.pub'
? $ENV{PRIVATE_KEY} . '.pub'
: $ENV{PUBLIC_KEY}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mozilla/Persona/Server.pm view on Meta::CPAN
sub privatePEM()
{ my $self = shift;
my $pem = read_file $self->{MP_pem_fn};
my $key = Crypt::OpenSSL::RSA->new_private_key($pem);
$key->use_pkcs1_padding;
$key->use_sha256_hash;
$key;
}
view all matches for this distribution
view release on metacpan or search on metacpan
htdocs/src-min/mode-php.js view on Meta::CPAN
define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={s...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Neo4j/Bolt.xs view on Meta::CPAN
}
if (strlen(tls_ca_file)) {
ignore_unused_result(neo4j_config_set_TLS_ca_file(config, tls_ca_file));
}
if (strlen(tls_pk_file)) {
ignore_unused_result(neo4j_config_set_TLS_private_key(config, tls_pk_file));
}
if (strlen(tls_pk_pass)) {
ignore_unused_result(neo4j_config_set_TLS_private_key_password(config, tls_pk_pass));
}
if (LOG_LEVEL <= NEO4J_LOG_TRACE)
{
neo4j_config_set_logger_provider(config, neo4j_std_logger_provider(stderr, LOG_LEVEL, LOGGER_FLAGS));
}
view all matches for this distribution
view release on metacpan or search on metacpan
build/lib/src/client_config.c view on Meta::CPAN
{
goto failure;
}
#ifdef HAVE_TLS
if (strdup_null(&(dup->tls_private_key_file), config->tls_private_key_file))
{
goto failure;
}
if (strdup_null(&(dup->tls_ca_file), config->tls_ca_file))
{
build/lib/src/client_config.c view on Meta::CPAN
return;
}
ignore_unused_result(neo4j_config_set_username(config, NULL));
ignore_unused_result(neo4j_config_set_password(config, NULL));
#ifdef HAVE_TLS
ignore_unused_result(neo4j_config_set_TLS_private_key(config, NULL));
ignore_unused_result(neo4j_config_set_TLS_ca_file(config, NULL));
ignore_unused_result(neo4j_config_set_TLS_ca_dir(config, NULL));
#endif
ignore_unused_result(neo4j_config_set_known_hosts_file(config, NULL));
free(config);
build/lib/src/client_config.c view on Meta::CPAN
config->basic_auth_callback_userdata = userdata;
return 0;
}
int neo4j_config_set_TLS_private_key(neo4j_config_t *config, const char *path)
{
REQUIRE(config != NULL, -1);
#ifdef HAVE_TLS
return replace_strptr_dup(&(config->tls_private_key_file), path);
#else
errno = NEO4J_TLS_NOT_SUPPORTED;
return -1;
#endif
}
const char *neo4j_config_get_TLS_private_key(const neo4j_config_t *config)
{
REQUIRE(config != NULL, NULL);
#ifdef HAVE_TLS
return config->tls_private_key_file;
#else
return NULL;
#endif
}
int neo4j_config_set_TLS_private_key_password_callback(neo4j_config_t *config,
neo4j_password_callback_t callback, void *userdata)
{
REQUIRE(config != NULL, -1);
#ifdef HAVE_TLS
config->tls_pem_pw_callback = callback;
build/lib/src/client_config.c view on Meta::CPAN
return -1;
#endif
}
int neo4j_config_set_TLS_private_key_password(neo4j_config_t *config,
const char *password)
{
REQUIRE(config != NULL, -1);
return neo4j_config_set_TLS_private_key_password_callback(config,
default_password_callback, (void *)(intptr_t)password);
}
int neo4j_config_set_TLS_ca_file(neo4j_config_t *config, const char *path)
view all matches for this distribution
view release on metacpan or search on metacpan
my ( $name, $pass ) = @_;
return if !$self->{'c_get'}{$name};
$pass = '' if !$pass;
my $key = $self->{'CFG'}{'private_key'} . $pass;
require Crypt::CBC;
my $cipher = Crypt::CBC->new(
-key => $key,
-cipher => 'Blowfish'
);
my $self = shift;
my ( $name, $value, $expiration, $path, $domain, $pass ) = @_;
$pass = '' if !$pass;
my $expires = &utl::expires($expiration);
my $key = $self->{'CFG'}{'private_key'} . $pass;
require Crypt::CBC;
my $cipher = Crypt::CBC->new(
-key => $key,
-cipher => 'Blowfish'
sub get {
my $self = shift;
my ($pass) = @_ || '';
my $key = $self->{'CFG'}{'private_key'} . $pass;
$self->{'sess'} = $self->SUPER::get( $self->{'session_prefix'}, $key );
return if !$self->{'sess'};
my ( $session_name, $expire, $user, $refuse ) = split( /::/, $self->{'sess'} );
sub create {
my $self = shift;
my ( $user, $expiration, $pass ) = @_;
$pass = '' if !$pass;
my $key = $self->{'CFG'}{'private_key'} . $pass;
my $expire = time + utl::expires_time( $expiration );
my $refuse = $self->get_key( 10 + int rand 10 );
my $value = $self->{'session_prefix'} . '::' . $expire . '::' . $user . '::' . $refuse;
my $path = '/';
view all matches for this distribution
view release on metacpan or search on metacpan
examples/Net_ACME_Example.pm view on Meta::CPAN
#Safe as of 2016
my $key_size = 2_048;
my $reg_rsa = Crypt::OpenSSL::RSA->generate_key($KEY_SIZE);
my $reg_rsa_pem = $reg_rsa->get_private_key_string();
#Want a real cert? Then comment this out.
{
no warnings 'redefine';
*Net::ACME::LetsEncrypt::_HOST = \&Net::ACME::LetsEncrypt::STAGING_SERVER;
examples/Net_ACME_Example.pm view on Meta::CPAN
);
$req->add_ext_final();
$req->sign();
return ( $rsa->get_private_key_string(), $req->get_pem_req() );
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/ACME2/AccountKey.pm view on Meta::CPAN
else {
require Crypt::Format;
$pem = Crypt::Format::der2pem($pem_or_der, 'RSA PRIVATE KEY');
}
$obj = Crypt::OpenSSL::RSA->new_private_key($pem);
$obj->use_pkcs1_padding();
$obj->use_sha256_hash();
$engine = 'crypt_openssl_rsa';
}
view all matches for this distribution
view release on metacpan or search on metacpan
amqp_openssl.c view on Meta::CPAN
status = SSL_CTX_use_certificate_chain_file(self->ctx, cert);
if (1 != status) {
return AMQP_STATUS_SSL_ERROR;
}
pkey = ENGINE_load_private_key(openssl_engine, key, NULL, NULL);
if (pkey == NULL) {
return AMQP_STATUS_SSL_ERROR;
}
status = SSL_CTX_use_PrivateKey(self->ctx, pkey);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/API/REST/JWT.pm view on Meta::CPAN
# handle also: Crypt::OpenSSL::RSA, Crypt::X509, Crypt::OpenSSL::X509
my $str;
if( ref( $key ) eq 'Crypt::OpenSSL::RSA' )
{
# https://metacpan.org/pod/Crypt::OpenSSL::RSA
$str = $key->is_private ? $key->get_private_key_string : $key->get_public_key_string;
}
elsif( ref( $key ) =~ /^Crypt::(X509|OpenSSL::X509)$/ )
{
# https://metacpan.org/pod/Crypt::X509
# https://metacpan.org/pod/Crypt::OpenSSL::X509
lib/Net/API/REST/JWT.pm view on Meta::CPAN
#instance of Crypt::PK::RSA
my $data = decode_jwt(token=>$t, key=>Crypt::PK::RSA->new('keyfile.pem'));
my $data = decode_jwt(token=>$t, key=>Crypt::PK::RSA->new(\$pem_key_string));
#instance of Crypt::OpenSSL::RSA
my $data = decode_jwt(token=>$t, key=>Crypt::OpenSSL::RSA->new_private_key($pem_key_string));
#instance of Crypt::X509 (public key only)
my $data = decode_jwt(token=>$t, key=>Crypt::X509->new(cert=>$cert));
#instance of Crypt::OpenSSL::X509 (public key only)
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-create-certificates.t view on Meta::CPAN
Net::SSLeay::EVP_PKEY_assign_RSA($key,$rsa);
return $key;
}
sub create_private_key_file {
my ($cert_dir, $key, $name) = @_;
my $pem_privkey = Net::SSLeay::PEM_get_string_PrivateKey($key);
like($pem_privkey, qr/-----BEGIN (RSA )?PRIVATE KEY-----/, "$name PEM_get_string_PrivateKey+nopasswd");
t/01-create-certificates.t view on Meta::CPAN
sub create_key_cert_files {
my $cert_dir = shift;
my $bits = shift;
my $key = generate_key($bits);
create_private_key_file($cert_dir, $key, @_);
create_public_cert_file($cert_dir, $key, @_);
}
my $days_100 = 60*60*24*100;
view all matches for this distribution
view release on metacpan or search on metacpan
t/05-create-certificates.t view on Meta::CPAN
Net::SSLeay::EVP_PKEY_assign_RSA($key,$rsa);
return $key;
}
sub create_private_key_file {
my ($key, $name) = @_;
my $pem_privkey = Net::SSLeay::PEM_get_string_PrivateKey($key);
like($pem_privkey, qr/-----BEGIN (RSA )?PRIVATE KEY-----/, "$name PEM_get_string_PrivateKey+nopasswd");
t/05-create-certificates.t view on Meta::CPAN
}
sub create_key_cert_files {
my $bits = shift;
my $key = generate_key($bits);
create_private_key_file($key, @_);
create_public_cert_file($key, @_);
}
my $days_100 = 60*60*24*100;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/Amazon/Config.pm view on Meta::CPAN
default = johndoe
[johndoe]
access_key_id = XXXXXXXXXXXXXXXXXXXX
secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
certificate_file = my-cert.pem
private_key_file = my-key.pem
ec2_keypair_name = my-ec2-keypair
ec2_keypair_file = ec2-private-key.pem
aws_account_id = 0123-4567-8901
canonical_user_id = <64-character string>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/Braintree/Configuration.pm view on Meta::CPAN
use Moose;
has merchant_id => (is => 'rw');
has partner_id => (is => 'rw');
has public_key => (is => 'rw');
has private_key => (is => 'rw');
has gateway => (is => 'ro', lazy => 1, default => sub { Net::Braintree::Gateway->new({config => shift})});
has environment => (
is => 'rw',
trigger => sub {
lib/Net/Braintree/Configuration.pm view on Meta::CPAN
if ($new_value !~ /integration|development|sandbox|production|qa/) {
warn "Assigned invalid value to Net::Braintree::Configuration::environment";
}
if ($new_value eq "integration") {
$self->public_key("integration_public_key");
$self->private_key("integration_private_key");
$self->merchant_id("integration_merchant_id");
}
}
);
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/Net/DNS/SEC/Private.pm view on Meta::CPAN
The arguments define the private key parameters as (name,value) pairs.
The name and data representation are identical to that used in a BIND
private keyfile.
=head2 private_key_format
$format = $private->private_key_format;
Returns a string which identifies the format of the private key file.
=head2 algorithm, keytag, signame
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/Domain/SMD/Schema.pm view on Meta::CPAN
my @w_opts;
if($cert)
{ push @w_opts
, token => $cert
, private_key => undef #XXX Work in progress
, publish_token => 'X509DATA'
, sign_info =>
{ sign_method => DSIGM_RSA_SHA256
# , private_key => $tmv_key
}
}
my $sig = XML::Compile::WSS::Signature->new
( schema => $schemas
view all matches for this distribution
view release on metacpan or search on metacpan
dropbear/ecc.c view on Meta::CPAN
}
/* a modified version of libtomcrypt's "ecc_shared_secret" to output
a mp_int instead. */
mp_int * dropbear_ecc_shared_secret(ecc_key *public_key, const ecc_key *private_key)
{
ecc_point *result = NULL;
mp_int *prime = NULL, *shared_secret = NULL;
int err = DROPBEAR_FAILURE;
/* type valid? */
if (private_key->type != PK_PRIVATE) {
goto out;
}
if (private_key->dp != public_key->dp) {
goto out;
}
/* make new point */
result = ltc_ecc_new_point();
dropbear/ecc.c view on Meta::CPAN
}
prime = m_malloc(sizeof(*prime));
m_mp_init(prime);
if (mp_read_radix(prime, (char *)private_key->dp->prime, 16) != CRYPT_OK) {
goto out;
}
if (ltc_mp.ecc_ptmul(private_key->k, &public_key->pubkey, result, prime, 1) != CRYPT_OK) {
goto out;
}
shared_secret = m_malloc(sizeof(*shared_secret));
m_mp_init(shared_secret);
view all matches for this distribution
view release on metacpan or search on metacpan
my $self = shift;
return undef if defined $self->{uid};
# openssl genrsa -out id_rsa 2048
my $pk = Crypt::OpenSSL::RSA->new_private_key(<<'PVT');
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA2VUahnbWKIY4rn8jEthY9M2BoMIHoNQlY4YUL9pV+MpSKyy9
MjVKV6h8ERnj+1wxUJDR3ZJimYnvcruGqlSR+uhL8MJs7GqSSOL3zKbZiHmip1/j
/9Wzsu86VJibxd14/5r8OugIJDs+aeE6fxpKW1BtUiiUAvlbC4MwnAnCPemzl7gG
qi64xsSaVdoi0NzZpxI+ItP9x89eMw64F5GlIviGJ9hODyW3ckKSvgxEQGf7x9TN
view all matches for this distribution
view release on metacpan or search on metacpan
"BH7LXCov0w51-y9i~BoB3g",
]
A private key (for inserting) can be constructed like this:
SSK@<private_key>,<crypto_key>/<name>
It can be used to insert data. The corresponding public key looks like this:
SSK@<public_key>PAgM,<crypto_key>/<name>
my ($self) = @_;
$self->txn ("generate_svk_pair");
});
=item $txn = $fcp->txn_invert_private_key ($private)
=item $public = $fcp->invert_private_key ($private)
Inverts a private key (returns the public key). C<$private> can be either
an insert URI (must start with C<freenet:SSK@>) or a raw private key (i.e.
the private value you get back from C<generate_svk_pair>).
Returns the public key.
=cut
$txn->(invert_private_key => sub {
my ($self, $privkey) = @_;
$self->txn (invert_private_key => private => $privkey);
});
=item $txn = $fcp->txn_get_size ($uri)
=item $length = $fcp->get_size ($uri)
key and the resulting public URI.
C<$meta> can be a hash reference (same format as returned by
C<Net::FCP::parse_metadata>) or a string.
The result is an arrayref with the keys C<uri>, C<public_key> and C<private_key>.
=cut
$txn->(client_put => sub {
my ($self, $uri, $metadata, $data, $htl, $removelocal) = @_;
use base Net::FCP::Txn;
sub rcv_success {
my ($self, $attr) = @_;
$self->set_result ([$attr->{public_key}, $attr->{private_key}, $attr->{crypto_key}]);
}
package Net::FCP::Txn::InvertPrivateKey;
use base Net::FCP::Txn;
view all matches for this distribution