aboutsummaryrefslogtreecommitdiff
path: root/common/src/main/java/org/conscrypt/ScryptSecretKeyFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/main/java/org/conscrypt/ScryptSecretKeyFactory.java')
-rw-r--r--common/src/main/java/org/conscrypt/ScryptSecretKeyFactory.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/common/src/main/java/org/conscrypt/ScryptSecretKeyFactory.java b/common/src/main/java/org/conscrypt/ScryptSecretKeyFactory.java
index 8b7afe34..9714bcf3 100644
--- a/common/src/main/java/org/conscrypt/ScryptSecretKeyFactory.java
+++ b/common/src/main/java/org/conscrypt/ScryptSecretKeyFactory.java
@@ -44,8 +44,8 @@ public class ScryptSecretKeyFactory extends SecretKeyFactorySpi {
p = spec.getParallelizationParameter();
keyOutputBits = spec.getKeyLength();
} else {
- // Extract parameters from any `KeySpec` that has getters with the correct name. This allows,
- // for example, code to use BouncyCastle's KeySpec with the conscrypt provider.
+ // Extract parameters from any `KeySpec` that has getters with the correct name. This
+ // allows, for example, code to use BouncyCastle's KeySpec with the Conscrypt provider.
try {
password = (char[]) getValue(inKeySpec, "getPassword");
salt = (byte[]) getValue(inKeySpec, "getSalt");
@@ -65,10 +65,11 @@ public class ScryptSecretKeyFactory extends SecretKeyFactorySpi {
try {
return new ScryptKey(
NativeCrypto.Scrypt_generate_key(
- new String(password).getBytes("UTF-8"), salt, n, r, p, keyOutputBits / 8));
+ new String(password).getBytes("UTF-8"),
+ salt, n, r, p, keyOutputBits / 8));
} catch (UnsupportedEncodingException e) {
// Impossible according to the Java docs: UTF-8 is always supported.
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
@@ -106,7 +107,7 @@ public class ScryptSecretKeyFactory extends SecretKeyFactorySpi {
@Override
public String getAlgorithm() {
- // capitalised because BouncyCastle does it.
+ // Capitalised because BouncyCastle does it.
return "SCRYPT";
}