Pkcs12Info.VerifyMac 方法

定义

尝试使用密码验证 AuthenticatedSafe 内容的完整性。

重载

VerifyMac(ReadOnlySpan<Char>)

尝试使用由 System.ReadOnlySpan{System.Char} 表示的密码验证 AuthenticatedSafe 内容的完整性。

VerifyMac(String)

尝试使用由 String 表示的密码验证 AuthenticatedSafe 内容的完整性。

注解

由于密码不正确,无法区分由于内容已更改而导致的错误。

通常,受密码保护的 PFX 对提供完整性的 MAC 算法和提供机密性的加密算法使用相同的密码,但文件格式不要求这样做。 因此,不能保证导致此方法返回的密码 true 在调用 Decrypt时会成功。

VerifyMac(ReadOnlySpan<Char>)

Source:
Pkcs12Info.cs
Source:
Pkcs12Info.cs
Source:
Pkcs12Info.cs

尝试使用由 System.ReadOnlySpan{System.Char} 表示的密码验证 AuthenticatedSafe 内容的完整性。

public:
 bool VerifyMac(ReadOnlySpan<char> password);
public bool VerifyMac (ReadOnlySpan<char> password);
member this.VerifyMac : ReadOnlySpan<char> -> bool
Public Function VerifyMac (password As ReadOnlySpan(Of Char)) As Boolean

参数

password
ReadOnlySpan<Char>

用于尝试验证完整性的密码。

返回

如果密码成功验证了 AuthenticatedSafe 内容的完整性,则为 true;如果密码不正确或内容已更改,则为 false

例外

PKCS#12 PFX 内容指定的哈希算法选项无法识别或不受此平台支持。

注解

在 PKCS#12 规范中,对密码和“空”密码进行了 null 区分,这种差异反映在此方法的返回值中。 ReadOnlySpan<Char>.Empty 表示密码, null 表示 String.Empty.AsSpan() “空”密码。 如果这两个值之一返回 true,则另一个值不会返回 。

适用于

VerifyMac(String)

Source:
Pkcs12Info.cs
Source:
Pkcs12Info.cs
Source:
Pkcs12Info.cs

尝试使用由 String 表示的密码验证 AuthenticatedSafe 内容的完整性。

public:
 bool VerifyMac(System::String ^ password);
public bool VerifyMac (string password);
public bool VerifyMac (string? password);
member this.VerifyMac : string -> bool
Public Function VerifyMac (password As String) As Boolean

参数

password
String

用于尝试验证完整性的密码。

返回

如果密码成功验证了 AuthenticatedSafe 内容的完整性,则为 true;如果密码不正确或内容已更改,则为 false

例外

PKCS#12 PFX 内容指定的哈希算法选项无法识别或不受此平台支持。

注解

在 PKCS#12 规范中,对密码和“空”密码进行了 null 区分,这种差异反映在此方法的返回值中。 null如果字符串返回 true,则String.Empty返回 false,反之亦然。

适用于