Correct issue with Bouncy Castle code signing

If the Bouncy Castle Crypto libraries are unsigned, issues result with
the Eclipse build, since they rely on the copy that exists in the
libraries copied by the download_file.py script.  As a workaround, use
a genrule in ConvertKey to unsign the JARs manually.

Change-Id: I44d6ad5b05a18258e8bf5400c42f1cbd159e59b2
diff --git a/contrib/convertkey/BUCK b/contrib/convertkey/BUCK
index 752f82a..40ad9c4 100644
--- a/contrib/convertkey/BUCK
+++ b/contrib/convertkey/BUCK
@@ -1,12 +1,42 @@
 include_defs('//lib/maven.defs')
 
+genrule(
+  name = 'bcprov__unsign',
+  cmd = ' && '.join([
+    'unzip -qd $TMP $(location //lib/bouncycastle:bcprov)',
+    'cd $TMP',
+    'zip -Drq $OUT . -x META-INF/\*.RSA META-INF/\*.DSA META-INF/\*.SF META-INF/\*.LIST',
+  ]),
+  out = 'bcprov-unsigned.jar',
+)
+
+prebuilt_jar(
+  name = 'bcprov',
+  binary_jar = ':bcprov__unsign',
+)
+
+genrule(
+  name = 'bcpkix__unsign',
+  cmd = ' && '.join([
+    'unzip -qd $TMP $(location //lib/bouncycastle:bcpkix)',
+    'cd $TMP',
+    'zip -Drq $OUT . -x META-INF/\*.RSA META-INF/\*.DSA META-INF/\*.SF META-INF/\*.LIST',
+  ]),
+  out = 'bcpkix-unsigned.jar',
+)
+
+prebuilt_jar(
+  name = 'bcpkix',
+  binary_jar = ':bcpkix__unsign',
+)
+
 java_library(
   name = 'convertkey__lib',
   srcs = glob(['src/main/java/**/*.java']),
   deps = [
+    ':bcprov',
+    ':bcpkix',
     '//lib:jsch',
-    '//lib/bouncycastle:bcprov',
-    '//lib/bouncycastle:bcpkix',
     '//lib/log:nop',
     '//lib/mina:sshd',
   ],
diff --git a/lib/bouncycastle/BUCK b/lib/bouncycastle/BUCK
index 21e6120..0ce5817 100644
--- a/lib/bouncycastle/BUCK
+++ b/lib/bouncycastle/BUCK
@@ -8,7 +8,6 @@
   name = 'bcprov',
   id = 'org.bouncycastle:bcprov-jdk15on:' + VERSION,
   sha1 = '88a941faf9819d371e3174b5ed56a3f3f7d73269',
-  unsign = True,
   license = 'DO_NOT_DISTRIBUTE', #'bouncycastle'
 )
 
@@ -24,7 +23,6 @@
   name = 'bcpkix',
   id = 'org.bouncycastle:bcpkix-jdk15on:' + VERSION,
   sha1 = 'b8ffac2bbc6626f86909589c8cc63637cc936504',
-  unsign = True,
   license = 'DO_NOT_DISTRIBUTE', #'bouncycastle'
   deps = [':bcprov'],
 )