-
-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
I am using it on Android. The header is not encrypted when archiving 7z with password and setHeaderEncryption(true)
RandomAccessFile(sevenZFile, "rw").use { raf ->
val outArchive = SevenZip.openOutArchive7z()
outArchive.setLevel(compressionLevel)
outArchive.setSolid(solid)
outArchive.setSolidSize(8192)
outArchive.setThreadCount(threadCount)
outArchive.setHeaderEncryption(true)
outArchive.createArchive(
RandomAccessFileOutStream(raf), filesToArchive.size,
object : IOutCreateCallback<IOutItem7z>, ICryptoGetTextPassword {
override fun cryptoGetTextPassword(): String? {
return password
}
override fun setOperationResult(operationResultOk: Boolean) {
}
override fun setTotal(total: Long) {
}
override fun setCompleted(complete: Long) {
}
override fun getItemInformation(index: Int, outItemFactory: OutItemFactory<IOutItem7z>): IOutItem7z {
val item = outItemFactory.createOutItem()
val file = File(filesToArchive[index])
val relativePath = file.absolutePath.removePrefix(baseDirectory).removePrefix("/")
item.dataSize = file.length()
item.propertyPath = relativePath
item.propertyIsDir = file.isDirectory
item.propertyLastModificationTime = Date(file.lastModified())
return item
}
override fun getStream(i: Int): ISequentialInStream {
return RandomAccessFileInStream(RandomAccessFile(filesToArchive[i], "r"))
}
})
outArchive.close()
}
}
Metadata
Metadata
Assignees
Labels
No labels