当前位置: 首页>>代码示例>>Java>>正文


Java PrivateKeyUtil.getECKeyFromSingleString方法代码示例

本文整理汇总了Java中net.bither.bitherj.utils.PrivateKeyUtil.getECKeyFromSingleString方法的典型用法代码示例。如果您正苦于以下问题:Java PrivateKeyUtil.getECKeyFromSingleString方法的具体用法?Java PrivateKeyUtil.getECKeyFromSingleString怎么用?Java PrivateKeyUtil.getECKeyFromSingleString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.bither.bitherj.utils.PrivateKeyUtil的用法示例。


在下文中一共展示了PrivateKeyUtil.getECKeyFromSingleString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getEckeyFormBackupHot

import net.bither.bitherj.utils.PrivateKeyUtil; //导入方法依赖的package包/类
private static ECKey getEckeyFormBackupHot(String address, CharSequence password) {
    File file = FileUtil.getBackupFile();
    String str = Utils.readFile(file);
    if (str.contains(address)) {
        String[] backupStrArray = str.split(PrivateKeyUtil.BACKUP_KEY_SPLIT_MUTILKEY_STRING);
        for (String backupStr : backupStrArray) {
            if (backupStr.contains(address)) {
                String[] strArray = QRCodeUtil.splitString(backupStr);
                if (strArray.length > 3) {
                    String keyString = backupStr.substring(strArray[0]
                            .length() + 1);
                    return PrivateKeyUtil.getECKeyFromSingleString(
                            keyString, password);
                }
            }
        }
    }
    return null;
}
 
开发者ID:bither,项目名称:bither-desktop-java,代码行数:20,代码来源:BackupUtil.java

示例2: getEckeyFormBackupHot

import net.bither.bitherj.utils.PrivateKeyUtil; //导入方法依赖的package包/类
private static ECKey getEckeyFormBackupHot(String address, CharSequence password) {
    File file = FileUtil.getBackupKeyOfHot();
    String str = Utils.readFile(file);
    if (str.contains(address)) {
        String[] backupStrArray = str.split(PrivateKeyUtil.BACKUP_KEY_SPLIT_MUTILKEY_STRING);
        for (String backupStr : backupStrArray) {
            if (backupStr.contains(address)) {
                String[] strArray = QRCodeUtil.splitString(backupStr);
                if (strArray.length > 3) {
                    String keyString = backupStr.substring(strArray[0]
                            .length() + 1);
                    return PrivateKeyUtil.getECKeyFromSingleString(
                            keyString, password);
                }
            }
        }
    }
    return null;
}
 
开发者ID:bither,项目名称:bither-android,代码行数:20,代码来源:BackupUtil.java

示例3: getEckey

