mirror of
https://codeberg.org/scip/Crypt--PWSafe3.git
synced 2025-12-16 20:21:01 +01:00
made Bytes::Random::Secure optional, version++
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
1.06
|
||||
applied patch by https://github.com/Mekk:
|
||||
https://github.com/TLINDEN/Crypt--PWSafe3/pull/2,
|
||||
adds new function "deleterecord()", improves performance
|
||||
when using Bytes::Random::Secure[now optional] and fixes
|
||||
an error in ::Record::addfield().
|
||||
|
||||
1.05
|
||||
applied patch by https://github.com/Mekk:
|
||||
https://github.com/TLINDEN/Crypt--PWSafe3/pull/1,
|
||||
which replaces use of cp and mv commands with File::Copy.
|
||||
this makes it portable.
|
||||
|
||||
|
||||
1.04
|
||||
|
||||
fixed rt.cpan.org#75145. uninitialized fields lead to
|
||||
|
||||
13
Makefile.PL
13
Makefile.PL
@@ -1,6 +1,18 @@
|
||||
require 5.004;
|
||||
use ExtUtils::MakeMaker;
|
||||
|
||||
my %optional = (
|
||||
'Bytes::Random::Secure' => 0.09,
|
||||
);
|
||||
|
||||
foreach my $module (sort keys %optional) {
|
||||
eval "require $module";
|
||||
if ($@) {
|
||||
warn("Optional module $module not installed, $optional{$module}\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WriteMakefile(
|
||||
'NAME' => 'Crypt::PWSafe3',
|
||||
'VERSION_FROM' => 'lib/Crypt/PWSafe3.pm',
|
||||
@@ -12,7 +24,6 @@ WriteMakefile(
|
||||
'Crypt::Random' => 1.25,
|
||||
'Data::UUID' => 1.217,
|
||||
'Shell' => 0.5,
|
||||
'Bytes::Random::Secure' => 0.09,
|
||||
},
|
||||
'AUTHOR' => 'Thomas Linden <tlinden@cpan.org>',
|
||||
'clean' => {
|
||||
|
||||
@@ -22,13 +22,42 @@ use Data::Dumper;
|
||||
use Exporter ();
|
||||
use vars qw(@ISA @EXPORT);
|
||||
|
||||
$Crypt::PWSafe3::VERSION = '1.05';
|
||||
$Crypt::PWSafe3::VERSION = '1.06';
|
||||
|
||||
use Crypt::PWSafe3::Field;
|
||||
use Crypt::PWSafe3::HeaderField;
|
||||
use Crypt::PWSafe3::Record;
|
||||
use Crypt::PWSafe3::SHA256;
|
||||
|
||||
#
|
||||
# check, which random source to use.
|
||||
# install a wrapper closure around the
|
||||
# one we found.
|
||||
BEGIN {
|
||||
eval { require Bytes::Random::Secure };
|
||||
if ($@) {
|
||||
# well, didn' work, use slow function
|
||||
eval { require Crypt::Random; };# qw( makerandom ); };
|
||||
if ($@) {
|
||||
croak "Could not find either Crypt::Random or Bytes::Random::Secure. Install one of them and retry!";
|
||||
}
|
||||
else {
|
||||
*Crypt::PWSafe3::random = sub {
|
||||
my($this, $len) = @_;
|
||||
my $bits = makerandom(Size => 256, Strength => 1);
|
||||
return substr($bits, 0, $len);
|
||||
};
|
||||
}
|
||||
}
|
||||
else {
|
||||
# good. use the faster one
|
||||
*Crypt::PWSafe3::random = sub {
|
||||
my($this, $len) = @_;
|
||||
return random_bytes($len);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
my @fields = qw(tag salt iter shaps b1 b2 b3 b4 keyk file program
|
||||
keyl iv hmac header strechedpw password whoami);
|
||||
foreach my $field (@fields) {
|
||||
@@ -641,20 +670,6 @@ sub writebytes {
|
||||
}
|
||||
}
|
||||
|
||||
# This is original, very slow random
|
||||
#sub random {
|
||||
# #
|
||||
# # helper, return some secure random bytes
|
||||
# my($this, $len) = @_;
|
||||
# my $bits = makerandom(Size => 256, Strength => 1);
|
||||
# return substr($bits, 0, $len);
|
||||
#}
|
||||
|
||||
use Bytes::Random::Secure qw(random_bytes random_bytes_hex);
|
||||
sub random {
|
||||
my($this, $len) = @_;
|
||||
return random_bytes($len);
|
||||
}
|
||||
|
||||
sub getheader {
|
||||
#
|
||||
@@ -845,6 +860,10 @@ type with according values. Refer to L<Crypt::PWSafe3::Record>
|
||||
for details about available fields.
|
||||
|
||||
|
||||
=head2 B<deleterecord(uuid)>
|
||||
|
||||
Delete the record identified by the given UUID.
|
||||
|
||||
=head2 B<save([parameter-hash])>
|
||||
|
||||
Save the current password safe vault back to disk.
|
||||
@@ -928,7 +947,7 @@ and/or modify it under the same terms as Perl itself.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
Crypt::PWSafe3 Version 1.05.
|
||||
Crypt::PWSafe3 Version 1.06.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ my %map2type = %Crypt::PWSafe3::Field::map2type;
|
||||
|
||||
my %map2name = %Crypt::PWSafe3::Field::map2name;
|
||||
|
||||
$Crypt::PWSafe3::Record::VERSION = '1.03';
|
||||
$Crypt::PWSafe3::Record::VERSION = '1.04';
|
||||
|
||||
foreach my $field (keys %map2type ) {
|
||||
eval qq(
|
||||
|
||||
Reference in New Issue
Block a user