Exemplo n.º 1
0
        public byte[] Sign(params string[] toSign)
        {
            if (toSign == null)
            {
                throw new ArgumentNullException(nameof(toSign));
            }

            byte[] hash      = new SignatureHasher().Hash(toSign);
            byte[] signature = _privateKey.TransformRaw(hash);

            return(signature);
        }
Exemplo n.º 2
0
        public bool Verify(byte[] signature, params string[] toVerify)
        {
            if (signature == null)
            {
                throw new ArgumentNullException(nameof(signature));
            }
            if (toVerify == null)
            {
                throw new ArgumentNullException(nameof(toVerify));
            }

            byte[] hashToVerify = new SignatureHasher().Hash(toVerify);

            byte[] hash = _publicKey.TransformRaw(signature, hashToVerify.Length);

            return(hash.IsEquivalentTo(0, hashToVerify, 0, hashToVerify.Length));
        }