Exemple #1
0
        private static ECDsa loadECDSAFromPrivateKey(AccountPrivateKey privateKey)
        {
            var ecparams = new ECParameters();

            ecparams.Curve = ECCurve.NamedCurves.nistP256;
            var ecPoint = new ECPoint();

            ecPoint.X  = XConvert.GetECBytesFromBigInteger(privateKey.X);
            ecPoint.Y  = XConvert.GetECBytesFromBigInteger(privateKey.Y);
            ecparams.Q = ecPoint;
            ecparams.D = XConvert.GetECBytesFromBigInteger(privateKey.D);
            return(ECDsa.Create(ecparams));
        }
Exemple #2
0
        private static ECDsa loadECDSAFromPublicKey(AccountPublicKey publicKey)
        {
            var param = new ECParameters
            {
                Curve = ECCurve.NamedCurves.nistP256,
                Q     = new ECPoint
                {
                    X = XConvert.GetECBytesFromBigInteger(publicKey.X),
                    Y = XConvert.GetECBytesFromBigInteger(publicKey.Y),
                },
            };

            return(ECDsa.Create(param));
        }