soft

package
v0.0.0-...-ebe581b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

README

软加密方案

1、该实现实用分片的信息做参数,从 seed 派生出唯一的对称加密密钥,实用该密钥对分片进行加密

2、派生算法为 hkdf, 使用 sliceID 和 nodeID 派生秘钥

3、每个分片定位到每个目标节点上派生的加密密钥都是不同的

4、当前方案将来可以移植到可信区,作为硬加解密实现方案

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SoftEncryptor

type SoftEncryptor struct {
	// contains filtered or unexported fields
}

SoftEncryptor encrypts data or decrypts encoded data

func New

New creat SoftEncryptor by "password" configuration

func (*SoftEncryptor) Encrypt

Encrypt derive key using nodeID and slice ID, then encrypt content using AES-GCM

func (*SoftEncryptor) GetKey

func (se *SoftEncryptor) GetKey(fileID, sliceID string, nodeID []byte) aes.AESKey

GetKey derive key using fileID, nodeID and slice ID

func (*SoftEncryptor) Recover

func (se *SoftEncryptor) Recover(r io.Reader, opt *encryptor.RecoverOptions) (
	[]byte, error)

Recover derive key using nodeID and slice ID, then decrypt content using AES-GCM

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL