make useful functions public?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

make useful functions public?

Lou Wynn
Hi BC Devs,

I've been using BC in my project and found a case where BC provides
useful functionalities, but there are no modifiers, which means they
cannot be used outside the package. One is in the PGPUtil.java file. My
use case is using the makeKeyFromPassPhrase function as a convenient way
to generate salted and iterated password hashes. Can this change be made
permanent in the BC library, so that I don't have to manually edit
source with each update?

diff --git
index fc9d4c1..d009e01 100644
--- a/pg/src/main/java/org/bouncycastle/openpgp/operator/PGPUtil.java
+++ b/pg/src/main/java/org/bouncycastle/openpgp/operator/PGPUtil.java
@@ -12,10 +12,10 @@
  * Basic utility class
-class PGPUtil
+public class PGPUtil
     implements HashAlgorithmTags
-    static byte[] makeKeyFromPassPhrase(
+    public static byte[] makeKeyFromPassPhrase(
         PGPDigestCalculator digestCalculator,
         int     algorithm,
         S2K     s2k,

The second case is making PGPSecretKeyRing public since my project needs
to access it.

diff --git
index 9e3d36e..f2d3750 100644
--- a/pg/src/main/java/org/bouncycastle/openpgp/PGPSecretKeyRing.java
+++ b/pg/src/main/java/org/bouncycastle/openpgp/PGPSecretKeyRing.java
@@ -35,7 +35,7 @@
     List keys;
     List extraPubKeys;
-    PGPSecretKeyRing(List keys)
+    public PGPSecretKeyRing(List keys)
         this(keys, new ArrayList());