win32cred

Interface to credentials management functions.

Functions

CredDelete(TargetName, Type[, Flags]) Remove the given target name from the stored credentials.
CredRead(TargetName, Type[, Flags]) Retrieves a stored credential.
CredWrite(Credential[, Flags]) Creates or updates a stored credential.
pywin32error(*args, **kwds)


win32ctypes.pywin32.win32cred.CredDelete(TargetName, Type, Flags=0)[source]

Remove the given target name from the stored credentials.

Parameters:
  • TargetName (unicode) – The target name to fetch from the keyring.
  • Type (int) – One of the CRED_TYPE_* constants.
  • Flags (int) – Reserved, always use 0.
win32ctypes.pywin32.win32cred.CredRead(TargetName, Type, Flags=0)[source]

Retrieves a stored credential.

Parameters:
  • TargetName (unicode) – The target name to fetch from the keyring.
  • Type (int) – One of the CRED_TYPE_* constants.
  • Flags (int) – Reserved, always use 0.
Returns:

credentials (dict) – A dictionary containing the following:

  • UserName: the retrieved username
  • CredentialBlob: the password (as an utf-16 encoded ‘string’)

None if the target name was not found.

win32ctypes.pywin32.win32cred.CredWrite(Credential, Flags=0)[source]

Creates or updates a stored credential.

Parameters:
  • Credential (dict) – Parameters to be passed to win32 API CredWrite/
  • Flags (int) – Always pass CRED_PRESERVE_CREDENTIAL_BLOB (i.e. 0).
Returns:

credentials (dict) – A dictionary containing the following:

  • Type: the type of credential (see MSDN)
  • TargetName: the target to use (string)
  • Persist: see MSDN
  • UserName: the retrieved username
  • CredentialBlob: the password (as a string, not an encoded binary stream - this function takes care of the encoding).
  • Comment: a string

win32ctypes.pywin32.win32cred.pywin32error(*args, **kwds)[source]

Previous topic

win32api

Next topic

pywintypes

This Page