共用方式為


Pkcs12Info.VerifyMac 方法

定義

嘗試使用密碼來驗證 AuthenticatedSafe 內容的完整性。

多載

VerifyMac(ReadOnlySpan<Char>)

嘗試使用 System.ReadOnlySpan{System.Char} 所代表的密碼來驗證 AuthenticatedSafe 內容的完整性。

VerifyMac(String)

嘗試使用 String 所代表的密碼來驗證 AuthenticatedSafe 內容的完整性。

備註

因為密碼不正確,因為內容已改變,所以無法區分錯誤。

通常,受密碼保護的 PFX 會針對提供完整性的 MAC 演算法使用相同的密碼,並提供機密性的加密演算法,但檔案格式不要求。 因此,不保證從這個方法傳回的密碼 true 會在呼叫 Decrypt 時成功。

VerifyMac(ReadOnlySpan<Char>)

來源:
Pkcs12Info.cs
來源:
Pkcs12Info.cs
來源:
Pkcs12Info.cs
來源:
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)

來源:
Pkcs12Info.cs
來源:
Pkcs12Info.cs
來源:
Pkcs12Info.cs
來源:
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.Emptyfalse 回 ,反之亦然。

適用於