File encryption

This interface helps you use symmetric encryption algorithms to encrypt the files you are about to upload.Here is the sample code to encrypt data.

package main

import (
	"fmt"
	"errors"
	"github.com/CESSProject/cess-go-sdk/core/crypte"
)

func main(){
    data:=[]byte("test user file data...")
    key:=[]byte("test user aes key")
    cipherText,err:=crypte.AesCbcEncrypt(data,key)
    if err!=nil{
        fmt.Println("encrypt data error",err)
    }
    fmt.Println("encrypt data sucess, the cipher text is :",cipherText)
}

In fact, CESS officially recommends that you preprocess the file before performing encryption operations, such as redundant encoding and file fragmentation, and then encrypt each fragment separately, which will help improve the efficiency of file encryption.

Last updated