Compare commits

..
Author SHA1 Message Date
Michele Balistreri 022b9c4f28 add metadata parser/encoder 2022-07-18 14:15:25 +02:00
2 changed files with 10 additions and 7 deletions
@@ -117,9 +117,16 @@ public class Mnemonic {
}
public static byte[] toBinarySeed(String mnemonicPhrase, String password) {
SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512", "BC");
PBEKeySpec spec = new PBEKeySpec(mnemonicPhrase.toCharArray(), ("mnemonic" + password).getBytes(), 2048, 512);
SecretKey key = skf.generateSecret(spec);
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?");
}
return key.getEncoded();
}
@@ -31,10 +31,6 @@ public class Crypto {
}
}
static {
Crypto.addBouncyCastleProvider();
}
/**
* Derives a session key for SCP02.
*