ECDSAPrivateKey.fromBytes constructor
ECDSAPrivateKey.fromBytes(
- List<
int> bytes, - ProjectiveECCPoint curve
Creates an ECDSA private key from bytes.
Parameters:
- bytes: A byte representation of the private key.
- curve: The elliptic curve used for the key pair.
Returns: An ECDSA private key.
Implementation
factory ECDSAPrivateKey.fromBytes(List<int> bytes, ProjectiveECCPoint curve) {
if (bytes.length != curve.curve.baselen) {
throw const ArgumentException("Invalid length of private key");
}
final secexp = BigintUtils.fromBytes(bytes, byteOrder: Endian.big);
final ECDSAPublicKey publicKey = ECDSAPublicKey(curve, curve * secexp);
return ECDSAPrivateKey._(publicKey, secexp);
}