Package com.storedobject.core
Class Secret
java.lang.Object
com.storedobject.core.StoredObject
com.storedobject.core.Secret
- All Implemented Interfaces:
Displayable
,StringFiller
,HasId
Cipher keys used for encryption/decryption.
- Author:
- Syam
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Definition of the Master Key supplier. -
Field Summary
FieldsFields inherited from class com.storedobject.core.StoredObject
logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
authenticate
(HTTP http, String user, String password) static Authenticator
authenticator
(String user, String password) static String[]
static void
static byte[]
static InputStream
decrypt
(InputStream encryptedStream, int keyIndex, SystemUser user) Decrypt the encrypted stream.static InputStream
decrypt
(InputStream encryptedStream, int keyIndex, TransactionManager tm) Decrypt the encrypted stream.static void
decrypt
(InputStream encryptedStream, OutputStream clearStream, int keyIndex, SystemUser user) Decrypt an encrypted stream and write it to an output stream.static void
decrypt
(InputStream encryptedStream, OutputStream clearStream, int keyIndex, TransactionManager tm) Decrypt an encrypted stream and write it to an output stream.static String
decrypt
(String data, int keyIndex, SystemUser user) Decrypt data.static String
decrypt
(String data, int keyIndex, TransactionManager tm) Decrypt data.static void
encrypt
(InputStream clearStream, OutputStream encryptedStream, int keyIndex, SystemUser user) Encrypt a clear stream and write it to an output stream.static void
encrypt
(InputStream clearStream, OutputStream encryptedStream, int keyIndex, TransactionManager tm) Encrypt a clear stream and write it to an output stream.static OutputStream
encrypt
(OutputStream clearStream, int keyIndex, SystemUser user) Encrypt the encrypted stream.static OutputStream
encrypt
(OutputStream clearStream, int keyIndex, TransactionManager tm) Encrypt the encrypted stream.static String
encrypt
(String data, int keyIndex, SystemUser user) Encrypt data.static String
encrypt
(String data, int keyIndex, TransactionManager tm) Encrypt data.static String
generatePassword
(int length) static SecretKey
int
int
getSeed()
int
getType()
static String
getTypeValue
(int type) static String[]
Gets the unique index condition of this object.static int
hints()
static void
static String[]
links()
static String
static void
Migrate Master Keys.static String
static String[]
void
setComment
(String comment) void
setKeyIndex
(int keyIndex) void
setKeySerial
(int keySerial) void
void
setSeedChecker
(String seed) void
setType
(int type) void
This will be invoked by the system whenever the object is saved to the DB.Methods inherited from class com.storedobject.core.StoredObject
addLink, addLink, addLink, addLink, addLink, addLink, addLink, addLink, checkCurrency, checkCurrency, checkForDuplicate, checkForDuplicate, checkTimeZone, checkTransaction, clearObjectLinks, contemporary, copy, copy, count, count, count, count, count, count, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, create, created, delete, delete, delete, deleted, directUpdate, equals, exists, exists, exists, exists, exists, existsFileData, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsMaster, existsMaster, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, family, family, family, fill, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, getAttachment, getAttachmentId, getChildren, getDeleted, getDeleted, getExistsCondition, getExistsCondition, getFileData, getFileData, getHistorical, getId, getKeyIndex, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getNotExistsCondition, getNotExistsCondition, getParent, getParent, getParent, getParentId, getParentId, getParentId, getRelated, getRelated, getTransaction, getTransactionId, getTransactionIP, getUnique, hashCode, inserted, isModified, isVirtual, list, list, list, list, list, list, list, list, list, list, list, list, list, listFileData, listFileData, listHistory, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listTree, listTree, listTree, listTree, listViaQuery, listViaQuery, load, load, load, load, loaded, loading, makeNew, makeVirtual, migrate, moduleName, nextVersion, objectLink, objectLink, objectLink, objectLinks, objectLinks, old, person, previousVersion, previousVersion, query, query, query, query, query, query, query, query, query, query, query, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, reload, reload, reloaded, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeReverseLinks, removeReverseLinks, save, save, save, save, save, save, save, save, save, save, save, save, save, save, saved, saving, setMaster, setRawValue, setTransaction, stringify, tableName, timestamp, toCode, toDisplay, toString, transacting, undelete, undelete, undeleted, updated, user, userId, validate, validateChildAttach, validateChildDetach, validateChildUpdate, validateDelete, validateInsert, validateParentAttach, validateParentDetach, validateParentUpdate, validateUndelete, validateUpdate, valueEquals
-
Field Details
-
AES
- See Also:
-
UNKNOWN_ALG
- See Also:
-
-
Constructor Details
-
Secret
public Secret()
-
-
Method Details
-
columns
-
browseColumns
-
protectedColumns
-
indices
-
getUniqueCondition
Description copied from class:StoredObject
Gets the unique index condition of this object.- Overrides:
getUniqueCondition
in classStoredObject
- Returns:
- Unique index condition.
-
hints
public static int hints() -
links
-
setKeyIndex
public void setKeyIndex(int keyIndex) -
getKeyIndex
-
setSeed
-
getSeed
-
setSeedChecker
-
getSeedChecker
-
setType
public void setType(int type) -
getType
-
getTypeValues
-
getTypeValue
-
getTypeValue
-
setKeySerial
public void setKeySerial(int keySerial) -
getKeySerial
-
setComment
-
getComment
-
validateData
Description copied from class:StoredObject
This will be invoked by the system whenever the object is saved to the DB. It will be invoked in all cases, while creating new objects and updating/deleting/un-deleting existing objects. If any exception is raised by this method, the process of saving to the DB will be abandoned.
Note: This method is mainly used to validate the data of all attributes of the object, and it may be used by others for validating the object. For example, front-end data-entry systems can use this method for validating the object.
- Overrides:
validateData
in classStoredObject
- Parameters:
tm
- Current transaction manager.- Throws:
Exception
- If data is invalid.
-
encrypt
Encrypt data.- Parameters:
data
- Data to encrypt.keyIndex
- Index of the key to be used.tm
- Transaction manager.- Returns:
- Encrypted text.
-
encrypt
Encrypt data.- Parameters:
data
- Data to encrypt.keyIndex
- Index of the key to be used.user
- Verified system user- Returns:
- Encrypted text.
-
decrypt
Decrypt data.- Parameters:
data
- Data to decrypt.keyIndex
- Index of the key to be used.tm
- Transaction manager.- Returns:
- Decrypted text.
-
decrypt
Decrypt data.- Parameters:
data
- Data to decrypt.keyIndex
- Index of the key to be used.user
- Verified system user- Returns:
- Decrypted text.
-
decrypt
public static InputStream decrypt(InputStream encryptedStream, int keyIndex, TransactionManager tm) throws IOException Decrypt the encrypted stream.- Parameters:
encryptedStream
- Stream to decrypt.keyIndex
- Index of the key to be used.tm
- Transaction manager.- Returns:
- Decrypted stream.
- Throws:
IOException
-
decrypt
public static InputStream decrypt(InputStream encryptedStream, int keyIndex, SystemUser user) throws IOException Decrypt the encrypted stream.- Parameters:
encryptedStream
- Stream to decrypt.keyIndex
- Index of the key to be used.user
- Verified system user- Returns:
- Decrypted stream.
- Throws:
IOException
-
encrypt
public static OutputStream encrypt(OutputStream clearStream, int keyIndex, TransactionManager tm) throws IOException Encrypt the encrypted stream.- Parameters:
clearStream
- Stream to encrypt.keyIndex
- Index of the key to be used.tm
- Transaction manager.- Returns:
- Encrypted stream.
- Throws:
IOException
-
encrypt
public static OutputStream encrypt(OutputStream clearStream, int keyIndex, SystemUser user) throws IOException Encrypt the encrypted stream.- Parameters:
clearStream
- Stream to encrypt.keyIndex
- Index of the key to be used.user
- Verified system user- Returns:
- Encrypted stream.
- Throws:
IOException
-
encrypt
public static void encrypt(InputStream clearStream, OutputStream encryptedStream, int keyIndex, TransactionManager tm) throws IOException Encrypt a clear stream and write it to an output stream.- Parameters:
clearStream
- Clear stream to read from.encryptedStream
- Encrypted output stream.keyIndex
- Index of the key to be used.tm
- Transaction manager.- Throws:
IOException
- If any IO exception occurs.
-
encrypt
public static void encrypt(InputStream clearStream, OutputStream encryptedStream, int keyIndex, SystemUser user) throws IOException Encrypt a clear stream and write it to an output stream.- Parameters:
clearStream
- Clear stream to read from.encryptedStream
- Encrypted output stream.keyIndex
- Index of the key to be used.user
- Verified system user- Throws:
IOException
- If any IO exception occurs.
-
decrypt
public static void decrypt(InputStream encryptedStream, OutputStream clearStream, int keyIndex, TransactionManager tm) throws IOException Decrypt an encrypted stream and write it to an output stream.- Parameters:
encryptedStream
- Encrypted stream to read from.clearStream
- Clear output stream.keyIndex
- Index of the key to be used.tm
- Transaction manager.- Throws:
IOException
- If any IO exception occurs.
-
decrypt
public static void decrypt(InputStream encryptedStream, OutputStream clearStream, int keyIndex, SystemUser user) throws IOException Decrypt an encrypted stream and write it to an output stream.- Parameters:
encryptedStream
- Encrypted stream to read from.clearStream
- Clear output stream.keyIndex
- Index of the key to be used.user
- Verified system user- Throws:
IOException
- If any IO exception occurs.
-
decrypt
-
migrateMasterKey
Migrate Master Keys.- Parameters:
tm
- Transaction manager.- Throws:
Exception
- If any error occurs.
-
generateSecretKey
-
obfuscate
-
authenticate
-
authenticator
-
log
-
generatePassword
-