Esempio n. 1
0
        public static bool VerifySignedMessage(this IVerifier sig, IDigest digest, ArraySegment <byte> message)
        {
            if (message.Count <= sig.SignatureSize)
            {
                throw new InvalidOperationException("The message size is smaller than or equal to the size of a signature");
            }

            var hash = digest.ComputeDigest(
                new ArraySegment <byte>(message.Array, message.Offset, message.Count - sig.SignatureSize));

            return(sig.Verify(
                       new ArraySegment <byte>(hash),
                       new ArraySegment <byte>(message.Array, message.Offset + message.Count - sig.SignatureSize, sig.SignatureSize)));
        }
Esempio n. 2
0
        public object Execute(params string[] args)
        {
            if (args is null)
            {
                ThrowNotEnoughParams(0);
            }
            else if (args.Length < 2)
            {
                ThrowNotEnoughParams(args.Length);
            }
            var levelId = args[0];
            var user    = args[1];
            var level   = provider.GetLevel(levelId);

            return(verifier.Verify(level, user));
        }
Esempio n. 3
0
        public VerificationResultDto Verify(int loanId)
        {
            VerificationResultDto result;
            // Move logic to _loanService

            // Step 1: Load loan data from Database (Moq data)
            Loan loan = MoqLoanData().FirstOrDefault(x => x.Id == loanId);

            if (loan != null)
            {
                // Step 2: Verify loan
                IVerifier verifier = GetVerifier(loan.Address.State);
                result = verifier.Verify(loan);
            }
            else
            {
                throw new System.Exception($"Requested Loan with id = {loanId} has been deleted or doesn't exist.");
            }

            return(result);
        }
Esempio n. 4
0
 public static bool Verify(this IVerifier sig, byte[] data, int offset, int count, ArraySegment <byte> signature) =>
 sig.Verify(new ArraySegment <byte>(data, offset, count), signature);
Esempio n. 5
0
 public static bool Verify(this IVerifier sig, byte[] data, ArraySegment <byte> signature) =>
 sig.Verify(new ArraySegment <byte>(data), signature);
 public bool Verify()
 {
     return(_verifier.Verify(Storage));
 }
Esempio n. 7
0
 public bool Verify(ArraySegment <byte> data, ArraySegment <byte> signature) =>
 _verifier.Verify(data, signature);
 public bool Verify(string input)
 {
     return(verifier.Verify(input));
 }