summary refs log tree commit diff
path: root/crypto/src/crypto/IVerifier.cs
blob: 5e80b55d55a1557470a1c741d22298eb2876eab4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;

namespace Org.BouncyCastle.Crypto
{
    /// <summary>
    /// Operators that reduce their input to the validation of a signature produce this type.
    /// </summary>
    public interface IVerifier
    {
        /// <summary>
        /// Return true if the passed in data matches what is expected by the verification result.
        /// </summary>
        /// <param name="data">The bytes representing the signature.</param>
        /// <returns>true if the signature verifies, false otherwise.</returns>
        bool IsVerified(byte[] data);

        /// <summary>
        /// Return true if the length bytes from off in the source array match the signature
        /// expected by the verification result.
        /// </summary>
        /// <param name="source">Byte array containing the signature.</param>
        /// <param name="off">The offset into the source array where the signature starts.</param>
        /// <param name="length">The number of bytes in source making up the signature.</param>
        /// <returns>true if the signature verifies, false otherwise.</returns>
        bool IsVerified(byte[] source, int off, int length);

#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
        // TODO[api]
        //bool IsVerified(ReadOnlySpan<byte> data);
#endif
    }
}