public class PaddedEphemerallyEncryptedBucket extends java.lang.Object implements Bucket, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static int |
MAGIC |
static int |
MIN_PADDED_SIZE |
Modifier | Constructor and Description |
---|---|
protected |
PaddedEphemerallyEncryptedBucket() |
|
PaddedEphemerallyEncryptedBucket(Bucket bucket,
int minSize,
RandomSource strongPRNG,
java.util.Random weakPRNG)
Create a padded encrypted proxy bucket.
|
protected |
PaddedEphemerallyEncryptedBucket(java.io.DataInputStream dis,
FilenameGenerator fg,
PersistentFileTracker persistentFileTracker,
MasterSecret masterKey) |
|
PaddedEphemerallyEncryptedBucket(PaddedEphemerallyEncryptedBucket orig,
Bucket newBucket) |
Modifier and Type | Method and Description |
---|---|
Bucket |
createShadow()
Create a shallow read-only copy of this bucket, using different
objects but using the same external storage.
|
void |
free()
Free the bucket, if supported.
|
java.io.InputStream |
getInputStream()
Returns an InputStream that reads data from this Bucket.
|
java.io.InputStream |
getInputStreamUnbuffered() |
byte[] |
getKey()
Get the decryption key.
|
java.lang.String |
getName()
Returns a name for the bucket, may be used to identify them in
certain in certain situations.
|
java.io.OutputStream |
getOutputStream()
Returns an OutputStream that is used to put data in this Bucket, from the
beginning.
|
java.io.OutputStream |
getOutputStreamUnbuffered()
Get an OutputStream which is not buffered.
|
PCFBMode |
getPCFB() |
Bucket |
getUnderlying() |
boolean |
isReadOnly()
Is the bucket read-only?
|
void |
onResume(ClientContext context)
Called after restarting.
|
long |
paddedLength() |
static long |
paddedLength(long dataLength,
long minPaddedSize)
Return the length of the data in the proxied bucket, after padding.
|
void |
setReadOnly()
Make the bucket read-only.
|
long |
size()
Returns the amount of data currently in this bucket in bytes.
|
void |
storeTo(java.io.DataOutputStream dos)
Write enough data to reconstruct the Bucket, or throw UnsupportedOperationException.
|
java.lang.String |
toString() |
public static final int MIN_PADDED_SIZE
public static final int MAGIC
public PaddedEphemerallyEncryptedBucket(Bucket bucket, int minSize, RandomSource strongPRNG, java.util.Random weakPRNG)
bucket
- The bucket which we are proxying to. Must be empty.minSize
- The minimum padded size of the file (after it has been closed).strongPRNG
- a strong prng we will key from.weakPRNG
- a week prng we will padd from.
Serialization: Note that it is not our responsibility to free the random number generators,
but we WILL free the underlying bucket.UnsupportedCipherException
public PaddedEphemerallyEncryptedBucket(PaddedEphemerallyEncryptedBucket orig, Bucket newBucket)
protected PaddedEphemerallyEncryptedBucket()
protected PaddedEphemerallyEncryptedBucket(java.io.DataInputStream dis, FilenameGenerator fg, PersistentFileTracker persistentFileTracker, MasterSecret masterKey) throws StorageFormatException, java.io.IOException, ResumeFailedException
StorageFormatException
java.io.IOException
ResumeFailedException
public java.io.OutputStream getOutputStream() throws java.io.IOException
Bucket
getOutputStream
in interface Bucket
java.io.IOException
public java.io.OutputStream getOutputStreamUnbuffered() throws java.io.IOException
Bucket
getOutputStreamUnbuffered
in interface Bucket
java.io.IOException
public java.io.InputStream getInputStream() throws java.io.IOException
Bucket
getInputStream
in interface Bucket
java.io.IOException
public java.io.InputStream getInputStreamUnbuffered() throws java.io.IOException
getInputStreamUnbuffered
in interface Bucket
java.io.IOException
public long paddedLength()
public static long paddedLength(long dataLength, long minPaddedSize)
public PCFBMode getPCFB()
public java.lang.String getName()
Bucket
public java.lang.String toString()
toString
in class java.lang.Object
public long size()
Bucket
public boolean isReadOnly()
Bucket
isReadOnly
in interface Bucket
public void setReadOnly()
Bucket
setReadOnly
in interface Bucket
public Bucket getUnderlying()
public void free()
Bucket
public byte[] getKey()
public Bucket createShadow()
Bucket
createShadow
in interface Bucket
public void onResume(ClientContext context) throws ResumeFailedException
Bucket
onResume
in interface Bucket
context
- All the necessary runtime support will be on this object.ResumeFailedException
public void storeTo(java.io.DataOutputStream dos) throws java.io.IOException
Bucket