Java Code Examples for org.web3j.crypto.WalletFile#CipherParams
The following examples show how to use
org.web3j.crypto.WalletFile#CipherParams .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RequestTest.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
@Test public void testParityNewAccountFromWallet() throws Exception { WalletFile walletFile = new WalletFile(); walletFile.setAddress("0x..."); WalletFile.Crypto crypto = new WalletFile.Crypto(); crypto.setCipher("CIPHER"); crypto.setCiphertext("CIPHERTEXT"); walletFile.setCrypto(crypto); WalletFile.CipherParams cipherParams = new WalletFile.CipherParams(); cipherParams.setIv("IV"); crypto.setCipherparams(cipherParams); crypto.setKdf("KDF"); WalletFile.ScryptKdfParams kdfParams = new WalletFile.ScryptKdfParams(); kdfParams.setDklen(32); kdfParams.setN(1); kdfParams.setP(10); kdfParams.setR(100); kdfParams.setSalt("SALT"); crypto.setKdfparams(kdfParams); crypto.setMac("MAC"); walletFile.setCrypto(crypto); walletFile.setId("cab06c9e-79a9-48ea-afc7-d3bdb3a59526"); walletFile.setVersion(1); web3j.parityNewAccountFromWallet(walletFile, "password").send(); //CHECKSTYLE:OFF verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"parity_newAccountFromWallet\",\"params\":[{\"address\":\"0x...\",\"id\":\"cab06c9e-79a9-48ea-afc7-d3bdb3a59526\",\"version\":1,\"crypto\":{\"cipher\":\"CIPHER\",\"ciphertext\":\"CIPHERTEXT\",\"cipherparams\":{\"iv\":\"IV\"},\"kdf\":\"KDF\",\"kdfparams\":{\"dklen\":32,\"n\":1,\"p\":10,\"r\":100,\"salt\":\"SALT\"},\"mac\":\"MAC\"}},\"password\"],\"id\":1}"); //CHECKSTYLE:ON }
Example 2
Source File: RequestTest.java From web3j with Apache License 2.0 | 5 votes |
@Test public void testParityNewAccountFromWallet() throws Exception { WalletFile walletFile = new WalletFile(); walletFile.setAddress("0x..."); WalletFile.Crypto crypto = new WalletFile.Crypto(); crypto.setCipher("CIPHER"); crypto.setCiphertext("CIPHERTEXT"); walletFile.setCrypto(crypto); WalletFile.CipherParams cipherParams = new WalletFile.CipherParams(); cipherParams.setIv("IV"); crypto.setCipherparams(cipherParams); crypto.setKdf("KDF"); WalletFile.ScryptKdfParams kdfParams = new WalletFile.ScryptKdfParams(); kdfParams.setDklen(32); kdfParams.setN(1); kdfParams.setP(10); kdfParams.setR(100); kdfParams.setSalt("SALT"); crypto.setKdfparams(kdfParams); crypto.setMac("MAC"); walletFile.setCrypto(crypto); walletFile.setId("cab06c9e-79a9-48ea-afc7-d3bdb3a59526"); walletFile.setVersion(1); web3j.parityNewAccountFromWallet(walletFile, "password").send(); verifyResult( "{\"jsonrpc\":\"2.0\",\"method\":\"parity_newAccountFromWallet\",\"params\":[{\"address\":\"0x...\",\"id\":\"cab06c9e-79a9-48ea-afc7-d3bdb3a59526\",\"version\":1,\"crypto\":{\"cipher\":\"CIPHER\",\"ciphertext\":\"CIPHERTEXT\",\"cipherparams\":{\"iv\":\"IV\"},\"kdf\":\"KDF\",\"kdfparams\":{\"dklen\":32,\"n\":1,\"p\":10,\"r\":100,\"salt\":\"SALT\"},\"mac\":\"MAC\"}},\"password\"],\"id\":1}"); }
Example 3
Source File: ResponseTest.java From etherscan-explorer with GNU General Public License v3.0 | 4 votes |
@Test public void testParityExportAccount() { //CHECKSTYLE:OFF buildResponse("{\n" + " \"jsonrpc\": \"2.0\",\n" + " \"id\": 1,\n" + " \"result\": {\n" + " \"address\": \"0042e5d2a662eeaca8a7e828c174f98f35d8925b\",\n" + " \"crypto\": {\n" + " \"cipher\": \"aes-128-ctr\",\n" + " \"cipherparams\": {\n" + " \"iv\": \"a1c6ff99070f8032ca1c4e8add006373\"\n" + " },\n" + " \"ciphertext\": \"df27e3db64aa18d984b6439443f73660643c2d119a6f0fa2fa9a6456fc802d75\",\n" + " \"kdf\": \"pbkdf2\",\n" + " \"kdfparams\": {\n" + " \"c\": 10240,\n" + " \"dklen\": 32,\n" + " \"prf\": \"hmac-sha256\",\n" + " \"salt\": \"ddc325335cda5567a1719313e73b4842511f3e4a837c9658eeb78e51ebe8c815\"\n" + " },\n" + " \"mac\": \"3dc888ae79cbb226ff9c455669f6cf2d79be72120f2298f6cb0d444fddc0aa3d\"\n" + " },\n" + " \"id\": \"6a186c80-7797-cff2-bc2e-7c1d6a6cc76e\",\n" + " \"meta\": \"{\\\"passwordHint\\\":\\\"parity-export-test\\\",\\\"timestamp\\\":1490017814987}\",\n" + " \"name\": \"parity-export-test\",\n" + " \"version\": 3\n" + " }\n" + "}"); //CHECKSTYLE:ON WalletFile walletFile = new WalletFile(); walletFile.setAddress("0042e5d2a662eeaca8a7e828c174f98f35d8925b"); WalletFile.Crypto crypto = new WalletFile.Crypto(); crypto.setCipher("aes-128-ctr"); //CHECKSTYLE:OFF crypto.setCiphertext("df27e3db64aa18d984b6439443f73660643c2d119a6f0fa2fa9a6456fc802d75"); //CHECKSTYLE:ON walletFile.setCrypto(crypto); WalletFile.CipherParams cipherParams = new WalletFile.CipherParams(); cipherParams.setIv("a1c6ff99070f8032ca1c4e8add006373"); crypto.setCipherparams(cipherParams); crypto.setKdf("pbkdf2"); WalletFile.Aes128CtrKdfParams kdfParams = new WalletFile.Aes128CtrKdfParams(); kdfParams.setC(10240); kdfParams.setPrf("hmac-sha256"); kdfParams.setDklen(32); kdfParams.setSalt("ddc325335cda5567a1719313e73b4842511f3e4a837c9658eeb78e51ebe8c815"); crypto.setKdfparams(kdfParams); crypto.setMac("3dc888ae79cbb226ff9c455669f6cf2d79be72120f2298f6cb0d444fddc0aa3d"); walletFile.setCrypto(crypto); walletFile.setId("6a186c80-7797-cff2-bc2e-7c1d6a6cc76e"); walletFile.setVersion(3); ParityExportAccount parityExportAccount = deserialiseResponse( ParityExportAccount.class); assertThat(parityExportAccount.getWallet(), equalTo(walletFile)); }
Example 4
Source File: ResponseTest.java From web3j with Apache License 2.0 | 4 votes |
@Test public void testParityExportAccount() { buildResponse( "{\n" + " \"jsonrpc\": \"2.0\",\n" + " \"id\": 1,\n" + " \"result\": {\n" + " \"address\": \"0042e5d2a662eeaca8a7e828c174f98f35d8925b\",\n" + " \"crypto\": {\n" + " \"cipher\": \"aes-128-ctr\",\n" + " \"cipherparams\": {\n" + " \"iv\": \"a1c6ff99070f8032ca1c4e8add006373\"\n" + " },\n" + " \"ciphertext\": \"df27e3db64aa18d984b6439443f73660643c2d119a6f0fa2fa9a6456fc802d75\",\n" + " \"kdf\": \"pbkdf2\",\n" + " \"kdfparams\": {\n" + " \"c\": 10240,\n" + " \"dklen\": 32,\n" + " \"prf\": \"hmac-sha256\",\n" + " \"salt\": \"ddc325335cda5567a1719313e73b4842511f3e4a837c9658eeb78e51ebe8c815\"\n" + " },\n" + " \"mac\": \"3dc888ae79cbb226ff9c455669f6cf2d79be72120f2298f6cb0d444fddc0aa3d\"\n" + " },\n" + " \"id\": \"6a186c80-7797-cff2-bc2e-7c1d6a6cc76e\",\n" + " \"meta\": \"{\\\"passwordHint\\\":\\\"parity-export-test\\\",\\\"timestamp\\\":1490017814987}\",\n" + " \"name\": \"parity-export-test\",\n" + " \"version\": 3\n" + " }\n" + "}"); WalletFile walletFile = new WalletFile(); walletFile.setAddress("0042e5d2a662eeaca8a7e828c174f98f35d8925b"); WalletFile.Crypto crypto = new WalletFile.Crypto(); crypto.setCipher("aes-128-ctr"); crypto.setCiphertext("df27e3db64aa18d984b6439443f73660643c2d119a6f0fa2fa9a6456fc802d75"); walletFile.setCrypto(crypto); WalletFile.CipherParams cipherParams = new WalletFile.CipherParams(); cipherParams.setIv("a1c6ff99070f8032ca1c4e8add006373"); crypto.setCipherparams(cipherParams); crypto.setKdf("pbkdf2"); WalletFile.Aes128CtrKdfParams kdfParams = new WalletFile.Aes128CtrKdfParams(); kdfParams.setC(10240); kdfParams.setPrf("hmac-sha256"); kdfParams.setDklen(32); kdfParams.setSalt("ddc325335cda5567a1719313e73b4842511f3e4a837c9658eeb78e51ebe8c815"); crypto.setKdfparams(kdfParams); crypto.setMac("3dc888ae79cbb226ff9c455669f6cf2d79be72120f2298f6cb0d444fddc0aa3d"); walletFile.setCrypto(crypto); walletFile.setId("6a186c80-7797-cff2-bc2e-7c1d6a6cc76e"); walletFile.setVersion(3); ParityExportAccount parityExportAccount = deserialiseResponse(ParityExportAccount.class); assertEquals(parityExportAccount.getWallet(), (walletFile)); }