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
view release on metacpan or search on metacpan
lib/Net/Google/AuthSub/Once.pm view on Meta::CPAN
use MIME::Base64;
sub new {
my ($klass, $options) = @_;
my $self = bless {}, $klass;
$self->{private_key_filename} = $options->{private_key_filename};
return $self;
}
sub get_authorization_url {
my ($self, $next_url) = @_;
lib/Net/Google/AuthSub/Once.pm view on Meta::CPAN
my $nonce = makerandom(Size => 64);
my $timestamp = time;
my $data = "GET $url $timestamp $nonce";
my $private_key = Crypt::OpenSSL::RSA->new_private_key(scalar read_file($self->{'private_key_filename'}));
my $sig = encode_base64($private_key->sign($data));
my $auth = qq{AuthSub token="$token" sigalg="rsa-sha1" data="$data" sig="$sig"};
$request->header('Authorization', $auth);
return;
lib/Net/Google/AuthSub/Once.pm view on Meta::CPAN
redirect_to($auth->get_authorization_url('http://example.com/your-next-url'));
# Then after the response comes back
# Make a request to the Google service
my $auth = Net::Google::AuthSub::Once->new({ private_key_filename => 'filename' });
my $request = HTTP::Request->new(GET => 'http://www.google.com/...');
$auth->sign_request($request);
my $resp = $ua->request($request);
=head1 DESCRIPTION
lib/Net/Google/AuthSub/Once.pm view on Meta::CPAN
=head2 CLASS->new($options)
=over 4
=item * private_key_filename
The filename of a private key file.
=back
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/IPMessenger/Encrypt.pm view on Meta::CPAN
use strict;
use Net::IPMessenger::EncryptOption;
use base qw( Class::Accessor::Fast );
__PACKAGE__->mk_accessors(
qw( exponent modulus private_key
support_encryption attach )
);
my $RSA_KEY_SIZE = 1024;
my $IV = "\0\0\0\0\0\0\0\0";
lib/Net/IPMessenger/Encrypt.pm view on Meta::CPAN
}
sub generate_keys {
my $self = shift;
if ( $self->private_key ) {
return ( $self->exponent, $self->modulus );
}
my $rsa_key_size;
my $option = $self->support_encryption;
lib/Net/IPMessenger/Encrypt.pm view on Meta::CPAN
}
my $rsa = Crypt::OpenSSL::RSA->generate_key($rsa_key_size);
my( $modulus, $exponent ) = $rsa->get_key_parameters;
$self->private_key( $rsa->get_private_key_string );
return (
$self->exponent( $exponent->to_hex ),
$self->modulus( $modulus->to_hex )
);
}
lib/Net/IPMessenger/Encrypt.pm view on Meta::CPAN
unpack( "H*", $cipher_text );
}
sub decrypt_message {
my( $self, $message ) = @_;
return $message unless defined $self->private_key;
my( $enc_opt, $cipher_key, $cipher_text ) = split /\:/, $message, 3;
my $rsa = Crypt::OpenSSL::RSA->new_private_key( $self->private_key );
$rsa->use_pkcs1_padding;
my $shared_key = $rsa->decrypt( pack( "H*", $cipher_key ) );
my $blowfish = Crypt::CBC->new(
-literal_key => 1,
-key => $shared_key,
view all matches for this distribution
view release on metacpan or search on metacpan
src/ldns/host2str.c view on Meta::CPAN
status=ldns_algorithm2buffer_str(output, (ldns_algorithm)ldns_key_algorithm(k));
#ifndef S_SPLINT_S
ldns_buffer_printf(output, ")\n");
if(k->_key.key) {
EC_KEY* ec = EVP_PKEY_get1_EC_KEY(k->_key.key);
const BIGNUM* b = EC_KEY_get0_private_key(ec);
ldns_buffer_printf(output, "PrivateKey: ");
i = (uint16_t)BN_bn2bin(b, bignum);
if (i > LDNS_MAX_KEYLEN) {
goto error;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/Mollom.pm view on Meta::CPAN
{isa => 'Net::Mollom::Exception', fields => [qw(mollom_code mollom_desc)]},
);
has current_server => (is => 'rw', isa => 'Num', default => 0);
has public_key => (is => 'rw', isa => 'Str', required => 1);
has private_key => (is => 'rw', isa => 'Str', required => 1);
has session_id => (is => 'rw', isa => 'Str');
has xml_rpc => (is => 'rw', isa => 'XML::RPC');
has warnings => (is => 'rw', isa => 'Bool', default => 1);
has attempt_limit => (is => 'rw', isa => 'Num', default => 1);
has attempts => (is => 'rw', isa => 'Num', default => 0);
lib/Net/Mollom.pm view on Meta::CPAN
XML-RPC to determine whether user input is Spam, Ham, flame or
obscene.
my $mollom = Net::Mollom->new(
public_key => 'a2476604ffba00c907478c8f40b83b03',
private_key => '42d5448f124966e27db079c8fa92de0f',
);
my @server_list = $mollom->server_list();
my $check = $mollom->check_content(
lib/Net/Mollom.pm view on Meta::CPAN
=item * public_key (required)
This is your Mollom API public key.
=item * private_key (required)
This is your Mollom API private key.
=item * attempt_limit
lib/Net/Mollom.pm view on Meta::CPAN
return $self->_make_api_call('getStatistics', \%args);
}
sub _make_api_call {
my ($self, $function, $args) = @_;
my $secret = $self->private_key;
my @servers = @{$self->servers};
# keep track of how many times we've descended down into this rabbit hole
if( ! $self->{_recurse_level} ) {
$self->{_recurse_level} = 1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/OAuth.pm view on Meta::CPAN
Consumer:
use Crypt::OpenSSL::RSA;
use File::Slurp;
$keystring = read_file('private_key.pem');
$private_key = Crypt::OpenSSL::RSA->new_private_key($keystring);
$request = Net::OAuth->request('request token')->new(%params);
$request->sign($private_key);
Service Provider:
use Crypt::OpenSSL::RSA;
use File::Slurp;
view all matches for this distribution