Table of Contents

Class DpapiConnectionPasswordProtector

Namespace
ItTiger.TigerQuery.Core
Assembly
ItTiger.TigerQuery.Core.dll
Protects non-empty plain-text profile passwords with current-user Windows DPAPI.
public sealed class DpapiConnectionPasswordProtector : IConnectionPasswordProtector
Inheritance
DpapiConnectionPasswordProtector
Implements
Inherited Members

Remarks

DPAPI ciphertext is tied to the Windows user account that saved it and is not portable to another user or platform; it follows that account to another computer only through a roaming user profile. Decryption failure leaves PlainPassword unchanged rather than throwing, and SqlServerConnectionResolver then reports the stored password as unreadable instead of attempting a login without it.

Methods

ProtectForSave(SqlServerConnectionProfile)

Prepares a profile's password fields for JSON persistence.
public void ProtectForSave(SqlServerConnectionProfile profile)

Parameters

profile SqlServerConnectionProfile
The mutable profile about to be serialized.

Exceptions

ArgumentNullException
profile is null.
PlatformNotSupportedException
A non-empty plain password is supplied on a platform without Windows DPAPI.
CryptographicException
Windows DPAPI rejected the operation, for example because the account has no loaded user profile. The message names DPAPI's own reason and never contains the password.

UnprotectAfterLoad(SqlServerConnectionProfile)

Restores usable in-memory password fields after JSON deserialization.
public void UnprotectAfterLoad(SqlServerConnectionProfile profile)

Parameters

profile SqlServerConnectionProfile
The mutable profile that was loaded.

Exceptions

ArgumentNullException
profile is null.