SignerInfo.CheckSignature 方法

定义

验证消息的数字签名。Verifies the digital signature of the message.

重载

CheckSignature(Boolean)

CheckSignature(Boolean) 方法对消息的数字签名进行验证,并对证书进行验证(可选)。The CheckSignature(Boolean) method verifies the digital signature of the message and, optionally, validates the certificate.

CheckSignature(X509Certificate2Collection, Boolean)

CheckSignature(X509Certificate2Collection, Boolean) 方法通过使用指定的证书集合对消息的数字签名进行验证,并对证书进行验证(可选)。The CheckSignature(X509Certificate2Collection, Boolean) method verifies the digital signature of the message by using the specified collection of certificates and, optionally, validates the certificate.

CheckSignature(Boolean)

CheckSignature(Boolean) 方法对消息的数字签名进行验证,并对证书进行验证(可选)。The CheckSignature(Boolean) method verifies the digital signature of the message and, optionally, validates the certificate.

public:
 void CheckSignature(bool verifySignatureOnly);
public void CheckSignature (bool verifySignatureOnly);
member this.CheckSignature : bool -> unit
Public Sub CheckSignature (verifySignatureOnly As Boolean)

参数

verifySignatureOnly
Boolean

一个指定是否仅验证数字签名的布尔值。A bool value that specifies whether only the digital signature is verified. 如果 verifySignatureOnlytrue,则仅验证签名。If verifySignatureOnly is true, only the signature is verified. 如果 verifySignatureOnlyfalse,则将对数字签名、证书链和证书的用途进行验证。If verifySignatureOnly is false, the digital signature is verified, the certificate chain is validated, and the purposes of the certificates are validated. 如果证书没有密钥用法或如果密钥用法支持数字签名或认可,则认为该证书的用途有效。The purposes of the certificate are considered valid if the certificate has no key usage or if the key usage supports digital signature or nonrepudiation.

例外

向不接受空引用作为有效参数的方法传递了一个空引用。A null reference was passed to a method that does not accept it as a valid argument.

未能完成加密操作。A cryptographic operation could not be completed.

一个方法调用对于对象的当前状态无效。A method call was invalid for the object's current state.

注解

如果数字签名验证失败或未满足任何验证要求,此方法将引发异常。This method throws an exception if the verification of the digital signature fails or any validation requirements are not met.

如果需要更复杂的验证,调用方可以指定只验证签名,然后使用 X509Chain 对象来执行自定义验证。If more complex validation is required, the caller can specify that only the signature is verified and then use an X509Chain object to perform custom validation.

适用于

CheckSignature(X509Certificate2Collection, Boolean)

CheckSignature(X509Certificate2Collection, Boolean) 方法通过使用指定的证书集合对消息的数字签名进行验证,并对证书进行验证(可选)。The CheckSignature(X509Certificate2Collection, Boolean) method verifies the digital signature of the message by using the specified collection of certificates and, optionally, validates the certificate.

public:
 void CheckSignature(System::Security::Cryptography::X509Certificates::X509Certificate2Collection ^ extraStore, bool verifySignatureOnly);
public void CheckSignature (System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore, bool verifySignatureOnly);
member this.CheckSignature : System.Security.Cryptography.X509Certificates.X509Certificate2Collection * bool -> unit
Public Sub CheckSignature (extraStore As X509Certificate2Collection, verifySignatureOnly As Boolean)

参数

extraStore
X509Certificate2Collection

可用于验证链的 X509Certificate2Collection 对象。An X509Certificate2Collection object that can be used to validate the chain. 如果没有其他要用于验证链的证书,则应使用 CheckSignature(Boolean) 而不应使用 CheckSignature(X509Certificate2Collection, Boolean)If no additional certificates are to be used to validate the chain, use CheckSignature(Boolean) instead of CheckSignature(X509Certificate2Collection, Boolean).

verifySignatureOnly
Boolean

一个指定是否仅验证数字签名的布尔值。A bool value that specifies whether only the digital signature is verified. 如果 verifySignatureOnlytrue,则仅验证签名。If verifySignatureOnly is true, only the signature is verified. 如果 verifySignatureOnlyfalse,则将对数字签名、证书链和证书的用途进行验证。If verifySignatureOnly is false, the digital signature is verified, the certificate chain is validated, and the purposes of the certificates are validated. 如果证书没有密钥用法或如果密钥用法支持数字签名或认可,则认为该证书的用途有效。The purposes of the certificate are considered valid if the certificate has no key usage or if the key usage supports digital signature or nonrepudiation.

例外

向不接受空引用作为有效参数的方法传递了一个空引用。A null reference was passed to a method that does not accept it as a valid argument.

未能完成加密操作。A cryptographic operation could not be completed.

一个方法调用对于对象的当前状态无效。A method call was invalid for the object's current state.

注解

如果数字签名验证失败或未满足任何验证要求,此方法将引发异常。This method throws an exception if the verification of the digital signature fails or any validation requirements are not met.

如果需要更复杂的验证,调用方可以指定只验证签名,然后使用 X509Chain 对象来执行自定义验证。If more complex validation is required, the caller can specify that only the signature is verified and then use an X509Chain object to perform custom validation.

适用于