| 1 | package File::KDBX::Dumper::V3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Dump KDBX3 files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use Crypt::Digest qw(digest_data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Encode qw(encode); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use File::KDBX::Constants qw(:header :compression); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use File::KDBX::Error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 6 | ▶ | use File::KDBX::IO::Crypt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 6 | ▶ | use File::KDBX::IO::HashBlock; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 6 | ▶ | use File::KDBX::Util qw(:class :empty :int :load erase_scoped); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 6 | ▶ | use IO::Handle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 6 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 6 | extends 'File::KDBX::Dumper'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 6 | our $VERSION = '0.906'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 8 | ▶ | sub _write_headers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_write_headers: called CC=5 SCAR=16.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 8 | my $fh = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 8 | my $kdbx = $self->kdbx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 8 | my $headers = $kdbx->headers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 8 | my $buf = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # FIXME kinda janky - maybe add a "prepare" hook to massage the KDBX into the correct shape before we get | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # this far | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 8 | local $headers->{+HEADER_TRANSFORM_SEED} = $kdbx->transform_seed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 8 | local $headers->{+HEADER_TRANSFORM_ROUNDS} = $kdbx->transform_rounds; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 8 | my $got_iv_size = length($headers->{+HEADER_ENCRYPTION_IV}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 8 | ▶ | alert 'Encryption IV should be exactly 16 bytes long', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | got => $got_iv_size, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | expected => 16 if $got_iv_size != 16; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 8 | ▶ | if (nonempty (my $comment = $headers->{+HEADER_COMMENT})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | $buf .= $self->_write_header($fh, HEADER_COMMENT, $comment); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 8 | for my $type ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | HEADER_CIPHER_ID, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | HEADER_COMPRESSION_FLAGS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | HEADER_MASTER_SEED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | HEADER_TRANSFORM_SEED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | HEADER_TRANSFORM_ROUNDS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | HEADER_ENCRYPTION_IV, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | HEADER_INNER_RANDOM_STREAM_KEY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | HEADER_STREAM_START_BYTES, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | HEADER_INNER_RANDOM_STREAM_ID, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 72 | ▶ | defined $headers->{$type} or throw "Missing value for required header: $type", type => $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 72 | $buf .= $self->_write_header($fh, $type, $headers->{$type}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 8 | $buf .= $self->_write_header($fh, HEADER_END); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 8 | return $buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 80 | ▶ | sub _write_header { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_write_header: called CC=19 SCAR=32.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 80 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 80 | my $fh = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 80 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 80 | ▶ | my $val = shift // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() // ""
MC/DC100%1/1
shift() // ""
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 80 | $type = to_header_constant($type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 80 | ▶ | if ($type == HEADER_END) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 13 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 8 | $val = "\r\n\r\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | elsif ($type == HEADER_COMMENT) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $val = encode('UTF-8', $val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | elsif ($type == HEADER_CIPHER_ID) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 8 | my $size = length($val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 8 | ▶ | $size == 16 or throw 'Invalid cipher UUID length', got => $size, expected => $size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | elsif ($type == HEADER_COMPRESSION_FLAGS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 8 | $val = pack('L<', $val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | elsif ($type == HEADER_MASTER_SEED) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 8 | my $size = length($val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 8 | ▶ | $size == 32 or throw 'Invalid master seed length', got => $size, expected => $size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | elsif ($type == HEADER_TRANSFORM_SEED) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # nothing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | elsif ($type == HEADER_TRANSFORM_ROUNDS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 8 | $val = pack_Ql($val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | elsif ($type == HEADER_ENCRYPTION_IV) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | # nothing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | elsif ($type == HEADER_INNER_RANDOM_STREAM_KEY) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # nothing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | elsif ($type == HEADER_STREAM_START_BYTES) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # nothing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | elsif ($type == HEADER_INNER_RANDOM_STREAM_ID) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 8 | $val = pack('L<', $val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | ▶ | elsif ($type == HEADER_KDF_PARAMETERS || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$type == "kdf_parameters" or $type == "public_custom_data"
MC/DC0%0/2
$type == "kdf_parameters" or $type == "public_custom_data"
$type == "kdf_parameters"
$type == "public_custom_data"
Truth table0%0/3
A or B
A= $type == "kdf_parameters"B= $type == "public_custom_data"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | $type == HEADER_PUBLIC_CUSTOM_DATA) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | throw "Unexpected KDBX4 header: $type", type => $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | elsif ($type == HEADER_COMMENT) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | throw "Unexpected KDB header: $type", type => $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | alert "Unknown header: $type", type => $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 80 | my $size = length($val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 80 | my $buf = pack('C S<', 0+$type, $size); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 80 | ▶ | $fh->print($buf, $val) or throw 'Failed to write header'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 80 | return "$buf$val"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 8 | ▶ | sub _write_body { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_write_body: called CC=7 SCAR=19.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 8 | my $fh = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 8 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 8 | my $header_data = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 8 | my $kdbx = $self->kdbx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # assert all required headers present | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 8 | for my $field ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | HEADER_CIPHER_ID, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | HEADER_ENCRYPTION_IV, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | HEADER_MASTER_SEED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | HEADER_INNER_RANDOM_STREAM_KEY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | HEADER_STREAM_START_BYTES, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 40 | ▶ | defined $kdbx->headers->{$field} or throw "Missing $field"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 8 | my $master_seed = $kdbx->headers->{+HEADER_MASTER_SEED}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 8 | my @cleanup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 8 | $key = $kdbx->composite_key($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 8 | my $response = $key->challenge($master_seed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 8 | push @cleanup, erase_scoped $response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 8 | my $transformed_key = $kdbx->kdf->transform($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 8 | push @cleanup, erase_scoped $transformed_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 8 | my $final_key = digest_data('SHA256', $master_seed, $response, $transformed_key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 8 | push @cleanup, erase_scoped $final_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 8 | my $cipher = $kdbx->cipher(key => $final_key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 8 | $fh = File::KDBX::IO::Crypt->new($fh, cipher => $cipher); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 8 | ▶ | $fh->print($kdbx->headers->{+HEADER_STREAM_START_BYTES}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | or throw 'Failed to write start bytes'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 8 | $kdbx->key($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 8 | $fh = File::KDBX::IO::HashBlock->new($fh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 8 | my $compress = $kdbx->headers->{+HEADER_COMPRESSION_FLAGS}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 8 | ▶ | if ($compress == COMPRESSION_GZIP) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 8 | load_optional('IO::Compress::Gzip'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 8 | ▶ | $fh = IO::Compress::Gzip->new($fh, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | -Level => IO::Compress::Gzip::Z_BEST_COMPRESSION(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | -TextFlag => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | ) or throw "Failed to initialize compression library: $IO::Compress::Gzip::GzipError", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | error => $IO::Compress::Gzip::GzipError; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | elsif ($compress != COMPRESSION_NONE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | throw "Unsupported compression ($compress)\n", compression_flags => $compress; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 8 | my $header_hash = digest_data('SHA256', $header_data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 8 | $self->_write_inner_body($fh, $header_hash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||