當前位置: 首頁>>代碼示例>>Java>>正文


Java Bip38類代碼示例

本文整理匯總了Java中net.bither.bitherj.crypto.bip38.Bip38的典型用法代碼示例。如果您正苦於以下問題:Java Bip38類的具體用法?Java Bip38怎麽用?Java Bip38使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Bip38類屬於net.bither.bitherj.crypto.bip38包,在下文中一共展示了Bip38類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onClick

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
@Override
public void onClick(View v) {
    if (v.getId() == R.id.btn_ok) {
        String s = et.getText().toString();
        if (Utils.isEmpty(s)) {
            tvError.setVisibility(View.VISIBLE);
            shake();
            return;
        }
        try {
            if (!Bip38.isBip38PrivateKey(s)) {
                tvError.setVisibility(View.VISIBLE);
                shake();
                return;
            }
            bip38KeyString = et.getText().toString();
            dismiss();

        } catch (AddressFormatException e) {
            tvError.setVisibility(View.VISIBLE);
            e.printStackTrace();
        }
    } else {
        dismiss();
    }
}
 
開發者ID:bither,項目名稱:bither-android,代碼行數:27,代碼來源:DialogImportBip38KeyText.java

示例2: showBip38Password

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
private void showBip38Password() {
    DialogPasswordWithOther d = new DialogPasswordWithOther(getContext(), bip38IDialogPasswordListener);
    d.setCheckPre(false);
    d.setTitle(R.string.enter_bip38_key_password);
    d.setCheckPasswordListener(new ICheckPasswordListener() {
        @Override
        public boolean checkPassword(SecureCharSequence password) {
            try {
                decode = Bip38.decrypt(bip38KeyString, password).toString();
                return decode != null;
            } catch (Exception e) {
                e.printStackTrace();
                return false;
            }
        }
    });
    d.show();
}
 
開發者ID:bither,項目名稱:bither-android,代碼行數:19,代碼來源:DialogImportBip38KeyText.java

示例3: getBIP38PrivateKeyString

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
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;
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:18,代碼來源:PrivateKeyUtil.java

示例4: onPasswordEntered

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
@Override
public void onPasswordEntered(SecureCharSequence password) {
    if (password == null) {
        return;
    }
    ImportPrivateKeyDesktop importPrivateKey = new ImportPrivateKeyDesktop(
            ImportPrivateKey.ImportPrivateKeyType.Bip38, bip38DecodeString, password);
    importPrivateKey.importPrivateKey();
}
 
開發者ID:bither,項目名稱:bither-desktop-java,代碼行數:10,代碼來源:ImportPrivateKeyPanel.java

示例5: testEncryptNoCompression

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
@Test
public void testEncryptNoCompression() throws InterruptedException, AddressFormatException {
    String encoded = Bip38.encryptNoEcMultiply("TestingOneTwoThree",
            "5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR");
    assertEquals(encoded, "6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg");
    assertTrue(Bip38.isBip38PrivateKey(encoded));
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:8,代碼來源:Bip38Test.java

示例6: testEncryptCompression1

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
@Test
public void testEncryptCompression1() throws InterruptedException, AddressFormatException {
    String encoded = Bip38.encryptNoEcMultiply("TestingOneTwoThree",
            "L44B5gGEpqEDRS9vVPz7QT35jcBG2r3CZwSwQ4fCewXAhAhqGVpP");
    assertEquals(encoded, "6PYNKZ1EAgYgmQfmNVamxyXVWHzK5s6DGhwP4J5o44cvXdoY7sRzhtpUeo");
    assertTrue(Bip38.isBip38PrivateKey(encoded));
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:8,代碼來源:Bip38Test.java

示例7: testEncryptCompression2

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
@Test
public void testEncryptCompression2() throws InterruptedException, AddressFormatException {
    String encoded = Bip38.encryptNoEcMultiply("Satoshi", "KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7"
    );
    assertEquals(encoded, "6PYLtMnXvfG3oJde97zRyLYFZCYizPU5T3LwgdYJz1fRhh16bU7u6PPmY7");
    assertTrue(Bip38.isBip38PrivateKey(encoded));
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:8,代碼來源:Bip38Test.java

示例8: testDecryptNoCompressionWithEcMultiplyWithLot2

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
@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");
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:9,代碼來源:Bip38Test.java

示例9: testDecryptNoCompressionWithEcMultiplyWithLot2WithBom

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
@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");
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:9,代碼來源:Bip38Test.java

示例10: onPasswordEntered

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
@Override
public void onPasswordEntered(SecureCharSequence password) {
    ImportPrivateKeyDesktop importPrivateKey = new ImportPrivateKeyDesktop(
            ImportPrivateKey.ImportPrivateKeyType.Bip38, bip38DecodeString, password);
    importPrivateKey.importPrivateKey();
}
 
開發者ID:bither,項目名稱:bither-desktop-java,代碼行數:7,代碼來源:ImportBIP38PrivateTextDialog.java

示例11: onPasswordEntered

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
@Override
public void onPasswordEntered(final SecureCharSequence password) {
    ImportPrivateKeyAndroid importPrivateKey = new ImportPrivateKeyAndroid(activity,
            ImportPrivateKey.ImportPrivateKeyType.Bip38, pd, decode, password);
    importPrivateKey.importPrivateKey();
}
 
開發者ID:bither,項目名稱:bither-android,代碼行數:7,代碼來源:DialogImportBip38KeyText.java

示例12: onPasswordEntered

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
@Override
public void onPasswordEntered(SecureCharSequence password) {
    ImportPrivateKeyAndroid importPrivateKey = new ImportPrivateKeyAndroid(ColdAdvanceActivity.this,
            ImportPrivateKey.ImportPrivateKeyType.Bip38, dp, bip38DecodeString, password);
    importPrivateKey.importPrivateKey();
}
 
開發者ID:bither,項目名稱:bither-android,代碼行數:7,代碼來源:ColdAdvanceActivity.java

示例13: onPasswordEntered

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
@Override
public void onPasswordEntered(SecureCharSequence password) {
    ImportPrivateKeyAndroid importPrivateKey = new ImportPrivateKeyAndroid(HotAdvanceActivity.this,
            ImportPrivateKey.ImportPrivateKeyType.Bip38, dp, bip38DecodeString, password);
    importPrivateKey.importPrivateKey();
}
 
開發者ID:bither,項目名稱:bither-android,代碼行數:7,代碼來源:HotAdvanceActivity.java

示例14: testDecryptNoCompression

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
@Test
public void testDecryptNoCompression() throws InterruptedException, AddressFormatException {
    SecureCharSequence decoded = Bip38.decrypt("6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg",
            "TestingOneTwoThree");
    assertEquals(decoded.toString(), "5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR");
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:7,代碼來源:Bip38Test.java

示例15: testDecryptNoCompressionWithBom

import net.bither.bitherj.crypto.bip38.Bip38; //導入依賴的package包/類
@Test
public void testDecryptNoCompressionWithBom() throws InterruptedException, AddressFormatException {
    SecureCharSequence decoded = Bip38.decrypt("\uFEFF6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg",
            "TestingOneTwoThree");
    assertEquals(decoded.toString(), "5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR");
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:7,代碼來源:Bip38Test.java


注:本文中的net.bither.bitherj.crypto.bip38.Bip38類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。