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.UnsupportedCipherExceptionpublic 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
StorageFormatExceptionjava.io.IOExceptionResumeFailedExceptionpublic java.io.OutputStream getOutputStream()
throws java.io.IOException
BucketgetOutputStream in interface Bucketjava.io.IOExceptionpublic java.io.OutputStream getOutputStreamUnbuffered()
throws java.io.IOException
BucketgetOutputStreamUnbuffered in interface Bucketjava.io.IOExceptionpublic java.io.InputStream getInputStream()
throws java.io.IOException
BucketgetInputStream in interface Bucketjava.io.IOExceptionpublic java.io.InputStream getInputStreamUnbuffered()
throws java.io.IOException
getInputStreamUnbuffered in interface Bucketjava.io.IOExceptionpublic long paddedLength()
public static long paddedLength(long dataLength,
long minPaddedSize)
public PCFBMode getPCFB()
public java.lang.String getName()
Bucketpublic java.lang.String toString()
toString in class java.lang.Objectpublic long size()
Bucketpublic boolean isReadOnly()
BucketisReadOnly in interface Bucketpublic void setReadOnly()
BucketsetReadOnly in interface Bucketpublic Bucket getUnderlying()
public void free()
Bucketpublic byte[] getKey()
public Bucket createShadow()
BucketcreateShadow in interface Bucketpublic void onResume(ClientContext context) throws ResumeFailedException
BucketonResume in interface Bucketcontext - All the necessary runtime support will be on this object.ResumeFailedExceptionpublic void storeTo(java.io.DataOutputStream dos)
throws java.io.IOException
Bucket