@Test public void testGenerateWalletFile() throws Exception { String expectedAdr = "AXJxLU79D795wMRMmGq9SWaqCqnmpGw9uq"; byte[] sk = Numeric.hexStringToByteArray( "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"); byte[] skCopy = new byte[sk.length]; System.arraycopy(sk, 0, skCopy, 0, sk.length); ECKeyPair pair = ECKeyPair.create(sk); String pw = "password"; String fileName = WalletUtils.generateWalletFile(pw, pair, this.tempDir); Path p = Paths.get(this.tempDir.getPath(), fileName); Wallet loadedWallet = Wallet.fromNEP6Wallet(p.toFile()); loadedWallet.decryptAllAccounts(pw); assertThat(loadedWallet.getAccounts().get(0).getAddress(), is(expectedAdr)); assertThat(loadedWallet.getAccounts().get(0).getECKeyPair(), is(ECKeyPair.create(skCopy))); }
public static String generateWalletFile( String password, File destinationDirectory) throws CipherException, IOException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException { ECKeyPair ecKeyPair = ECKeyPair.createEcKeyPair(); return generateWalletFile(password, ecKeyPair, destinationDirectory); }
WalletUtils { public static String generateWalletFile( String password, File destinationDirectory) throws CipherException, IOException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException { ECKeyPair ecKeyPair = ECKeyPair.createEcKeyPair(); return generateWalletFile(password, ecKeyPair, destinationDirectory); } }
WalletUtils { public static String generateWalletFile( String password, File destinationDirectory) throws CipherException, IOException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException { ECKeyPair ecKeyPair = ECKeyPair.createEcKeyPair(); return generateWalletFile(password, ecKeyPair, destinationDirectory); }  }
WalletUtils { public static String generateWalletFile( String password, File destinationDirectory) throws CipherException, IOException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException { ECKeyPair ecKeyPair = ECKeyPair.createEcKeyPair(); return generateWalletFile(password, ecKeyPair, destinationDirectory); }  static String generateWalletFile(
            String password, File destinationDirectory); static String generateWalletFile(
            String password, ECKeyPair ecKeyPair, File destinationDirectory); static String generateWalletFile(NEP6Wallet nep6Wallet, File destinationDirectory); static String getWalletFileName(NEP6Wallet nep6Wallet); static String getDefaultKeyDirectory(); }
WalletUtils { public static String generateWalletFile( String password, File destinationDirectory) throws CipherException, IOException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException { ECKeyPair ecKeyPair = ECKeyPair.createEcKeyPair(); return generateWalletFile(password, ecKeyPair, destinationDirectory); }  static String generateWalletFile(
            String password, File destinationDirectory); static String generateWalletFile(
            String password, ECKeyPair ecKeyPair, File destinationDirectory); static String generateWalletFile(NEP6Wallet nep6Wallet, File destinationDirectory); static String getWalletFileName(NEP6Wallet nep6Wallet); static String getDefaultKeyDirectory();  }