Verify() public static method

Verifies the signature using the SecurityPolicyUri and return true if valid.
public static Verify ( X509Certificate2 certificate, string securityPolicyUri, byte dataToVerify, SignatureData signature ) : bool
certificate X509Certificate2
securityPolicyUri string
dataToVerify byte
signature SignatureData
return bool
Beispiel #1
0
        /// <summary>
        /// Verifies a signature created with the token.
        /// </summary>
        public override bool Verify(byte[] dataToVerify, SignatureData signatureData, string securityPolicyUri)
        {
            try
            {
                X509Certificate2 certificate = m_certificate;

                if (certificate == null)
                {
                    certificate = CertificateFactory.Create(m_certificateData, true);
                }

                bool valid = SecurityPolicies.Verify(
                    certificate,
                    securityPolicyUri,
                    dataToVerify,
                    signatureData);

                m_certificateData = certificate.RawData;

                return(valid);
            }
            catch (Exception e)
            {
                throw ServiceResultException.Create(StatusCodes.BadIdentityTokenInvalid, e, "Could not verify user signature!");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Verifies a signature created with the token.
        /// </summary>
        public override bool Verify(byte[] dataToVerify, SignatureData signatureData, string securityPolicyUri)
        {
            X509Certificate2 certificate = m_certificate;

            if (certificate == null)
            {
                certificate = CertificateFactory.Create(m_certificateData, true);
            }

            bool valid = SecurityPolicies.Verify(
                certificate,
                securityPolicyUri,
                dataToVerify,
                signatureData);

            m_certificateData = certificate.GetRawCertData();

            return(valid);
        }
Beispiel #3
0
        /// <summary>
        /// Verifies a signature created with the token.
        /// </summary>
        public override bool Verify(byte[] dataToVerify, SignatureData signatureData, string securityPolicyUri)
        {
            X509Certificate2 certificate = m_certificate;

            if (certificate == null)
            {
                certificate = new X509Certificate2(m_certificateData);
            }

            bool valid = SecurityPolicies.Verify(
                certificate,
                securityPolicyUri,
                dataToVerify,
                signatureData);

            m_certificateData = certificate.RawData;

            return(valid);
        }