org.aimanj.console.WalletCreator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of console Show documentation
Show all versions of console Show documentation
aimanj command line tools
package org.aimanj.console;
import java.io.File;
import java.io.IOException;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import org.aimanj.codegen.Console;
import org.aimanj.crypto.CipherException;
import org.aimanj.crypto.WalletUtils;
/**
* Simple class for creating a wallet file.
*/
public class WalletCreator extends WalletManager {
public WalletCreator() {
}
public WalletCreator(IODevice console) {
super(console);
}
public static void main(String[] args) {
new WalletCreator().run();
}
static void main(IODevice console) {
new WalletCreator(console).run();
}
private void run() {
String password = getPassword("Please enter a wallet file password: ");
String destinationDir = getDestinationDir();
File destination = createDir(destinationDir);
try {
String walletFileName = WalletUtils.generateFullNewWalletFile(password, destination);
console.printf("Wallet file " + walletFileName
+ " successfully created in: " + destinationDir + "\n");
} catch (CipherException | IOException | InvalidAlgorithmParameterException
| NoSuchAlgorithmException | NoSuchProviderException e) {
Console.exitError(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy