Java Code Examples for net.bither.bitherj.crypto.bip38.Bip38#decrypt()
The following examples show how to use
net.bither.bitherj.crypto.bip38.Bip38#decrypt() .
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: PrivateKeyUtil.java From bitherj with Apache License 2.0 | 6 votes |
public static String getBIP38PrivateKeyString(Address address, CharSequence password) throws AddressFormatException, InterruptedException { SecureCharSequence decrypted = getDecryptPrivateKeyString(address.getFullEncryptPrivKey() , password); String bip38 = Bip38.encryptNoEcMultiply(password, decrypted.toString()); if (BitherjSettings.DEV_DEBUG) { SecureCharSequence d = Bip38.decrypt(bip38, password); if (d.equals(decrypted)) { log.info("BIP38 right"); } else { throw new RuntimeException("BIP38 wrong " + d.toString() + " , " + "" + decrypted.toString()); } } decrypted.wipe(); return bip38; }
Example 2
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 5 votes |
@Test public void testDecryptNoCompressionWithEcMultiplyWithLot2() throws InterruptedException, UnsupportedEncodingException, AddressFormatException { // "MOLON LABE" using greek characters = "ΜΟΛΩΝ ΛΑΒΕ" String passphrase = "\u039C\u039F\u039B\u03A9\u039D \u039B\u0391\u0392\u0395"; assertEquals("ce9cce9fce9bcea9ce9d20ce9bce91ce92ce95".toUpperCase(), Utils.bytesToHexString(passphrase.getBytes("UTF-8"))); SecureCharSequence decoded = Bip38.decrypt("6PgGWtx25kUg8QWvwuJAgorN6k9FbE25rv5dMRwu5SKMnfpfVe5mar2ngH", passphrase); assertEquals(decoded.toString(), "5KMKKuUmAkiNbA3DazMQiLfDq47qs8MAEThm4yL8R2PhV1ov33D"); }
Example 3
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 5 votes |
@Test public void testDecryptNoCompressionWithEcMultiplyWithLot2WithBom() throws InterruptedException, UnsupportedEncodingException, AddressFormatException { // "MOLON LABE" using greek characters = "ΜΟΛΩΝ ΛΑΒΕ" String passphrase = "\u039C\u039F\u039B\u03A9\u039D \u039B\u0391\u0392\u0395"; assertEquals("ce9cce9fce9bcea9ce9d20ce9bce91ce92ce95".toUpperCase(), Utils.bytesToHexString(passphrase.getBytes("UTF-8"))); SecureCharSequence decoded = Bip38.decrypt("\uFEFF6PgGWtx25kUg8QWvwuJAgorN6k9FbE25rv5dMRwu5SKMnfpfVe5mar2ngH", passphrase); assertEquals(decoded.toString(), "5KMKKuUmAkiNbA3DazMQiLfDq47qs8MAEThm4yL8R2PhV1ov33D"); }
Example 4
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 4 votes |
@Test public void testDecryptNoCompression() throws InterruptedException, AddressFormatException { SecureCharSequence decoded = Bip38.decrypt("6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg", "TestingOneTwoThree"); assertEquals(decoded.toString(), "5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR"); }
Example 5
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 4 votes |
@Test public void testDecryptNoCompressionWithBom() throws InterruptedException, AddressFormatException { SecureCharSequence decoded = Bip38.decrypt("\uFEFF6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg", "TestingOneTwoThree"); assertEquals(decoded.toString(), "5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR"); }
Example 6
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 4 votes |
@Test public void testDecryptCompression1() throws InterruptedException, AddressFormatException { SecureCharSequence decoded = Bip38.decrypt("6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo", "TestingOneTwoThree"); assertEquals(decoded.toString(), "L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP"); }
Example 7
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 4 votes |
@Test public void testDecryptCompression1WithBom() throws InterruptedException, AddressFormatException { SecureCharSequence decoded = Bip38.decrypt("\uFEFF6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo", "TestingOneTwoThree"); assertEquals(decoded.toString(), "L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP"); }
Example 8
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 4 votes |
@Test public void testDecryptCompression2() throws InterruptedException, AddressFormatException { SecureCharSequence decoded = Bip38.decrypt("6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7", "Satoshi"); assertEquals(decoded.toString(), "KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7"); }
Example 9
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 4 votes |
@Test public void testDecryptCompression2WithBom() throws InterruptedException, AddressFormatException { SecureCharSequence decoded = Bip38.decrypt("\uFEFF6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7", "Satoshi"); assertEquals(decoded.toString(), "KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7"); }
Example 10
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 4 votes |
@Test public void testDecryptNoCompressionWithEcMultiplyNoLot1() throws InterruptedException, AddressFormatException { SecureCharSequence decoded = Bip38.decrypt("6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX", "TestingOneTwoThree"); assertEquals(decoded.toString(), "5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2"); }
Example 11
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 4 votes |
@Test public void testDecryptNoCompressionWithEcMultiplyNoLot1WithBom() throws InterruptedException, AddressFormatException { SecureCharSequence decoded = Bip38.decrypt("\uFEFF6PfQu77ygVyJLZjfvMLyhLMQbYnu5uguoJJ4kMCLqWwPEdfpwANVS76gTX", "TestingOneTwoThree"); assertEquals(decoded.toString(), "5K4caxezwjGCGfnoPTZ8tMcJBLB7Jvyjv4xxeacadhq8nLisLR2"); }
Example 12
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 4 votes |
@Test public void testDecryptNoCompressionWithEcMultiplyNoLot2() throws InterruptedException, AddressFormatException { SecureCharSequence decoded = Bip38.decrypt("6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd", "Satoshi"); assertEquals(decoded.toString(), "5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH"); }
Example 13
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 4 votes |
@Test public void testDecryptNoCompressionWithEcMultiplyNoLot2WithBom() throws InterruptedException, AddressFormatException { SecureCharSequence decoded = Bip38.decrypt("\uFEFF6PfLGnQs6VZnrNpmVKfjotbnQuaJK4KZoPFrAjx1JMJUa1Ft8gnf5WxfKd", "Satoshi"); assertEquals(decoded.toString(), "5KJ51SgxWaAYR13zd9ReMhJpwrcX47xTJh2D3fGPG9CM8vkv5sH"); }
Example 14
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 4 votes |
@Test public void testDecryptNoCompressionWithEcMultiplyWithLot1() throws InterruptedException, AddressFormatException { SecureCharSequence decoded = Bip38.decrypt("6PgNBNNzDkKdhkT6uJntUXwwzQV8Rr2tZcbkDcuC9DZRsS6AtHts4Ypo1j", "MOLON LABE"); assertEquals(decoded.toString(), "5JLdxTtcTHcfYcmJsNVy1v2PMDx432JPoYcBTVVRHpPaxUrdtf8"); }
Example 15
Source File: Bip38Test.java From bitherj with Apache License 2.0 | 4 votes |
@Test public void testDecryptNoCompressionWithEcMultiplyWithLot1WithBom() throws InterruptedException, AddressFormatException { SecureCharSequence decoded = Bip38.decrypt("\uFEFF6PgNBNNzDkKdhkT6uJntUXwwzQV8Rr2tZcbkDcuC9DZRsS6AtHts4Ypo1j", "MOLON LABE"); assertEquals(decoded.toString(), "5JLdxTtcTHcfYcmJsNVy1v2PMDx432JPoYcBTVVRHpPaxUrdtf8"); }