Beispiel #1
0
        public byte[] CalculateCommonSecret(NasECKey publicKey)
        {
            var agreement = new ECDHBasicAgreement();

            agreement.Init(_ecKey.PrivateKey);
            var z = agreement.CalculateAgreement(publicKey._ecKey.GetPublicKeyParameters());

            return(BigIntegers.AsUnsignedByteArray(agreement.GetFieldSize(), z));
        }
Beispiel #2
0
        public static string GetPublicAddress(string privateKey)
        {
            var key = new NasECKey(privateKey.HexToByteArray(), true);

            return(key.GetPublicAddress());
        }