use of org.gudy.bouncycastle.jce.spec.ECPrivateKeySpec in project BiglyBT by BiglySoftware.
the class CryptoECCUtils method rawdataToPrivkey.
public static PrivateKey rawdataToPrivkey(byte[] input) throws CryptoManagerException {
BigInteger D = new BigInteger(input);
KeySpec keyspec = new ECPrivateKeySpec(D, (ECParameterSpec) ECCparam);
PrivateKey privkey = null;
try {
privkey = KeyFactory.getInstance("ECDSA", BouncyCastleProvider.PROVIDER_NAME).generatePrivate(keyspec);
return privkey;
} catch (Throwable e) {
throw (new CryptoManagerException("Failed to decode private key"));
}
}
Aggregations