public abstract class CryptoContainer
extends java.lang.Object
Constructor and Description |
---|
CryptoContainer() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
createContainerFileName(java.lang.String fileName)
Create a CDOC container file name based on some other file name.
|
abstract com.google.common.collect.ImmutableList<java.io.File> |
dataFiles()
List of data files.
|
CryptoContainer |
decrypt(DecryptToken decryptToken,
Certificate authCertificate,
java.lang.String pin1,
java.io.File dataFilesDirectory)
Decrypt the container.
|
abstract boolean |
decrypted()
Whether this container is decrypted.
|
static CryptoContainer |
encrypt(com.google.common.collect.ImmutableList<java.io.File> dataFiles,
com.google.common.collect.ImmutableList<Certificate> recipients,
java.io.File file)
Create a new crypto container with provided data files and recipients.
|
abstract java.io.File |
file()
Location of the container.
|
static boolean |
isContainerFileName(java.lang.String fileName)
Checks whether the name is a CDOC container file name by extension.
|
static CryptoContainer |
open(java.io.File file)
Open an existing CDOC file.
|
abstract com.google.common.collect.ImmutableList<Certificate> |
recipients()
List of recipients.
|
public abstract java.io.File file()
public abstract com.google.common.collect.ImmutableList<java.io.File> dataFiles()
decrypted()
is true then it's an absolute path to the file,
otherwise only data file name is present.public abstract com.google.common.collect.ImmutableList<Certificate> recipients()
public abstract boolean decrypted()
public CryptoContainer decrypt(DecryptToken decryptToken, Certificate authCertificate, java.lang.String pin1, java.io.File dataFilesDirectory) throws CryptoException
decryptToken
- Token used to decrypt.authCertificate
- Authentication certificate.pin1
- PIN1 for the authentication certificate.dataFilesDirectory
- Directory where the data files are saved.Pin1InvalidException
- When PIN1 is incorrect.CertificateNotRecipientException
- When provided certificate is not in recipients list.CryptoException
- When decryption fails.@WorkerThread public static CryptoContainer open(java.io.File file) throws CryptoException
file
- Path to the file.CryptoException
- When opening or parsing the container file fails.@WorkerThread public static CryptoContainer encrypt(com.google.common.collect.ImmutableList<java.io.File> dataFiles, com.google.common.collect.ImmutableList<Certificate> recipients, java.io.File file) throws CryptoException
dataFiles
- Data files.recipients
- Recipients.file
- Path to the created crypto container file.DataFilesEmptyException
- When no data files provided.RecipientsEmptyException
- When no recipients provided.CryptoException
- When something failed with encryption.public static boolean isContainerFileName(java.lang.String fileName)
fileName
- File name to check.public static java.lang.String createContainerFileName(java.lang.String fileName)
fileName
- Some other file name.