Never though I'm going to dive so deep in this Win32 rabbit hole.
I was originally thinking just wrote a simple wrapper of win32's tape API, but then I realized that the encryption is missing. With Win32's tape api, you can basically implement something like `/dev/st0` (simple read and write) amd `mt` command (rewind, seek, set compression, etc.). I was thinking just use LTOEnc for encryption control.
But that software can only read the encryption key from a file, which, to me, is a big security hole: I can do that in memory, why write to the disk temporarily?
So I start reading LTOEnc's code. I found Microsoft really don't want you to directly talk to SCSI. I read their documents, they never said about IOCTL_SCSI_PASS_THROUGH_DIRECT. They are recommending something like IOCTL_CDROM or something that is not so lower level.
Anyway, thanks to LTOEnc, and Oracle's helpdesk generously providing HPE product's tech ref manual, I now can implement the encryption control in my win32 lib. And soon I can do that in Java.
@skyblond Are you working with LTO-related APIs at work or for fun? If I had some spare money, I'd love to get my hands on an LTO (maybe 4~5 gen) device.
@overflowcat 我买的是LTO 6,因为想一步到位。不然过几年换代的时候还要处理电子垃圾。不过LTO本身换代挺勤的,现在已经LTO 9了,而且向下兼容也缩减了。说好的30年存储,如果30年后没有能用的设备来读这些陈年磁带,那还不如不搞。
企业那边经常需要随着LTO标准更新换代,这样就有二手的廉价LTO磁带机。听说再过个两三年LTO 7的磁带机就该被换下来了。目前主流还是LTO 6,5代尚可接受(加密压缩全都有,还有LTFS),4代的话就只能用tar那种,没有LTFS支持。