You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by sd...@apache.org on 2016/06/24 06:22:37 UTC
commons-crypto git commit: CRYPTO-83: Utils.getRandomDevPath should
be private method in OsCryptoRandom
Repository: commons-crypto
Updated Branches:
refs/heads/master 8c092de42 -> 7c328f25f
CRYPTO-83: Utils.getRandomDevPath should be private method in OsCryptoRandom
Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/7c328f25
Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/7c328f25
Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/7c328f25
Branch: refs/heads/master
Commit: 7c328f25feef2c1bb3c63a6e0c377306bd01e91e
Parents: 8c092de
Author: Sun Dapeng <sd...@apache.org>
Authored: Fri Jun 24 13:33:53 2016 +0800
Committer: Sun Dapeng <sd...@apache.org>
Committed: Fri Jun 24 14:18:33 2016 +0800
----------------------------------------------------------------------
.../commons/crypto/random/OsCryptoRandom.java | 23 ++++++++++++++++++--
.../org/apache/commons/crypto/utils/Utils.java | 18 ---------------
2 files changed, 21 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/7c328f25/src/main/java/org/apache/commons/crypto/random/OsCryptoRandom.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/crypto/random/OsCryptoRandom.java b/src/main/java/org/apache/commons/crypto/random/OsCryptoRandom.java
index 1525023..d105e56 100644
--- a/src/main/java/org/apache/commons/crypto/random/OsCryptoRandom.java
+++ b/src/main/java/org/apache/commons/crypto/random/OsCryptoRandom.java
@@ -23,8 +23,8 @@ import java.io.IOException;
import java.util.Properties;
import java.util.Random;
+import org.apache.commons.crypto.conf.ConfigurationKeys;
import org.apache.commons.crypto.utils.IOUtils;
-import org.apache.commons.crypto.utils.Utils;
/**
* A Random implementation that uses random bytes sourced from the operating
@@ -66,7 +66,7 @@ public class OsCryptoRandom extends Random implements CryptoRandom {
* @param props the configuration properties.
*/
public OsCryptoRandom(Properties props) {
- randomDevPath = Utils.getRandomDevPath(props);
+ randomDevPath = getRandomDevPath(props);
File randomDevFile = new File(randomDevPath);
try {
@@ -132,4 +132,23 @@ public class OsCryptoRandom extends Random implements CryptoRandom {
stream = null;
}
}
+
+ /**
+ * Gets the random device path.
+ *
+ * @param props The <code>Properties</code> class represents a set of
+ * properties.
+ * @return the random device path based on the props.
+ */
+ private static String getRandomDevPath(Properties props) {
+ String devPath = props
+ .getProperty(ConfigurationKeys.COMMONS_CRYPTO_SECURE_RANDOM_DEVICE_FILE_PATH_KEY);
+ if (devPath == null) {
+ devPath = System.getProperty(
+ ConfigurationKeys.COMMONS_CRYPTO_SECURE_RANDOM_DEVICE_FILE_PATH_KEY,
+ ConfigurationKeys.COMMONS_CRYPTO_SECURE_RANDOM_DEVICE_FILE_PATH_DEFAULT);
+ }
+ return devPath;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/7c328f25/src/main/java/org/apache/commons/crypto/utils/Utils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/crypto/utils/Utils.java b/src/main/java/org/apache/commons/crypto/utils/Utils.java
index 8886377..83a785f 100644
--- a/src/main/java/org/apache/commons/crypto/utils/Utils.java
+++ b/src/main/java/org/apache/commons/crypto/utils/Utils.java
@@ -158,24 +158,6 @@ public final class Utils {
}
/**
- * Gets the random device path.
- *
- * @param props The <code>Properties</code> class represents a set of
- * properties.
- * @return the random device path based on the props.
- */
- public static String getRandomDevPath(Properties props) {
- String devPath = props
- .getProperty(ConfigurationKeys.COMMONS_CRYPTO_SECURE_RANDOM_DEVICE_FILE_PATH_KEY);
- if (devPath == null) {
- devPath = System.getProperty(
- ConfigurationKeys.COMMONS_CRYPTO_SECURE_RANDOM_DEVICE_FILE_PATH_KEY,
- ConfigurationKeys.COMMONS_CRYPTO_SECURE_RANDOM_DEVICE_FILE_PATH_DEFAULT);
- }
- return devPath;
- }
-
- /**
* Gets path of native library.
*
* @return the path of native library.