Net-SSH-Perl
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
of fingerprinting) and in pssh-keygen (-B option).
1.01 2001.05.02
- Added SSH2 support.
- Added Channel, ChannelMgr classes to manage open SSH2
channels.
- Added Key and subclasses Key::DSA, Key::RSA; managed
access to keys and keyfiles.
- Split Util functions into sub-modules that are loaded
on demand. Added more utility functions for SSH2 bigints,
etc. Deprecated _load_private_key, _save_private_key,
_load_public_key, in favor of usage of Net::SSH::Perl::Key
classes.
- Changed Constants implementation; don't use 'constant'
module, just keep constants in hash, then export them
in custom import method.
- Added eg/pssh-keygen, which has *almost* all of the
functionality in the OpenSSH ssh-keygen.
- Added Mac classes for MAC packet integrity.
- Added Cipher/RC4, an arcfour implementation (only for
SSH2).
lib/Net/SSH/Perl/Auth/Rhosts_RSA.pm view on Meta::CPAN
use strict;
use warnings;
use Net::SSH::Perl::Constants qw(
SSH_SMSG_FAILURE
SSH_SMSG_SUCCESS
SSH_CMSG_AUTH_RHOSTS_RSA
SSH_SMSG_AUTH_RSA_CHALLENGE
SSH_CMSG_AUTH_RSA_RESPONSE );
use Net::SSH::Perl::Util qw( :rsa _load_private_key );
use Net::SSH::Perl::Packet;
use Net::SSH::Perl::Auth;
use base qw( Net::SSH::Perl::Auth );
use Scalar::Util qw(weaken);
use File::Spec::Functions qw( catfile );
sub new {
my $class = shift;
my $ssh = shift;
lib/Net/SSH/Perl/Key/RSA1.pm view on Meta::CPAN
$key->{rsa}{q} = $gmp->($priv->q);
$key;
}
sub read_private {
my $class = shift;
my($keyfile, $passphrase) = @_;
my($key, $comment);
eval {
($key, $comment) = _load_private_key($keyfile, $passphrase);
};
if (wantarray) {
return $key && !$@ ? ($key, $comment) : ();
}
else {
return $key && !$@ ? $key : undef;
}
}
sub write_private {
my $key = shift;
my($keyfile, $passphrase, $comment) = @_;
_save_private_key($keyfile, $key, $passphrase, $comment);
}
sub extract_public {
my $class = shift;
$class->new(@_);
}
sub dump_public { $_[0]->as_blob }
sub equal {
lib/Net/SSH/Perl/Util.pm view on Meta::CPAN
use vars qw( %FUNC_TO_MOD %EXPORT_TAGS );
%FUNC_TO_MOD = (
_crc32 => 'SSH1Misc',
_compute_session_id => 'SSH1MP',
_mp_linearize => 'SSH1MP',
_check_host_in_hostfile => 'Hosts',
_all_keys_for_host => 'Hosts',
_add_host_to_hostfile => 'Hosts',
_remove_host_from_hostfile=> 'Hosts',
_load_private_key => 'Authfile',
_load_public_key => 'Authfile',
_save_private_key => 'Authfile',
_respond_to_rsa_challenge => 'RSA',
_rsa_public_encrypt => 'RSA',
_rsa_private_decrypt => 'RSA',
_prompt => 'Term',
_read_passphrase => 'Term',
_read_yes_or_no => 'Term',
_current_user_win32 => 'Win32',
_socketpair => 'Win32',
);
%EXPORT_TAGS = (
hosts => [ qw( _check_host_in_hostfile _all_keys_for_host
_add_host_to_hostfile _remove_host_from_hostfile ) ],
rsa => [ qw( _rsa_public_encrypt _rsa_private_decrypt
_respond_to_rsa_challenge ) ],
ssh1mp => [ qw( _compute_session_id _mp_linearize ) ],
authfile => [ qw( _load_public_key _load_private_key _save_private_key ) ],
win32 => [ qw( _current_user_win32 _socketpair ) ],
all => [ keys %FUNC_TO_MOD ],
);
sub import {
my $class = shift;
my $callpack = caller;
my @to_export;
my @args = @_;
lib/Net/SSH/Perl/Util/Authfile.pm view on Meta::CPAN
use warnings;
use Net::SSH::Perl::Buffer;
use Net::SSH::Perl::Constants qw( PRIVATE_KEY_ID_STRING );
use Net::SSH::Perl::Cipher;
use Net::SSH::Perl::Key;
use Carp qw( croak );
sub _load_public_key {
_load_private_key($_[0], '', 1);
}
sub _load_private_key {
my($key_file, $passphrase, $want_public) = @_;
$passphrase ||= '';
open my $fh, '<', $key_file or croak "Can't open $key_file: $!";
my $c = do { local $/; <$fh> };
close $fh or die "Can't close $key_file: $!";
($c) = $c =~ /(.*)/s; ## Untaint data. Anything is allowed.
my $buffer = Net::SSH::Perl::Buffer->new( MP => 'SSH1' );
$buffer->append($c);
src/ed25519/keypair.c view on Meta::CPAN
#include <string.h>
#include "ed25519.h"
#include "sha512.h"
#include "ge.h"
void ed25519_create_keypair(unsigned char *public_key, unsigned char *private_key, const unsigned char *seed) {
ge_p3 A;
sha512(seed, 32, private_key);
private_key[0] &= 248;
private_key[31] &= 63;
private_key[31] |= 64;
ge_scalarmult_base(&A, private_key);
ge_p3_tobytes(public_key, &A);
memmove(private_key, seed, 32);
memmove(private_key + 32, public_key, 32);
}
src/ed25519/sign.c view on Meta::CPAN
#include <string.h>
#include "ed25519.h"
#include "sha512.h"
#include "ge.h"
#include "sc.h"
void ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *private_key) {
sha512_context hash;
unsigned char hram[64];
unsigned char nonce[64];
unsigned char az[64];
ge_p3 R;
sha512(private_key, 32, az);
az[0] &= 248;
az[31] &= 63;
az[31] |= 64;
sha512_init(&hash);
sha512_update(&hash, az + 32, 32);
sha512_update(&hash, message, message_len);
sha512_final(&hash, nonce);
memmove(signature + 32, private_key + 32, 32);
sc_reduce(nonce);
ge_scalarmult_base(&R, nonce);
ge_p3_tobytes(signature, &R);
sha512_init(&hash);
sha512_update(&hash, signature, 64);
sha512_update(&hash, message, message_len);
sha512_final(&hash, hram);
use strict;
use Getopt::Long;
use Carp qw/croak/;
use Digest::MD5 qw/md5/;
use Net::SSH::Perl;
use Net::SSH::Perl::Packet;
use Net::SSH::Perl::Cipher;
use Net::SSH::Perl::Auth;
use Net::SSH::Perl::Util qw( :ssh1mp :rsa :hosts _load_private_key );
use Net::SSH::Perl::Constants qw( :msg :hosts PROTOCOL_MAJOR PROTOCOL_MINOR );
use IO::Socket;
use Math::GMP;
use vars qw( $VERSION );
$VERSION = "0.01";
use vars qw( $DEBUG );
GetOptions("port|p=i", \my $port, "debug|d", \$DEBUG,
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.864 second using v1.00-cache-2.02-grep-82fe00e-cpan-2cc899e4a130 )