diff --git a/scripts/Dpkg/OpenPGP.pm b/scripts/Dpkg/OpenPGP.pm
index eb6574a973f8726f4d66ae0eaad36e3f5a493c02..fcaf9f3b56c191a12e31c47a7de6d018cd391548 100644
--- a/scripts/Dpkg/OpenPGP.pm
+++ b/scripts/Dpkg/OpenPGP.pm
@@ -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) = @_;
diff --git a/scripts/t/Dpkg_OpenPGP.t b/scripts/t/Dpkg_OpenPGP.t
index 234be750c629ba635ad4c684b701a600873166ea..e8e727d3aced65f266e861eca17b5818e7545634 100644
--- a/scripts/t/Dpkg_OpenPGP.t
+++ b/scripts/t/Dpkg_OpenPGP.t
@@ -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;