Crypt-Pwsafe
view release on metacpan or search on metacpan
lib/Crypt/Pwsafe.pm view on Meta::CPAN
255 => "EndofEntry"
);
# pwsafe3 file header format
# V3TAG == "PWS3";
# SALT = 32 bytes random
# NumHashIters = 32 bit integer (little endian)
# Hash = 32 bytes (NumHashIters+1 rounds of SHA256 of Safe combination concatenated with SALT)
# B1B2 = mKey encrypted using ECB Twofish with PTag as key
# B3B4 = hmac SHA256 key encrypted using ECB Twofish with PTag as key
# CBC IV = random 16 bytes
# Notes on records
# 1. All times are 32-bit little-endian integers
# 2. All field values except UUID and times use UTF8
# 3. SHA256 HMAC at the end of file is calculated on field values only
=head1 DESCRIPTION
Crypt::Pwsafe module provide read-only access to database files created by Version 3
of PasswordSafe utility available from SourceForge at L<http://passwordsafe.sf.net>.
lib/Crypt/Pwsafe.pm view on Meta::CPAN
my $plain = "";
my $pwsafe = {};
my $crypt_len = length($crypt);
my ($group, $title, $user);
my $entry = {};
while($ptr < $crypt_len) {
my $curr_plain = $chain_blocks->();
# Passwordsafe uses little-endian
my ($len, $type) = unpack("VC", $curr_plain);
#printf "len=%2d type=%3d ", $len, $type;
die "Read negative length from CBC\n" if $len < 0;
my $buf_len = $len > 11 ? 11 : $len;
my $buf = substr($curr_plain, 5, $buf_len);
$len -= $buf_len;
while($len > 0) {
my $curr_plain = $chain_blocks->();
if ($len >= $bs) {
$buf .= $curr_plain;
$len -= $bs;
} else {
$buf .= substr($curr_plain, 0, $len);
( run in 0.717 second using v1.01-cache-2.11-cpan-e1769b4cff6 )