Compare commits

...
Author SHA1 Message Date
Audrius Molis d5c424eed6 test adding addBouncyCastleProvider to toBinarySeed 2022-09-09 14:48:27 +03:00
2 changed files with 7 additions and 10 deletions
@@ -117,16 +117,9 @@ public class Mnemonic {
}
public static byte[] toBinarySeed(String mnemonicPhrase, String password) {
SecretKey key;
try {
SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512", "BC");
PBEKeySpec spec = new PBEKeySpec(mnemonicPhrase.toCharArray(), ("mnemonic" + password).getBytes(), 2048, 512);
key = skf.generateSecret(spec);
} catch (Exception e) {
throw new RuntimeException("Is Bouncycastle correctly initialized?");
}
SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512", "BC");
PBEKeySpec spec = new PBEKeySpec(mnemonicPhrase.toCharArray(), ("mnemonic" + password).getBytes(), 2048, 512);
SecretKey key = skf.generateSecret(spec);
return key.getEncoded();
}
@@ -31,6 +31,10 @@ public class Crypto {
}
}
static {
Crypto.addBouncyCastleProvider();
}
/**
* Derives a session key for SCP02.
*