Pkcs12Info.VerifyMac Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Attempts to verify the integrity of the AuthenticatedSafe contents with a password.
Overloads
VerifyMac(ReadOnlySpan<Char>) |
Attempts to verify the integrity of the AuthenticatedSafe contents with a password represented by a |
VerifyMac(String) |
Attempts to verify the integrity of the AuthenticatedSafe contents with a password represented by a String. |
Remarks
It's not possible to distinguish the error due to the password being incorrect from the error due to the contents having been altered.
It's usually the case that a password-protected PFX uses the same password for the MAC algorithm providing integrity and the encryption algorithm providing confidentiality,
but the file format doesn't make that a requirement.
Therefore, there is no guarantee that a password which results in a true
return from this method will succeed on a call to Decrypt.
VerifyMac(ReadOnlySpan<Char>)
- Source:
- Pkcs12Info.cs
- Source:
- Pkcs12Info.cs
- Source:
- Pkcs12Info.cs
- Source:
- Pkcs12Info.cs
- Source:
- Pkcs12Info.cs
Attempts to verify the integrity of the AuthenticatedSafe contents with a password represented by a System.ReadOnlySpan{System.Char}
.
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
Parameters
- password
- ReadOnlySpan<Char>
The password to use to attempt to verify integrity.
Returns
true
if the password successfully verifies the integrity of the AuthenticatedSafe contents; false
if the password is not correct or the contents have been altered.
Exceptions
The IntegrityMode value is not Password.
The hash algorithm option specified by the PKCS#12 PFX contents could not be identified or is not supported by this platform.
Remarks
In the PKCS#12 specification, a distinction is made between a null
password and an "empty" password, and that difference is reflected in the return value of this method.
ReadOnlySpan<Char>.Empty
represents the null
password and String.Empty.AsSpan()
represents the "empty" password. If one of those two values returns true
, the other won't.
Applies to
VerifyMac(String)
- Source:
- Pkcs12Info.cs
- Source:
- Pkcs12Info.cs
- Source:
- Pkcs12Info.cs
- Source:
- Pkcs12Info.cs
- Source:
- Pkcs12Info.cs
Attempts to verify the integrity of the AuthenticatedSafe contents with a password represented by a String.
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
Parameters
- password
- String
The password to use to attempt to verify integrity.
Returns
true
if the password successfully verifies the integrity of the AuthenticatedSafe contents; false
if the password is not correct or the contents have been altered.
Exceptions
The IntegrityMode value is not Password.
The hash algorithm option specified by the PKCS#12 PFX contents could not be identified or is not supported by this platform.
Remarks
In the PKCS#12 specification, a distinction is made between a null
password and an "empty" password, and that difference is reflected in the return value of this method.
If the null
string returns true
, then String.Empty returns false
, and vice versa.