public static byte[] Encode(this ECDSAPrivateKey key) { if (key.Buffer.Length != 32) { throw new InvalidOperationException("Corrupted private key"); } return(key.Buffer.ToByteArray()); }
public RootProtocol(RootProtocolId id, IPublicConsensusKeySet wallet, ECDSAPrivateKey privateKey, IConsensusBroadcaster broadcaster, IValidatorAttendanceRepository validatorAttendanceRepository, ulong cycleDuration, bool useNewChainId) : base(wallet, id, broadcaster) { _keyPair = new EcdsaKeyPair(privateKey); _rootId = id; _validatorAttendanceRepository = validatorAttendanceRepository; _cycleDuration = cycleDuration; _useNewChainId = useNewChainId; }
public static string ToHex(this ECDSAPrivateKey key, bool prefix = true) { return(key.Buffer.ToHex(prefix)); }
public EcdsaKeyPair(ECDSAPrivateKey privateKey) { PrivateKey = privateKey; PublicKey = privateKey.GetPublicKey(); }
public EcdsaKeyPair(ECDSAPrivateKey privateKey, ECDSAPublicKey publicKey) { PrivateKey = privateKey; PublicKey = publicKey; }
private static IEnumerable <Fr> DecryptRow(byte[] encryptedRow, ECDSAPrivateKey privateKey) { return(Crypto.Secp256K1Decrypt(privateKey.Encode(), encryptedRow) .Batch(Fr.ByteSize) .Select(b => Fr.FromBytes(b.ToArray()))); }
public static ECDSAPublicKey GetPublicKey(this ECDSAPrivateKey key) { return(Crypto.ComputePublicKey(key.Encode(), true).ToPublicKey()); }