Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypt(key, payload []byte) ([]byte, error)
- func Encrypt(key, data []byte, version ...*uint16) ([]byte, error)
- func MakePayload(version uint16, encryptedData []byte) ([]byte, error)
- func NewSecretKey(length int) ([]byte, error)
- func NewSecretKeyBase64(length int) (string, error)
- func SplitPayload(payload []byte) (uint16, []byte, error)
- func VersionBytes(version uint16) ([]byte, error)
Constants ¶
View Source
const MaximumVersion = 1
MaximumVersion maximum supported encryption version
View Source
const MinimumVersion = 1
MinimumVersion minimum supported encryption version
View Source
const (
Version1 = 1
)
standard GCM sizes
View Source
const VersionLength = 16
VersionLength length of byte array containing verison data
Variables ¶
View Source
var ErrUnsupportedVersion = errors.New("unsupported encryption version")
ErrUnsupportedVersion unsupported encryption version
Functions ¶
func MakePayload ¶
MakePayload creates a payload containing the version and encrypted data
func NewSecretKey ¶
NewSecretKey generates a new secret key of specified length
func NewSecretKeyBase64 ¶
NewSecretKeyBase64 generates a new secret key of specified length
func SplitPayload ¶
SplitPayload returns the version and encrypted data as separate variables by splitting the payload
func VersionBytes ¶
VersionBytes converts a version to a byte array with range validation
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.