import net.bither.bitherj.utils.PrivateKeyUtil; //导入方法依赖的package包/类
private ECKey getEckey() {
    ECKey ecKey = null;
    DumpedPrivateKey dumpedPrivateKey = null;
    try {
        switch (this.importPrivateKeyType) {
            case Text:
                dumpedPrivateKey = new DumpedPrivateKey(this.content);
                ecKey = dumpedPrivateKey.getKey();
                break;
            case BitherQrcode:
                ecKey = PrivateKeyUtil.getECKeyFromSingleString(content, password);
                break;
            case Bip38:
                dumpedPrivateKey = new DumpedPrivateKey(this.content);
                ecKey = dumpedPrivateKey.getKey();
                break;
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (dumpedPrivateKey != null) {
            dumpedPrivateKey.clearPrivateKey();
        }
    }
    return ecKey;
}
 
开发者ID:bither,项目名称:bitherj,代码行数:27,代码来源:ImportPrivateKey.java

示例4: signHashes

import net.bither.bitherj.utils.PrivateKeyUtil; //导入方法依赖的package包/类
public List<byte[]> signHashes(List<byte[]> unsignedInHashes, CharSequence passphrase) throws
        PasswordException {
    ECKey key = PrivateKeyUtil.getECKeyFromSingleString(this.getFullEncryptPrivKey(), passphrase);
    if (key == null) {
        throw new PasswordException("do not decrypt eckey");
    }
    KeyParameter assKey = key.getKeyCrypter().deriveKey(passphrase);
    List<byte[]> result = new ArrayList<byte[]>();
    for (byte[] unsignedInHash : unsignedInHashes) {
        TransactionSignature signature = new TransactionSignature(key.sign(unsignedInHash,
                assKey), TransactionSignature.SigHash.ALL, false);
        result.add(ScriptBuilder.createInputScript(signature, key).getProgram());
    }
    key.clearPrivateKey();
    return result;
}
 
开发者ID:bither,项目名称:bitherj,代码行数:17,代码来源:Address.java

示例5: getEckeyFormBackupCold

import net.bither.bitherj.utils.PrivateKeyUtil; //导入方法依赖的package包/类
private static ECKey getEckeyFormBackupCold(String address, CharSequence password) {

        try {
            File[] files = FileUtil.getBackupDir().listFiles();
            if (files == null) {
                return null;
            }
            files = FileUtil.orderByDateDesc(files);
            for (int i = files.length - 1;
                 i >= 0;
                 i++) {
                File file = files[i];
                String str = Utils.readFile(file);
                if (str.contains(address)) {
                    String[] backupStrArray = str.split(PrivateKeyUtil.BACKUP_KEY_SPLIT_MUTILKEY_STRING);
                    for (String backupStr : backupStrArray) {
                        if (backupStr.contains(address)) {
                            String[] strArray = QRCodeUtil.splitString(backupStr);
                            if (strArray.length > 3) {
                                String keyString = backupStr
                                        .substring(strArray[0].length() + 1);
                                return PrivateKeyUtil.getECKeyFromSingleString(
                                        keyString, password);
                            }
                        }
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;

    }
 
开发者ID:bither,项目名称:bither-desktop-java,代码行数:35,代码来源:BackupUtil.java

示例6: getEckeyFormBackupCold

import net.bither.bitherj.utils.PrivateKeyUtil; //导入方法依赖的package包/类
private static ECKey getEckeyFormBackupCold(String address, CharSequence password) {
    if (!FileUtil.existSdCardMounted()) {
        return null;
    }
    try {
        File[] files = FileUtil.getBackupSdCardDir().listFiles();
        if (files == null) {
            return null;
        }
        files = FileUtil.orderByDateDesc(files);
        for (int i = files.length - 1;
             i >= 0;
             i++) {
            File file = files[i];
            String str = Utils.readFile(file);
            if (str.contains(address)) {
                String[] backupStrArray = str.split(PrivateKeyUtil.BACKUP_KEY_SPLIT_MUTILKEY_STRING);
                for (String backupStr : backupStrArray) {
                    if (backupStr.contains(address)) {
                        String[] strArray = QRCodeUtil.splitString(backupStr);
                        if (strArray.length > 3) {
                            String keyString = backupStr
                                    .substring(strArray[0].length() + 1);
                            return PrivateKeyUtil.getECKeyFromSingleString(
                                    keyString, password);
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;

}
 
开发者ID:bither,项目名称:bither-android,代码行数:37,代码来源:BackupUtil.java

示例7: checkPassword

import net.bither.bitherj.utils.PrivateKeyUtil; //导入方法依赖的package包/类
public boolean checkPassword(CharSequence password) {
    ECKey ecKey = PrivateKeyUtil.getECKeyFromSingleString(keyStr, password);
    String ecKeyAddress;
    if (ecKey == null) {
        return false;
    } else {
        ecKeyAddress = ecKey.toAddress();
        ecKey.clearPrivateKey();
    }
    return Utils.compareString(this.address,
            ecKeyAddress);

}
 
开发者ID:bither,项目名称:bitherj,代码行数:14,代码来源:PasswordSeed.java

示例8: getECKey

import net.bither.bitherj.utils.PrivateKeyUtil; //导入方法依赖的package包/类
public ECKey getECKey(CharSequence password) {
    return PrivateKeyUtil.getECKeyFromSingleString(keyStr, password);
}
 
开发者ID:bither,项目名称:bitherj,代码行数:4,代码来源:PasswordSeed.java

示例9: signMessage

import net.bither.bitherj.utils.PrivateKeyUtil; //导入方法依赖的package包/类
public String signMessage(String msg, CharSequence passphrase) {

        ECKey key = PrivateKeyUtil.getECKeyFromSingleString(this.getFullEncryptPrivKey(), passphrase);
        if (key == null) {
            throw new PasswordException("do not decrypt eckey");
        }
        KeyParameter assKey = key.getKeyCrypter().deriveKey(passphrase);

        String result = key.signMessage(msg, assKey);


        key.clearPrivateKey();
        return result;


    }
 
开发者ID:bither,项目名称:bitherj,代码行数:17,代码来源:Address.java


注:本文中的net.bither.bitherj.utils.PrivateKeyUtil.getECKeyFromSingleString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。