CacheFilePassword Method
Caches an encryption password to use the next time a file or alternate stream is accessed.
Syntax
cbdrive.cacheFilePassword(fileName, password, [callback])
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for this method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
This temporarily caches an encryption password so that it can be used the next time the file or alternate stream specified by FileName is accessed. The specified password is automatically removed from the cache as soon as one of the following things occur:
- The password is used to access the file or alternate stream.
- The password for the file or alternate stream is changed.
- The vault is closed.
The value passed for FileName must be a vault-local absolute path.
The Password parameter specifies the password to cache. It must match the one last used to encrypt the specified file or alternate stream, otherwise this method throws an exception.
As an alternative to using this method, applications can provide a default file encryption password using the DefaultFilePassword property, and/or provide such passwords dynamically using the FilePasswordNeeded event.
Note: This method can only be called when Active is true.