public class ServerCacheOfsProvider extends BaseProvider implements IContainerProvider
ServerProvider
) and caches for
offline and local access in an Obfuscating File System (OFS
, see also OfsProvider
). Use initialize(String, String, String, Path, boolean)
to initialize the session and logIn(UUID, String, String)
to authenticate that session.keyRing
Constructor and Description |
---|
ServerCacheOfsProvider()
Default constructor.
|
ServerCacheOfsProvider(boolean trustAllCertificates)
Trusting test constructor.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
changeCredentials(String password,
String passphrase)
This will change the authenticated user's credentials.
|
byte[] |
changeCredentials(String password,
String passphrase,
String reminder)
This will change the authenticated user's credentials.
|
SecuredContainer |
create(byte[] content,
String headerString,
List<Access> accesses,
String type)
Creates and persists a new SecuredContainer on the Absio Broker™ application and returns it.
|
SecuredContainer |
createOrUpdate(Container container)
Creates and persists a new Container on the Absio Broker™ application and returns it.
|
SecuredContainer |
createOrUpdate(SecuredContainer container)
Creates and persists a new Container on the Absio Broker™ application and returns it.
|
void |
createOrUpdatePublicKey(ECPublicKey publicKey,
KeyType type,
int index,
boolean active)
This will create or update the public key for the authenticated user on the Absio Broker™ application and
the local
OFS . |
void |
createOrUpdatePublicKey(IndexedECPublicKey publicKey)
This will create or update the public key for the authenticated user on the Absio Broker™ application and
the local
OFS . |
void |
delete(UUID containerId)
Deletes the encrypted content of the container and deletes the metadata records from the Absio Broker™
application and the local
OFS . |
void |
deleteUser()
This will delete the user from Absio Broker™ application and the local
OFS . |
boolean |
forceDownloadFromServer()
Property for whether
SecuredContainer retrieval methods like get(UUID) will always download from
Absio Broker and attempt to cache them in the OFS . |
Container |
get(UUID containerId)
Gets the SecuredContainer from the OFS (content, header and metadata), decrypts the content and header and
returns the resulting Container.
|
ContainerInfo |
getBrokerInfo(UUID containerId)
|
byte[] |
getContent(UUID id)
Gets the decrypted content of the secured container for the given ID.
|
EventPackage |
getEvents(EventActionType actionType,
EventType eventType,
Long startingId,
Long endingId,
UUID containerId,
String containerType)
Gets all events that match the event type, action type, starting id, ending id, container id and type.
|
Header |
getHeader(UUID containerId)
Gets the decrypted header of the secured container for the given ID.
|
byte[] |
getKeyFileBytes(UUID userId)
Gets the key file bytes from the local
OFS . |
ContainerDbInfo |
getOfsInfo(UUID containerId)
Gets the SecuredContainer from the OFS (content, header and metadata), decrypts the content and header and
returns the resulting Container.
|
OfsProvider |
getOfsProvider()
Get the provider in charge of managing the
OFS mappers and operations. |
IndexedECPublicKey |
getPublicKeyByIndex(UUID userId,
KeyType type,
int index)
This will get a single public key from Absio Broker™ application or the local
OFS . |
IndexedECPublicKey |
getPublicKeyLatestActive(UUID userId,
KeyType type)
This will get the latest public key from Absio Broker™ application or the local
OFS . |
List<IndexedECPublicKey> |
getPublicKeyList(UUID userId,
KeyType type,
Integer index)
Gets a user's public keys matching the key type and key ring index.
|
String |
getReminder()
Retrieves a user's keys file passphrase reminder stored on the Absio Broker™ application.
|
String |
getReminder(UUID userId)
Retrieves a user's keys file passphrase reminder stored on the Absio Broker server.
|
ServerProvider |
getServerProvider()
Get the provider in charge of managing the server mappers and operations.
|
void |
initialize(String serverUrl,
String apiKey,
String applicationName,
Path ofsRootDirectory,
boolean partitionDataByUser)
This will set up the
Session and create the internal mappers. |
boolean |
isAuthenticated()
Get if the provider is authenticated (i.e.
|
boolean |
isInitialized()
Get if the provider is initialized.
|
void |
logIn(KeyRing keyRing)
Uses the provided KeyRing to authenticate with the Absio Broker™ application and authenticates the user
locally by logging into the encrypted database in the OFS.
|
byte[] |
logIn(UUID userId,
String password,
String passphrase)
Authenticates the user locally by decrypting the KeyFile to get their
KeyRing and then logs into the
encrypted database in the OFS. |
void |
logOut()
This will end an authenticated session.
|
boolean |
needToSyncAccount(UUID userId)
Generates a checksum of the encrypted keys file stored in the
OFS and checks if it matches the checksum
of a keys file stored on the Absio Broker™ application. |
byte[] |
register(String password,
String passphrase)
This will register the new user, authenticate with Absio Broker™ application and push the new key file to
Absio Broker.
|
byte[] |
register(String password,
String passphrase,
String reminder)
This will register the new user, authenticate with Absio Broker™ application and push the new key file to
Absio Broker.
|
void |
setForceGetFromServer(boolean forceGetFromServer)
Sets whether
SecuredContainer retrieval methods like get(UUID) will always download from Absio
Broker and attempt to cache them in the OFS . |
void |
synchronizeAccount(String password,
String passphrase)
This will pull the KeyFile from teh Absio Broker™ application and persist it in the OFS.
|
SecuredContainer |
update(UUID containerId,
byte[] content,
String headerString,
List<Access> accesses,
String type)
Update the content, header, access and type of the secured container with the given ID on the Absio Broker
application and updates the local
OFS cache. |
void |
updateAccess(UUID containerId,
List<Access> accessLevels)
Updates the access for a
SecuredContainer on the Absio Broker™ application and updates the local
OFS cache. |
SecuredContainer |
updateContent(UUID containerId,
byte[] newContent)
Updates the content for a
SecuredContainer on the Absio Broker™ application and updates the local
OFS cache. |
SecuredContainer |
updateHeader(UUID containerId,
String headerString)
Update the header of the secured container with the given ID on the Absio Broker™ application and updates
the local
OFS cache. |
void |
updateType(UUID containerId,
String type)
Update the type of a
SecuredContainer on the Absio Broker™ application and updates the local OFS cache. |
getKeyRing, getUserId, hashToB64, hashToHex
public ServerCacheOfsProvider() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- thrown if the algorithm is not supported (see MessageDigestHelper
)public ServerCacheOfsProvider(boolean trustAllCertificates) throws NoSuchAlgorithmException
NoSuchAlgorithmException
- thrown if the algorithm is not supported (see MessageDigestHelper
)public byte[] changeCredentials(String password, String passphrase) throws IllegalArgumentException, IllegalAccessException, NoSuchPaddingException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException, InvalidKeyException, IOException, BrokerException, InterruptedException
OFS
. No reminder will be used (it will be set to "").
NOTE: this requires an initialized and authenticated session. Also, both the password and passphrase are required.
password
- the new password for the authenticated userpassphrase
- the new passphrase for the authenticated userIllegalArgumentException
- thrown if the password or passphrase are null or emptyIllegalAccessException
- thrown if the provider is not authenticatedNoSuchPaddingException
- thrown if the padding is not supported when the key ring is encryptedInvalidAlgorithmParameterException
- thrown if the algorithm parameter is not supported when the key ring
is encryptedNoSuchAlgorithmException
- thrown if the algorithm is not supported when the key ring is
encryptedIllegalBlockSizeException
- thrown if the block size is not supported when the key ring is
encryptedBadPaddingException
- thrown if the padding is not supported when the key ring is encryptedInvalidKeyException
- thrown if the key is not valid when the key ring is encryptedIOException
- thrown if there are any issues communicating with Absio Broker™
application or writing the encrypted key ringBrokerException
- thrown if there are any Absio Broker™ application issues
creating or updating the key fileInterruptedException
- thrown when there is an interruption during rate limitingpublic byte[] changeCredentials(String password, String passphrase, String reminder) throws IllegalArgumentException, IllegalAccessException, NoSuchPaddingException, InvalidKeyException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, IOException, BrokerException, InterruptedException
OFS
. The reminder can be used to help recall a forgotten
passphrase (see ServerProvider.getReminder(UUID)
).
NOTE: this requires an initialized and authenticated session. Also, both the password and passphrase are required.
password
- the new password for the authenticated user (required)passphrase
- the new passphrase for the authenticated user (required)reminder
- the reminder for the authenticated userIllegalArgumentException
- thrown if the password or passphrase are null or emptyIllegalAccessException
- thrown if the provider is not authenticatedNoSuchPaddingException
- thrown if the padding is not supported when the key ring is encryptedInvalidAlgorithmParameterException
- thrown if the algorithm parameter is not supported when the key ring
is encryptedNoSuchAlgorithmException
- thrown if the algorithm is not supported when the key ring is
encryptedIllegalBlockSizeException
- thrown if the block size is not supported when the key ring is
encryptedBadPaddingException
- thrown if the padding is not supported when the key ring is encryptedInvalidKeyException
- thrown if the key is not valid when the key ring is encryptedIOException
- thrown if there are any issues communicating with Absio Broker™
application or writing the encrypted key ringBrokerException
- thrown if there are any Absio Broker™ application issues
creating or updating the key fileInterruptedException
- thrown when there is an interruption during rate limitingpublic SecuredContainer create(byte[] content, String headerString, List<Access> accesses, String type) throws Exception
SecuredContainer.getId()
to learn the assigned ID. The encrypted content and metadata is cached in the local
OFS
.
NOTE: this requires an initialized and authenticated session.
create
in interface IContainerProvider
content
- the container's contentheaderString
- the container's headeraccesses
- the container's access list - if null the container will have default access for the creatortype
- the container's typeSecuredContainer
InterruptedException
- thrown when there is an interruption during rate limitingBrokerException
- thrown when the Absio Broker™ application has an issue with the requestIOException
- thrown when there are any IO issuesIllegalAccessException
- thrown if the session is not authenticatedException
- thrown if there are any issues encrypting and persisting the container in the
Absio Broker™ applicationpublic SecuredContainer createOrUpdate(Container container) throws Exception
SecuredContainer.getId()
to learn the assigned ID. The encrypted content and metadata is cached in the local
OFS
.
NOTE: this requires an initialized and authenticated session.
createOrUpdate
in interface IContainerProvider
container
- the Container
to createInterruptedException
- thrown when there is an interruption during rate limitingBrokerException
- thrown when the Absio Broker™ application has an issue with the requestIOException
- thrown when there are any IO issuesIllegalAccessException
- thrown if the session is not authenticatedException
- thrown if there are any issues encrypting and persisting the container in the
Absio Broker™ applicationpublic SecuredContainer createOrUpdate(SecuredContainer container) throws Exception
SecuredContainer.getId()
to learn the assigned ID. The encrypted content and metadata is cached in the local
OFS
.
NOTE: this requires an initialized and authenticated session.
createOrUpdate
in interface IContainerProvider
container
- the Container
to createInterruptedException
- thrown when there is an interruption during rate limitingBrokerException
- thrown when the Absio Broker™ application has an issue with the requestIOException
- thrown when there are any IO issuesIllegalAccessException
- thrown if the session is not authenticatedException
- thrown if there are any issues encrypting and persisting the container in the
Absio Broker™ applicationpublic void createOrUpdatePublicKey(IndexedECPublicKey publicKey) throws BrokerException, IOException, IllegalAccessException, InterruptedException, SQLException
OFS
.
NOTE: this requires an initialized and authenticated session.
publicKey
- the public key to create or updateBrokerException
- thrown if there are any Absio Broker™ application issues creating or
updating the keyIOException
- thrown if there are any issues communicating with Absio Broker™ application
or writing the public keyIllegalAccessException
- thrown if the session is not authenticatedInterruptedException
- thrown when there is an interruption during rate limitingSQLException
- thrown if there was an issue writing the public key to the databasepublic void createOrUpdatePublicKey(ECPublicKey publicKey, KeyType type, int index, boolean active) throws BrokerException, IOException, IllegalAccessException, InterruptedException, SQLException
OFS
.
NOTE: this requires an initialized and authenticated session.
publicKey
- the public key to create or updatetype
- the key type to create or updateindex
- the key index to create or updateactive
- the active state of the key to create or updateBrokerException
- thrown if there are any Absio Broker™ application issues creating or
updating the keyIOException
- thrown if there are any issues communicating with Absio Broker™ application
or writing the public keyIllegalAccessException
- thrown if the session is not authenticatedInterruptedException
- thrown when there is an interruption during rate limitingSQLException
- thrown if there was an issue writing the public key to the databasepublic void delete(UUID containerId) throws InterruptedException, BrokerException, IOException, IllegalAccessException, SQLException
OFS
.
NOTE: this requires an initialized and authenticated session.
delete
in interface IContainerProvider
containerId
- the id of the container to deleteInterruptedException
- thrown when there is an interruption during rate limitingBrokerException
- thrown when the Absio Broker™ application has an issue with the requestIOException
- thrown when there are any IO issuesIllegalAccessException
- thrown if the session is not authenticatedSQLException
- thrown if there where any issues removing the secured container from the databasepublic void deleteUser() throws IllegalAccessException, IOException, BrokerException, InterruptedException, SQLException, NoSuchAlgorithmException
OFS
. This means that all
public keys and the backed up key file will be removed and unrecoverable.
NOTE: this requires an initialized and authenticated session.
WARNING: this will completely delete the user from Absio Broker
IllegalAccessException
- thrown if the session is not authenticatedIOException
- thrown if there are any issues communicating with Absio BrokerBrokerException
- thrown if there are any Absio Broker™ application issues deleting the
userInterruptedException
- thrown when there is an interruption during rate limitingSQLException
- thrown if there was an issue deleting any of the users data in the databaseNoSuchAlgorithmException
- thrown if a hash was unable to be generated (user's OFS location)public boolean forceDownloadFromServer()
SecuredContainer
retrieval methods like get(UUID)
will always download from
Absio Broker and attempt to cache them in the OFS
. If false, the OFS
cache will be used first and
Absio Broker will be used if not available.OFS
cachepublic Container get(UUID containerId) throws Exception
NOTE: this requires an initialized and authenticated session.
get
in interface IContainerProvider
containerId
- the id of the container to getSecuredContainer
InterruptedException
- thrown when there is an interruption during rate limitingBrokerException
- thrown when the Absio Broker™ application has an issue with the requestIOException
- thrown when there are any IO issuesIllegalAccessException
- thrown if the session is not authenticatedException
- thrown if there are any issues getting or decrypting the secured containerpublic ContainerInfo getBrokerInfo(UUID containerId) throws InterruptedException, BrokerException, IOException, IllegalAccessException
ContainerInfo
for a SecuredContainer
from the Absio Broker™ application or the
local OFS
. This is the Metadata
, Access
list and download URL information for the
container.
NOTE: this requires an initialized and authenticated session.
containerId
- the id of the container to getContainerInfo
InterruptedException
- thrown when there is an interruption during rate limitingBrokerException
- thrown when the Absio Broker™ application has an issue with the requestIOException
- thrown when there are any IO issuesIllegalAccessException
- thrown if the session is not authenticatedpublic byte[] getContent(UUID id) throws Exception
NOTE: this requires an initialized and authenticated session.
getContent
in interface IContainerProvider
id
- the id of the secured container to get the content ofException
- thrown if there are any issues getting or decrypting the secured container contentpublic EventPackage getEvents(EventActionType actionType, EventType eventType, Long startingId, Long endingId, UUID containerId, String containerType) throws IOException, InterruptedException, BrokerException, IllegalAccessException
NOTE: this requires an initialized and authenticated session.
actionType
- the specific type action you wish to pull (null will get all actions)eventType
- the specific type of events you wish to pull (null will get all events)startingId
- the id to start pulling from (null will start from the beginning)endingId
- the id to stop pulling from (null will get all events)containerId
- the specific id of a container to pull events for (null will get events for all containers)containerType
- the specific type value to look for events for (null will get containers with any type
value)IOException
- thrown if there were any IO issuesInterruptedException
- thrown if there were issues while dealing with rate limitingBrokerException
- thrown if there were any issues with the requests to Absio BrokerIllegalAccessException
- thrown if the session is not authenticatedpublic Header getHeader(UUID containerId) throws Exception
NOTE: this requires an initialized and authenticated session.
getHeader
in interface IContainerProvider
containerId
- the id of the secured container to get the header ofException
- thrown if there are any issues getting or decrypting the secured container headerpublic byte[] getKeyFileBytes(UUID userId) throws IOException, NoSuchAlgorithmException
OFS
.userId
- the user's idIOException
- thrown when there are any IO issuesNoSuchAlgorithmException
- thrown if ECDH is not supportedpublic ContainerDbInfo getOfsInfo(UUID containerId) throws SQLException, IllegalAccessException
NOTE: this requires an initialized and authenticated session.
containerId
- the id of the secured container to getSQLException
- thrown if there was an issue getting the info from the databaseIllegalAccessException
- thrown if the session is not authenticatedpublic OfsProvider getOfsProvider()
OFS
mappers and operations.public IndexedECPublicKey getPublicKeyByIndex(UUID userId, KeyType type, int index) throws Exception
OFS
. The public key
of the defined user id, type and index.
NOTE: this requires an initialized and authenticated session.
userId
- the user id that owns the key in question (required)type
- the type of the key in question (required)index
- the index of the key in question (required)BrokerException
- thrown if there are any Absio Broker™ application issues getting the keyIOException
- thrown if there are any issues communicating with Absio BrokerIllegalAccessException
- thrown if the session is not authenticatedIllegalArgumentException
- thrown if the userId or type are nullInterruptedException
- thrown when there is an interruption during rate limitingException
public IndexedECPublicKey getPublicKeyLatestActive(UUID userId, KeyType type) throws Exception
OFS
. The public
key of the defined user, type and highest active index.
NOTE: this requires an initialized and authenticated session.
userId
- the user id that owns the key in question (required)type
- the type of the key in question (required)BrokerException
- thrown if there are any Absio Broker™ application issues getting the keyIOException
- thrown if there are any issues communicating with Absio BrokerIllegalAccessException
- thrown if the session is not authenticatedIllegalArgumentException
- thrown if the userId or type are nullInterruptedException
- thrown when there is an interruption during rate limitingException
public List<IndexedECPublicKey> getPublicKeyList(UUID userId, KeyType type, Integer index) throws BrokerException, IOException, IllegalAccessException, InterruptedException, SQLException
NOTE: this requires an initialized and authenticated session and pass in null to ignore a parameter.
userId
- the user's ID (required)type
- the key type or ignored if nullindex
- the key index or ignored if nullBrokerException
- thrown when the Absio Broker™ application has an issue with the requestIOException
- thrown when there are any IO issuesIllegalAccessException
- thrown if the session is not authenticatedInterruptedException
- thrown when there is an interruption during rate limitingSQLException
- thrown if there was an issue writing the public key to the databasepublic String getReminder() throws IllegalAccessException, IOException, BrokerException, InterruptedException
NOTE: this requires an initialized and authenticated session.
BrokerException
- thrown when the Absio Broker™ application has an issue with the requestIOException
- thrown when there are any IO issuesIllegalAccessException
- thrown if the session is not authenticatedInterruptedException
- thrown when there is an interruption during rate limitingpublic String getReminder(UUID userId) throws IllegalAccessException, IOException, BrokerException, InterruptedException
NOTE: this requires an initialized and authenticated session.
userId
- the user's IDBrokerException
- thrown when the Absio Broker™ application has an issue with the requestIOException
- thrown when there are any IO issuesIllegalAccessException
- thrown if the session is not initializedInterruptedException
- thrown when there is an interruption during rate limitingpublic ServerProvider getServerProvider()
public void initialize(String serverUrl, String apiKey, String applicationName, Path ofsRootDirectory, boolean partitionDataByUser) throws NoSuchPaddingException, NoSuchAlgorithmException
Session
and create the internal mappers.serverUrl
- the Absio Broker™ application URLapiKey
- the provider's Absio Broker™ application API KeyapplicationName
- the application name for debugging purposes (placed in the http headers when
communicating with Absio Broker)ofsRootDirectory
- the path for the root OFS directorypartitionDataByUser
- true if data should be partitioned by user (special OFS directory for each user)NoSuchPaddingException
- thrown if the default padding for symmetric encryption is not supportedNoSuchAlgorithmException
- thrown if ECDH is not supportedpublic boolean isAuthenticated()
KeyRing
).public boolean isInitialized()
initialize(String, String, String,
Path, boolean)
for how to initialize this provider.public byte[] logIn(UUID userId, String password, String passphrase) throws IllegalArgumentException, IllegalAccessException, NoSuchAlgorithmException, BrokerException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, IOException, SignatureException, InterruptedException, SQLException
KeyRing
and then logs into the
encrypted database in the OFS. Password and passphrase are both listed as optional parameters, but at least one
must be included. If the password is not included, the passphrase will be used to get the password from the
KeyFile. If no passphrase was included when the KeyFile was created the operation will fail. All mappers will be
created and initialized.
NOTE: This will throw an exception on failure. When successful the session will be authenticated.
If the key file is not available locally, it will pull the key file from Absio Broker. It will then decrypt the
key file and use the KeyRing
to authenticate with Absio Broker.
NOTE: this requires an initialized session.
userId
- the user to log in (required)password
- the user's password (can be null - passphrase will be used)passphrase
- the usere's passphrase (required)IllegalAccessException
- thrown if the session is not initializedNoSuchAlgorithmException
- thrown if the algorithm is not known to decrypt the key fileBrokerException
- thrown when the Absio Broker™ application has an issue with the
requestNoSuchPaddingException
- thrown if the padding is not supported to decrypt the key fileInvalidKeyException
- thrown when there was an error with the key for signing data to be
sent to Absio BrokerIllegalBlockSizeException
- thrown if the cipher block size is wrong to decrypt the key fileBadPaddingException
- thrown if the cipher padding is not supported to decrypt the key fileInvalidAlgorithmParameterException
- thrown if the cipher algorithm is not supported to decrypt the key
fileSignatureException
- thrown when there was an error signing data to be sent to Absio
BrokerIOException
- thrown when there are any IO issuesIllegalArgumentException
- thrown if the user id or passphrase are not providedInterruptedException
- thrown when there is an interruption during rate limitingSQLException
- thrown if the user is authenticated and there are issues closing the
databasepublic void logIn(KeyRing keyRing) throws IllegalAccessException, BrokerException, SignatureException, InvalidKeyException, IOException, InterruptedException, NoSuchPaddingException, NoSuchAlgorithmException, SQLException
NOTE: This will throw an exception on failure. When successful the session will be authenticated.
NOTE: this requires an initialized session.
keyRing
- the user's private key ring.BrokerException
- thrown when the Absio Broker™ application has an issue with the requestSignatureException
- thrown when there was an error signing data to be sent to Absio BrokerIOException
- thrown when there are any IO issuesInvalidKeyException
- thrown when there was an error with the key for signing data to be sent to Absio
BrokerIllegalAccessException
- thrown if the session is not initializedInterruptedException
- thrown when there is an interruption during rate limitingNoSuchAlgorithmException
- thrown if the hash algorithm is not support in the OFSNoSuchPaddingException
- thrown if the padding is not supported to decrypt the key fileSQLException
- thrown if there was an issue opening/closing the database with the wrong signing
keypublic void logOut() throws SQLException
SQLException
- thrown if there are any issues closing the databasepublic boolean needToSyncAccount(UUID userId) throws IllegalAccessException, NoSuchAlgorithmException, BrokerException, IOException, InterruptedException
OFS
and checks if it matches the checksum
of a keys file stored on the Absio Broker™ application.
NOTE: this requires an initialized session.
userId
- the user's IDBrokerException
- thrown when the Absio Broker™ application has an issue with the requestIOException
- thrown when there are any IO issuesNoSuchAlgorithmException
- thrown when a cryptographic algorithm is not supportedInterruptedException
- thrown when there is an interruption during rate limitingIllegalAccessException
- thrown if the session is not initializedpublic byte[] register(String password, String passphrase) throws IllegalArgumentException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IllegalAccessException, NoSuchPaddingException, IllegalBlockSizeException, IOException, BadPaddingException, SignatureException, InvalidKeyException, BrokerException, InterruptedException, SQLException
NOTE: this requires an initialized session.
NOTE: Both the password and passphrase are required. If they are not supplied an ArgumentException will be thrown.
This will throw an exception on failure. When successful the session will be authenticated.
password
- the new user's password (required)passphrase
- the new user's passphrase (required)IllegalArgumentException
- thrown if the password or passphrase are empty or nullInvalidAlgorithmParameterException
- thrown if the cipher algorithm is not supported to decrypt the key
fileNoSuchAlgorithmException
- thrown if the algorithm is not known to decrypt the key fileIllegalAccessException
- thrown if the session is not initializedIOException
- thrown when there are any IO issuesBrokerException
- thrown when the Absio Broker™ application has an issue with the
requestSignatureException
- thrown when there was an error signing data to be sent to Absio
BrokerInvalidKeyException
- thrown when there was an error with the key for signing data to be
sent to Absio BrokerNoSuchPaddingException
- thrown if the padding is not supported to decrypt the key fileBadPaddingException
- thrown if the cipher padding is not supported to decrypt the key fileIllegalBlockSizeException
- thrown if the cipher block size is wrong to decrypt the key fileInterruptedException
- thrown when there is an interruption during rate limitingSQLException
- thrown if there was an issue opening/closing the database with the
wrong signing keypublic byte[] register(String password, String passphrase, String reminder) throws IllegalArgumentException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IllegalAccessException, IOException, BrokerException, SignatureException, InvalidKeyException, NoSuchPaddingException, BadPaddingException, IllegalBlockSizeException, InterruptedException, SQLException
NOTE: this requires an initialized session.
password
- the new user's password (required)passphrase
- the new user's passphrase (required)reminder
- the new user's reminder (optional - will be blank if not provided)IllegalArgumentException
- thrown if the password or passphrase are empty or nullInvalidAlgorithmParameterException
- thrown if the cipher algorithm is not supported to decrypt the key
fileNoSuchAlgorithmException
- thrown if the algorithm is not known to decrypt the key fileIllegalAccessException
- thrown if the session is not initializedIOException
- thrown when there are any IO issuesBrokerException
- thrown when the Absio Broker™ application has an issue with the
requestSignatureException
- thrown when there was an error signing data to be sent to Absio
BrokerInvalidKeyException
- thrown when there was an error with the key for signing data to be
sent to Absio BrokerNoSuchPaddingException
- thrown if the padding is not supported to decrypt the key fileBadPaddingException
- thrown if the cipher padding is not supported to decrypt the key fileIllegalBlockSizeException
- thrown if the cipher block size is wrong to decrypt the key fileInterruptedException
- thrown when there is an interruption during rate limitingSQLException
- thrown if there was an issue opening/closing the database with the
wrong signing keypublic void setForceGetFromServer(boolean forceGetFromServer)
SecuredContainer
retrieval methods like get(UUID)
will always download from Absio
Broker and attempt to cache them in the OFS
. If false, the OFS
cache will be used first and Absio
Broker will be used if not available.forceGetFromServer
- whether to force download containers from Absio Broker or use the OFS
cachepublic void synchronizeAccount(String password, String passphrase) throws NoSuchPaddingException, InterruptedException, NoSuchAlgorithmException, IOException, InvalidKeyException, BrokerException, InvalidAlgorithmParameterException, BadPaddingException, IllegalBlockSizeException, IllegalAccessException
password
- the user's passwordpassphrase
- the user's secret passphraseBrokerException
- thrown when the Absio Broker™ application has an issue with the
requestIOException
- thrown when there are any IO issuesNoSuchPaddingException
- thrown if the default padding for symmetric encryption is not
supportedNoSuchAlgorithmException
- thrown when a cryptographic algorithm is not supportedInvalidKeyException
- thrown when the secret key is improperly formattedInterruptedException
- thrown when there is an interruption during rate limitingInvalidAlgorithmParameterException
- thrown if the cipher algorithm is not supportedIllegalBlockSizeException
- thrown if the cipher block size is wrongBadPaddingException
- thrown if the cipher padding is not supportedIllegalAccessException
- thrown if the session is not authenticatedpublic SecuredContainer update(UUID containerId, byte[] content, String headerString, List<Access> accesses, String type) throws Exception
OFS
cache.
NOTE: this requires an initialized and authenticated session.
update
in interface IContainerProvider
containerId
- the id of the secured container to updatecontent
- the new contentheaderString
- the new headeraccesses
- This is the defined access for all users. If null, the user updating the container will get
full access (Access.DefaultOwnerPermissions). If any access is defined then the user creating
the updating will get the defined access or no access if none is defined.type
- the new typeSecuredContainer
with the new metadata from the Absio Broker™ applicationException
- thrown if there any issues encrypting and updating the data on the Absio Broker™
applicationpublic void updateAccess(UUID containerId, List<Access> accessLevels) throws IOException, InterruptedException, BrokerException, IllegalAccessException
SecuredContainer
on the Absio Broker™ application and updates the local
OFS
cache.
NOTE: this requires an initialized and authenticated session.
updateAccess
in interface IContainerProvider
containerId
- the id of the SecuredContainer
to update access foraccessLevels
- the new access list for the SecuredContainer
InterruptedException
- thrown when there is an interruption during rate limitingBrokerException
- thrown when the Absio Broker™ application has an issue with the requestIOException
- thrown when there are any IO issuesIllegalAccessException
- thrown if the session is not authenticatedpublic SecuredContainer updateContent(UUID containerId, byte[] newContent) throws Exception
SecuredContainer
on the Absio Broker™ application and updates the local
OFS
cache.
NOTE: this requires an initialized and authenticated session.
updateContent
in interface IContainerProvider
containerId
- the id of the secured container to update the content ofnewContent
- the new contentSecuredContainer
with the new metadata from the Absio Broker™ applicationException
- thrown if there any issues encrypting and updating the data on the Absio Broker™
applicationpublic SecuredContainer updateHeader(UUID containerId, String headerString) throws Exception
OFS
cache.
NOTE: this requires an initialized and authenticated session.
updateHeader
in interface IContainerProvider
containerId
- the id of the secured containerheaderString
- the new headerException
- thrown if there are any issues encrypting and updating the header in the file systempublic void updateType(UUID containerId, String type) throws IOException, InterruptedException, BrokerException, IllegalAccessException, ContainerNotFoundException, SQLException
SecuredContainer
on the Absio Broker™ application and updates the local OFS
cache.
NOTE: this requires an initialized and authenticated session.
updateType
in interface IContainerProvider
containerId
- the id of the SecuredContainer
to update the type fortype
- the new type value for the SecuredContainer
InterruptedException
- thrown when there is an interruption during rate limitingBrokerException
- thrown when the Absio Broker™ application has an issue with the requestIOException
- thrown when there are any IO issuesIllegalAccessException
- thrown if the session is not authenticatedSQLException
- thrown if there was an issue updating the type in the databaseContainerNotFoundException
- thrown if the container is not in the databaseCopyright © 2021. All rights reserved.