encrypt

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package encrypt : 对称加密解密工具包

Index

Constants

This section is empty.

Variables

View Source
var DataIsNil = errors.New("encrypt data is nil")

Functions

func Decrypt

func Decrypt(data []byte) ([]byte, error)

Decrypt 解密

func DecryptString

func DecryptString(encryptData string) (decrypt string, err error)

DecryptString 解密一个hex密文字符串为明文字符串

func Encrypt

func Encrypt(data []byte) ([]byte, error)

Encrypt 加密

func Init

func Init(option ...Option) error

Init 初始化

Types

type Option

type Option func(r *config)

Option 选项

func WithKey

func WithKey(key string) Option

WithKey 设置加密key

func WithKeyType

func WithKeyType(eType string) Option

WithKeyType 设置加密类型:sm4 / aes

func WithP11Handle

func WithP11Handle(p11Handle *pkcs11.P11Handle) Option

WithP11Handle 设置p11句柄

Directories

Path Synopsis
Created by guoxin in 2024/7/11 上午9:44
Created by guoxin in 2024/7/11 上午9:44

Jump to

Keyboard shortcuts

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