Aut
view release on metacpan or search on metacpan
$self->{"ui"}->message(_T("Generating keys, this will take some time...")."($bits bits)");
my $rsa = new Crypt::RSA;
my ($public,$private) =$rsa->keygen(
Identity => 'Aut module',
Size => $bits,
Password => "",
Verbosity => 0
) or die $rsa->errstr();
my $private_str=private_key_to_string($private);
$private_str="private,".$private_str;
my $cipher=new Aut::Crypt($pass);
$private_str=$cipher->encrypt($private_str);
my $public_str=public_key_to_string($public);
$public_str=$self->{"base64"}->encode($public_str);
$private_str=$self->{"base64"}->encode($private_str);
}
sub string_to_public_key {
my $string=shift;
my $key=new Crypt::RSA::Key::Public;
my @pub;
push @pub,$string;
return $key->deserialize(String => \@pub);
}
sub private_key_to_string {
my $key=shift;
return $key->serialize();
}
sub string_to_private_key {
my $string=shift;
my $key=new Crypt::RSA::Key::Private;
my @pub;
push @pub,$string;
return $key->deserialize(String => \@pub);
}
### Using an undocumented feature here!
sub rsa_crypt {
my $self=shift;
}
my $cipher=new Aut::Crypt($pass);
$private_str=$cipher->decrypt($private_str);
if (substr($private_str,0,8) ne "private,") {
return undef;
}
else {
$private_str=substr($private_str,8,length($private_str));
my $private=string_to_private_key($private_str);
$text=$self->{"base64"}->decode($text);
$text=$rsa->decrypt(
Cyphertext => $text,
Key => $private,
);
if (not defined $text) {
warn "Unexpected! Cannot decrypt text with good private key!";
}
return $text;
Aut/Backend/Conf.pm view on Meta::CPAN
=over 1
This method instantiates a new Aut::Backend::Conf object with
given L<Conf::Frontend> object.
=back
=head2 Querying
=head3 C<get_keys() --E<gt> (list public_key:string private_key:string)>
=over 1
This function returns the currently stored RSA KeyPair in the backend,
or C<undef> if they do not exist.
=back
=head3 C<has_accounts() --E<gt> boolean>
( run in 0.245 second using v1.01-cache-2.11-cpan-4d50c553e7e )