// FIXME no compression for now.
byte[] cryptoKey = randomKey();
byte cryptoAlgorithm = Key.ALGO_AES_CTR_256_SHA256;
ClientCHK[] dataKeys = makeKeys(originalDataBlocks, cryptoKey, cryptoAlgorithm);
ClientCHK[] checkKeys = makeKeys(originalCheckBlocks, cryptoKey, cryptoAlgorithm);
Metadata m = new Metadata(SplitfileAlgorithm.ONION_STANDARD, dataKeys, checkKeys, segmentSize,
checkSegmentSize, deductBlocksFromSegments, cm, size, null, null, size, false, null, null,
size, size, dataBlocks, dataBlocks + checkBlocks, false, topCompatibilityMode,
cryptoAlgorithm, cryptoKey, true /* FIXME try older splitfiles pre-single-key?? */,
0);
// Make sure the metadata is reusable.
// FIXME also necessary as the above constructor doesn't set segments.
Bucket metaBucket = m.toBucket(bf);
Metadata m1 = Metadata.construct(metaBucket);
Bucket copyBucket = m1.toBucket(bf);
assertTrue(BucketTools.equalBuckets(metaBucket, copyBucket));
metaBucket.free();
copyBucket.free();
return new TestSplitfile(data, m1, originalDataBlocks, originalCheckBlocks, dataKeys, checkKeys,
cryptoKey, cryptoAlgorithm, segmentDataBlockCount, segmentCheckBlockCount, persistent);