|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jp.protection.pub.FileSecretStorage
public class FileSecretStorage
Default implementation of the SecretStorage interface that stores
data in a local file
| Nested Class Summary | |
|---|---|
protected static class |
FileSecretStorage.DecodeInputStream
|
protected static class |
FileSecretStorage.DecryptInputStream
|
protected static class |
FileSecretStorage.EncodeOutputStream
|
protected static class |
FileSecretStorage.EncryptOutputStream
|
static class |
FileSecretStorage.Provider
|
| Field Summary | |
|---|---|
protected boolean |
fDirty
|
protected java.lang.String |
fFileName
|
protected java.lang.String |
fFolder
|
protected boolean |
fLoaded
|
protected java.util.Properties |
fProperties
|
protected boolean |
fSkipEncryption
|
protected boolean |
fUseLockFile
|
protected boolean |
fUserHomeRelative
|
protected boolean |
fUseStrongEncryption
|
protected boolean |
fVerbose
|
| Constructor Summary | |
|---|---|
FileSecretStorage()
Creates a new instance of FileSecretStorage |
|
FileSecretStorage(java.lang.String aFolder,
java.lang.String aFileName)
Creates a new instance of FileSecretStorage and initializes it |
|
FileSecretStorage(java.lang.String aFolder,
java.lang.String aFileName,
boolean aUserHomeRelative)
Creates a new instance of FileSecretStorage and initializes it |
|
FileSecretStorage(java.lang.String aFolder,
java.lang.String aFileName,
boolean aUserHomeRelative,
boolean aUseStrongEncryption)
Creates a new instance of FileSecretStorage and initializes it |
|
FileSecretStorage(java.lang.String aFolder,
java.lang.String aFileName,
boolean aUserHomeRelative,
boolean aUseStrongEncryption,
boolean aUseLockFile)
Creates a new instance of FileSecretStorage and initializes it |
|
| Method Summary | |
|---|---|
protected java.lang.String |
composePassword(java.io.File aFile)
|
protected void |
error(java.lang.Throwable ex)
|
protected void |
fileLockError(java.io.File aFile)
|
protected long |
generateTimestamp(java.io.File aFile)
|
protected static javax.crypto.Cipher |
getCipher(boolean isEncrypt,
java.lang.String aPassword)
|
java.io.File |
getFile()
Returns the secret storage file |
java.lang.String |
getFileName()
Returns the name of the storage file |
java.lang.String |
getFolder()
Returns the folder of the storage file |
protected java.io.InputStream |
getInputStream()
|
protected java.io.OutputStream |
getOutputStream()
|
protected java.util.Properties |
getProperties()
|
java.lang.String |
getProperty(java.lang.String key)
Gets property value by its key |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Gets property value by its key |
protected long |
getTimestamp(java.io.File aFile)
|
boolean |
isDirty()
Checks whether secret storage is changed |
protected boolean |
isLoaded()
|
boolean |
isSkipEncryption()
Checks whether encryption should be skipped during storage saving |
boolean |
isUseLockFile()
Checks whether a lock file should be used to prevent concurrent modifications of the Secret Storage |
boolean |
isUserHomeRelative()
Checks whether folder to find storage file is relative to the user home. |
boolean |
isUseStrongEncryption()
Checks whether strong encryption should be used |
boolean |
isVerbose()
Checks whether verbose output is enabled. |
void |
load()
Loads Secret Storage from a file and takes care on avoiding synchronization conflicts. |
protected void |
loadImpl()
|
void |
save()
Saves Secret Storage to a file and takes care on avoiding synchronization conflicts. |
protected void |
saveImpl()
|
void |
setDirty(boolean aDirty)
Specifies that secret storage is changed |
void |
setFileName(java.lang.String aFileName)
Specifies the name of the storage file |
void |
setFolder(java.lang.String aFolder)
Specifies the folder of the storage file |
protected void |
setLoaded(boolean aLoaded)
|
java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value)
Specifies property value for the given key |
void |
setSkipEncryption(boolean aSkipEncryption)
Specifies that encryption should be skipped during storage saving |
void |
setUseLockFile(boolean useLockFile)
Specifies whether a lock file should be used to prevent concurrent modifications of the Secret Storage |
void |
setUserHomeRelative(boolean aUserHomeRelative)
Specifies that folder to find storage file is relative to the user home. |
void |
setUseStrongEncryption(boolean aUseStrongEncryption)
Specifies that strong encryption should be used |
void |
setVerbose(boolean aVerbose)
Specifies that verbose output is enabled. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String fFileName
protected java.lang.String fFolder
protected boolean fUserHomeRelative
protected java.util.Properties fProperties
protected boolean fDirty
protected boolean fLoaded
protected boolean fVerbose
protected boolean fUseLockFile
protected boolean fSkipEncryption
protected boolean fUseStrongEncryption
| Constructor Detail |
|---|
public FileSecretStorage()
public FileSecretStorage(java.lang.String aFolder,
java.lang.String aFileName)
aFolder - a folder to locate secret storage fileaFileName - a name of secret storage file
public FileSecretStorage(java.lang.String aFolder,
java.lang.String aFileName,
boolean aUserHomeRelative)
aFolder - folder to locate secret storage fileaFileName - a name of secret storage fileaUserHomeRelative - specifies whether a folder is user HOME folder relative
public FileSecretStorage(java.lang.String aFolder,
java.lang.String aFileName,
boolean aUserHomeRelative,
boolean aUseStrongEncryption)
aFolder - folder to locate secret storage fileaFileName - a name of secret storage fileaUserHomeRelative - specifies whether a folder is user HOME folder relativeaUseStrongEncryption - specifies whether strong encryption should be used
public FileSecretStorage(java.lang.String aFolder,
java.lang.String aFileName,
boolean aUserHomeRelative,
boolean aUseStrongEncryption,
boolean aUseLockFile)
aFolder - folder to locate secret storage fileaFileName - a name of secret storage fileaUserHomeRelative - specifies whether a folder is user HOME folder relativeaUseStrongEncryption - specifies whether strong encryption should be usedaUseLockFile - specifies whether lock file (.lck) should be used to prevent concurrent modifications of the Secret Storage| Method Detail |
|---|
public boolean isUserHomeRelative()
true if folder to find storage file is
relative to the user home; false otherwise.public java.lang.String getFileName()
public void setFileName(java.lang.String aFileName)
aFileName - a name of the storage file to assignpublic java.lang.String getFolder()
public void setFolder(java.lang.String aFolder)
aFolder - a folder of the storage file to assignpublic void setUserHomeRelative(boolean aUserHomeRelative)
aUserHomeRelative - true if folder to find storage file is
relative to the user home; false otherwise.public boolean isVerbose()
true if verbose output is enabled;
false otherwise.public void setVerbose(boolean aVerbose)
aVerbose - true if verbose output should be enabled;
false otherwise.protected void setLoaded(boolean aLoaded)
protected java.util.Properties getProperties()
public java.lang.String getProperty(java.lang.String key)
SecretStorage
getProperty in interface SecretStoragekey - identifies value to return
public java.lang.String getProperty(java.lang.String key,
java.lang.String defaultValue)
SecretStorage
getProperty in interface SecretStoragekey - identifies value to be returndefaultValue - a value should be returned if there is no value for the given key
public java.lang.Object setProperty(java.lang.String key,
java.lang.String value)
SecretStorage
setProperty in interface SecretStoragekey - identifies value to specifyvalue - value to be associated with the key
protected boolean isLoaded()
public boolean isDirty()
true if secret storage is changed; false
otherwisepublic void setDirty(boolean aDirty)
aDirty - true if secret storage should be marked as changed;
false otherwisepublic final void load()
loadImpl() method to make custom implementation of Secret Storage loading
load in interface SecretStorageprotected void loadImpl()
protected void fileLockError(java.io.File aFile)
protected long generateTimestamp(java.io.File aFile)
protected long getTimestamp(java.io.File aFile)
public final void save()
saveImpl() method to make custom implementation of Secret Storage saving
save in interface SecretStorageprotected void saveImpl()
public boolean isSkipEncryption()
true if encryption should be skipped during storage
saving; false otherwisepublic void setSkipEncryption(boolean aSkipEncryption)
aSkipEncryption - true if encryption should be skipped
during storage saving; false otherwisepublic boolean isUseLockFile()
true if a lock file will be used to prevent concurrent modifications of the Secret Storage;
false otherwisepublic void setUseLockFile(boolean useLockFile)
useLockFile - true if a lock file should be used to prevent concurrent modifications of the Secret Storage;
false otherwisepublic boolean isUseStrongEncryption()
true if strong encryption will be used;
false otherwisepublic void setUseStrongEncryption(boolean aUseStrongEncryption)
aUseStrongEncryption - true if strong encryption should be used;
* false otherwisepublic java.io.File getFile()
protected java.io.InputStream getInputStream()
protected java.lang.String composePassword(java.io.File aFile)
protected java.io.OutputStream getOutputStream()
protected void error(java.lang.Throwable ex)
protected static javax.crypto.Cipher getCipher(boolean isEncrypt,
java.lang.String aPassword)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||