Index: lib/rake/packagetask.rb
===================================================================
--- lib/rake/packagetask.rb	(revision 577)
+++ lib/rake/packagetask.rb	(working copy)
@@ -68,6 +68,15 @@
     # List of files to be included in the package.
     attr_accessor :package_files
 
+    # True if a detached, ASCII-armored signature of each package file should be produced (default is false).
+    attr_accessor :need_pgp_signature
+
+    # Command to create detached OpenPGP signature files (default is 'gpg -ba').
+    attr_accessor :pgp_command
+
+    # Extension for detached OpenPGP signature files (default is 'asc').
+    attr_accessor :pgp_file_extension
+
     # Create a Package Task with the given name and version. 
     def initialize(name=nil, version=nil)
       init(name, version)
@@ -85,6 +94,11 @@
       @need_tar_gz = false
       @need_tar_bz2 = false
       @need_zip = false
+
+      # pgp defaults (set to use GnuPG by default)
+      @need_pgp_signature = false
+      @pgp_command = 'gpg -ba'
+      @pgp_file_extension = 'asc'
     end
 
     # Create the tasks defined by this task library.
@@ -117,6 +131,8 @@
               sh %{tar #{flag}cvf #{file} #{package_name}}
             end
           end
+
+          pgp_task_for(file) if @need_pgp_signature
         end
       end
       
@@ -126,6 +142,8 @@
           chdir(package_dir) do
             sh %{zip -r #{zip_file} #{package_name}}
           end
+
+          pgp_task_for(zip_file) if @need_pgp_signature
         end
       end
 
@@ -148,6 +166,18 @@
       self
     end
 
+    def pgp_task_for(src_file)
+      src_path = "#@package_dir/#{src_file}"
+      sig_path = "#{src_path}.#@pgp_file_extension"
+
+      task :package => [sig_path]
+      file sig_path => [src_path] do
+        chdir(@package_dir) do
+          sh %{#@pgp_command #{src_file}}
+        end
+      end
+    end
+
     def package_name
       @version ? "#{@name}-#{@version}" : @name
     end
Index: lib/rake/gempackagetask.rb
===================================================================
--- lib/rake/gempackagetask.rb	(revision 577)
+++ lib/rake/gempackagetask.rb	(working copy)
@@ -86,6 +86,8 @@
           }
         }
       end
+
+      pgp_task_for(gem_file) if @need_pgp_signature
     end
     
     def gem_file

