Пример #1
0
        public PublicKey?MakePublicKey(PublicKey?publicKey, BinaryPrivateKey privateKey)
        {
            if (publicKey?.Type != null && publicKey?.Value != null)
            {
                return(publicKey);
            }

            if (publicKey?.Value != null)
            {
                if (IsSecp256k1(publicKey.Type))
                {
                    var parsedKey = ParseSecp256k1PublicKey(publicKey);
                    if (parsedKey != null)
                    {
                        return(parsedKey);
                    }
                }
            }

            if (IsSecp256k1(privateKey.Type))
            {
                return(MakeSecp256k1PublicKey(privateKey.Value));
            }

            return(null);
        }
Пример #2
0
        public byte[] Sign(byte[] bytesToSign, BinaryPrivateKey key)
        {
            if (IsSecp256k1(key.Type))
            {
                return(SignSecp256k1(bytesToSign, key.Value));
            }

            throw new NotSupportedException($"Unknown key type {key.Type}");
        }