Skip to content
Snippets Groups Projects
Commit 2c622bc0 authored by Guillem Jover's avatar Guillem Jover
Browse files

Dpkg::OpenPGP: Add new dearmor() function

parent 925b1696
No related branches found
No related tags found
1 merge request!4Update crimson to version from bookworm
......@@ -129,6 +129,15 @@ sub armor {
return $asc;
}
sub dearmor {
my ($type, $asc, $bin) = @_;
my $armor = file_slurp($asc);
file_dump($bin, _pgp_dearmor_data($type, $armor));
return $bin;
}
sub _gpg_exec
{
my ($opts, $exec, $errmsg) = @_;
......
......@@ -25,7 +25,7 @@ use Dpkg::ErrorHandling;
test_needs_command('gpg');
plan tests => 4;
plan tests => 5;
use_ok('Dpkg::OpenPGP');
......@@ -47,6 +47,13 @@ $ascfile = "$tmpdir/data-file.asc";
Dpkg::OpenPGP::armor('ARMORED FILE', $binfile, $ascfile);
ok(compare($ascfile, $reffile) == 0, 'armor binary file into OpenPGP ASCII Armor');
$reffile = "$datadir/data-file";
$ascfile = "$datadir/data-file.asc";
$binfile = "$tmpdir/data-file";
Dpkg::OpenPGP::dearmor('ARMORED FILE', $ascfile, $binfile);
ok(compare($binfile, $reffile) == 0, 'dearmor OpenPGP ASCII Armor into binary file');
# TODO: Add actual test cases.
1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment