Example #1
0
        public void VerifierTest()
        {
            var signature = "tPmCXbpIf-lR2sOJrlB3wviI-mybLwKomo6Vh3Lxaf9RmS7FDiL5zdDxa8m5JvoVBMW4MnqHn5zUaKecESjjBQ";
            var payload   = "{\"type\":\"EMAIL\",\"value\":\"123\"}";
            var verifier  = new Ed25519Veifier("ypQFEgdQe-E8u1dtpmAhAE0EoaGdvP5lNc0P4wgY2DA");

            verifier.Verify(payload, signature);
        }
Example #2
0
        /// <summary>
        /// Verify the signature of the payload.
        /// </summary>
        /// <param name="member">Member.</param>
        /// <param name="payload">Payload.</param>
        /// <param name="signature">Signature.</param>
        public static void VerifySignature(
            ProtoMember member,
            IMessage payload,
            Signature signature)
        {
            Key key;

            try
            {
                key = member.Keys.Single(k => k.Id.Equals(signature.KeyId));
            }
            catch (InvalidOperationException)
            {
                throw new CryptoKeyNotFoundException(signature.KeyId);
            }

            var verifier = new Ed25519Veifier(key.PublicKey);

            verifier.Verify(payload, signature.Signature_);
        }