def Unlock(
      self, scan_context, path_spec, credential_identifier, credential_data):
    if not scan_context.HasScanNode(path_spec):
      raise KeyError(u'Scan node does not exist.')

    if not scan_context.IsLockedScanNode(path_spec):
      raise KeyError(u'Scan node is not locked.')

    resolver.Resolver.key_chain.SetCredential(
        path_spec, credential_identifier, credential_data)

    file_object = resolver.Resolver.OpenFileObject(
        path_spec, resolver_context=self._resolver_context)
    is_locked = not file_object or file_object.is_locked
    file_object.close()

    if is_locked:
      return False

    scan_context.UnlockScanNode(path_spec)
    return True
Unlocks a locked scan node e.g. the scan node of an encrypted volume.
dataset/ETHPy150Open log2timeline/dfvfs/dfvfs/helpers/source_scanner.py/SourceScanner.Unlock