本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例8: getECKey
import net.bither.bitherj.utils.PrivateKeyUtil; //导入方法依赖的package包/类
public ECKey getECKey(CharSequence password) {
return PrivateKeyUtil.getECKeyFromSingleString(keyStr, password);
}
示例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;
}