Skip to content

Commit 0ff9eff

Browse files
committed
Added decrypt auth identity.
1 parent 6f6a851 commit 0ff9eff

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

NtApiDotNet/Win32/Security/Credential/AuthIdentity/SecWinNtAuthIdentity.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,17 @@ public ILsaLogonCredentials ToLsaLogonCredentials(string package = Authenticatio
239239
return new SecWinNtAuthIdentityLsaLogonCredentials(package, ToArray());
240240
}
241241

242+
/// <summary>
243+
/// Decrypt the credentials if encrypted.
244+
/// </summary>
245+
/// <param name="encrypt_options">The decryption options.</param>
246+
public void Decrypt(SecWinNtAuthIdentityEncryptionOptions encrypt_options = 0)
247+
{
248+
if (!IsEncrypted)
249+
return;
250+
SecurityNativeMethods.SspiDecryptAuthIdentityEx(encrypt_options, _auth_id).CheckResult();
251+
}
252+
242253
/// <summary>
243254
/// Convert the object to a string.
244255
/// </summary>

NtApiDotNet/Win32/Security/Native/SecurityNativeMethods.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -251,22 +251,12 @@ internal static extern bool SspiIsAuthIdentityEncrypted(
251251
SafeSecWinNtAuthIdentityBuffer EncryptedAuthData
252252
);
253253

254-
[DllImport("sspicli.dll", CharSet = CharSet.Unicode)]
255-
internal static extern SecStatusCode SspiDecryptAuthIdentity(
256-
SafeBuffer EncryptedAuthData
257-
);
258-
259254
[DllImport("sspicli.dll", CharSet = CharSet.Unicode)]
260255
internal static extern SecStatusCode SspiDecryptAuthIdentityEx(
261256
SecWinNtAuthIdentityEncryptionOptions Options,
262257
SafeBuffer EncryptedAuthData
263258
);
264259

265-
[DllImport("sspicli.dll", CharSet = CharSet.Unicode)]
266-
internal static extern SecStatusCode SspiEncryptAuthIdentity(
267-
SafeBuffer AuthData
268-
);
269-
270260
[DllImport("sspicli.dll", CharSet = CharSet.Unicode)]
271261
internal static extern SecStatusCode SspiEncryptAuthIdentityEx(
272262
SecWinNtAuthIdentityEncryptionOptions Options,

0 commit comments

Comments
 (0)