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
view release on metacpan or search on metacpan
lib/Mail/Make/SMIME.pm view on Meta::CPAN
$self->_ensure_envelope_headers( $entity ) || return( $self->pass_error );
my $smime = $self->_make_crypt_smime || return( $self->pass_error );
$self->_load_private_key( $smime, $opts ) || return( $self->pass_error );
$self->_load_ca_cert( $smime, $opts ); # optional; ignore error
my $raw = $self->_serialise_for_smime( $entity ) || return( $self->pass_error );
lib/Mail/Make/SMIME.pm view on Meta::CPAN
$self->_ensure_envelope_headers( $entity ) || return( $self->pass_error );
my $smime = $self->_make_crypt_smime || return( $self->pass_error );
$self->_load_private_key( $smime, $opts ) || return( $self->pass_error );
$self->_load_ca_cert( $smime, $opts ); # optional
# Load recipient certificate(s)
my @certs = ref( $opts->{RecipientCert} ) eq 'ARRAY'
lib/Mail/Make/SMIME.pm view on Meta::CPAN
return( $self->error( "_load_ca_cert(): failed to load CA certificate: $@" ) ) if( $@ );
return(1);
}
# _load_private_key( $smime_obj, \%opts )
# Loads the private key and signing certificate into a Crypt::SMIME instance.
# Source priority: option Cert/Key > constructor cert/key.
# Handles key_password as string or CODE ref.
sub _load_private_key
{
my( $self, $smime, $opts_ref ) = @_;
my $cert_source = $opts_ref->{Cert} // $self->{cert};
my $key_source = $opts_ref->{Key} // $self->{key};
unless( defined( $cert_source ) && CORE::length( $cert_source ) )
{
return( $self->error( '_load_private_key(): no certificate provided. Set Cert option or cert() accessor.' ) );
}
unless( defined( $key_source ) && CORE::length( $key_source ) )
{
return( $self->error( '_load_private_key(): no private key provided. Set Key option or key() accessor.' ) );
}
my $cert_pem = $self->_read_pem( $cert_source ) || return( $self->pass_error );
my $key_pem = $self->_read_pem( $key_source ) || return( $self->pass_error );
lib/Mail/Make/SMIME.pm view on Meta::CPAN
{
if( ref( $password_src ) eq 'CODE' )
{
local $@;
$password = eval{ $password_src->() };
return( $self->error( "_load_private_key(): KeyPassword CODE ref died: $@" ) ) if( $@ );
}
else
{
$password = $password_src;
}
lib/Mail/Make/SMIME.pm view on Meta::CPAN
}
else
{
eval{ $smime->setPrivateKey( $key_pem, $cert_pem ) };
}
return( $self->error( "_load_private_key(): failed to load private key/certificate: $@" ) ) if( $@ );
return(1);
}
# _make_crypt_smime() â Crypt::SMIME instance
view all matches for this distribution
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
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
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
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
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
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
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
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
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