Documentation
¶
Overview ¶
Package keyderiv owns version-separated HKDF-SHA256 derivation.
V1 retains its historical literal info bytes. Suite 0x02 uses ASCII(label)||0x00||context for every branch; keeping the schemes in distinct functions prevents a caller from accidentally applying one version's domain convention to the other.
Index ¶
- Constants
- Variables
- func ManifestKey(readSecret []byte) []byte
- func SegKey(streamKey []byte, seg uint32) []byte
- func StreamKey(readSecret []byte) []byte
- func V2CatalogKey(readSecret, shareInstance []byte) ([]byte, error)
- func V2DescriptorKey(readSecret, pkHash []byte) ([]byte, error)
- func V2FileObjectKey(readSecret, shareInstance, fileID []byte) ([]byte, error)
- func V2FileSegmentKey(revisionKey []byte, segment uint64) ([]byte, error)
- func V2RevisionKey(fileObjectKey, fileRevision []byte) ([]byte, error)
- func V2SessionAuthKey(readSecret, shareInstance []byte) ([]byte, error)
Constants ¶
const ( V2ReadSecretBytes = 16 V2IdentityBytes = 16 V2PKHashBytes = 16 )
const ( V2DescriptorLabel = "windshare/v2 descriptor" V2CatalogLabel = "windshare/v2 catalog" V2FileObjectLabel = "windshare/v2 file-object" V2RevisionLabel = "windshare/v2 file-revision" V2FileSegmentLabel = "windshare/v2 file-segment" V2SessionAuthLabel = "windshare/v2 session-auth" )
const KeyBytes = 32
KeyBytes 是全部派生密钥的统一长度(AES-256 密钥)。
Variables ¶
var ErrV2KeyMaterial = errors.New("keyderiv: invalid suite-0x02 key material")
Functions ¶
func ManifestKey ¶
ManifestKey 派生清单封装密钥:HKDF(readSecret, "windshare/v1 manifest", 32)。
func SegKey ¶
SegKey 派生第 seg 段(每 SegmentBytes 轮换)的块加密密钥: HKDF(streamKey, "windshare/v1 seg"‖u32_be(seg), 32)。 段号入 info 而非 salt,与另两条派生保持同构(salt 一律为空)。
func StreamKey ¶
StreamKey 派生打包流根密钥:HKDF(readSecret, "windshare/v1 stream", 32)。 它不直接加密任何块,只作为各段 SegKey 的派生输入。
func V2CatalogKey ¶
V2CatalogKey scopes all catalog generations to one share instance.
func V2DescriptorKey ¶
V2DescriptorKey binds the bootstrap object key to the sender public-key hash.
func V2FileObjectKey ¶
V2FileObjectKey isolates revision descriptors by share and file identities.
func V2FileSegmentKey ¶
V2FileSegmentKey rotates block keys every 16 GiB without narrowing the segment index.
func V2RevisionKey ¶
V2RevisionKey ensures a revision change rotates the complete block-key subtree.
func V2SessionAuthKey ¶
V2SessionAuthKey authenticates the transcript before sender resource admission.
Types ¶
This section is empty.