use of org.fisco.bcos.web3j.crypto.ECKeyPair in project web3sdk by FISCO-BCOS.
the class PEMManager method getECKeyPair.
public ECKeyPair getECKeyPair() throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException {
PrivateKey privateKey = getPrivateKey();
PublicKey publicKey = getPublicKey();
KeyPair keyPair = new KeyPair(publicKey, privateKey);
return ECKeyPair.create(keyPair);
}
use of org.fisco.bcos.web3j.crypto.ECKeyPair in project web3sdk by FISCO-BCOS.
the class P12Manager method getECKeyPair.
public ECKeyPair getECKeyPair() throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException {
PrivateKey privateKey = getPrivateKey();
PublicKey publicKey = getPublicKey();
KeyPair keyPair = new KeyPair(publicKey, privateKey);
return ECKeyPair.create(keyPair);
}
use of org.fisco.bcos.web3j.crypto.ECKeyPair in project web3sdk by FISCO-BCOS.
the class GenCredential method createGuomiKeyPair.
public static ECKeyPair createGuomiKeyPair() {
final SM2KeyGenerator generator = new SM2KeyGenerator();
final KeyPair keyPairData = generator.generateKeyPair();
if (keyPairData != null)
return genEcPairFromKeyPair(keyPairData);
return null;
}
use of org.fisco.bcos.web3j.crypto.ECKeyPair in project web3sdk by FISCO-BCOS.
the class GenCredential method createECDSAKeyPair.
public static ECKeyPair createECDSAKeyPair(String privKey) {
try {
BigInteger bigPrivKey = new BigInteger(privKey, 16);
ECKeyPair keyPair = ECKeyPair.create(bigPrivKey);
return keyPair;
} catch (Exception e) {
logger.error("create keypair of ECDSA failed, error msg:" + e.getMessage());
return null;
}
}
use of org.fisco.bcos.web3j.crypto.ECKeyPair in project web3sdk by FISCO-BCOS.
the class GenCredential method create.
public static Credentials create() {
try {
ECKeyPair keyPair = createKeyPair();
if (keyPair == null)
return null;
Credentials credentials = Credentials.create(keyPair);
logger.debug(" privateKey: {}, publicKey: {}, address: {}", credentials.getEcKeyPair().getPrivateKey(), credentials.getEcKeyPair().getPrivateKey(), credentials.getAddress());
return credentials;
} catch (Exception e) {
System.out.println("init credential failed");
logger.error("init credential failed, error msg:" + e.getMessage());
return null;
}
}
Aggregations