当前位置: 首页>>代码示例>>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;未经允许,请勿转载。