gemina

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package gemina provides an implementation of the Gemina specification for data encryption.

See section "Description" in the specification: https://github.com/andreas19/gemina-spec#description

Index

Constants

View Source
const (
	PackageVersion = "0.2.0"
)

Variables

View Source
var (
	ErrUnknownVersion = errors.New("gemina: unknown version")
	ErrDecryption     = errors.New("gemina: cannot decrypt data")
)

Functions

func CreateSecretKey

func CreateSecretKey(version Version) ([]byte, error)

CreateSecretKey creates a secret key that can be used with the functions EncryptWithKey(), DecryptWithKey(), and VerifyWithKey().

func DecryptWithKey

func DecryptWithKey(key, data []byte) ([]byte, error)

DecryptWithKey decrypts data with the given secret key.

func DecryptWithPassword

func DecryptWithPassword(password, data []byte) ([]byte, error)

DecryptWithPassword decrypts data with the given password.

func EncryptWithKey

func EncryptWithKey(key, data []byte, version Version) ([]byte, error)

EncryptWithKey encrypts data with the given secret key and version.

func EncryptWithPassword

func EncryptWithPassword(password, data []byte, version Version) ([]byte, error)

EncryptWithPassword encrypts data with the given password and version.

func VerifyWithKey

func VerifyWithKey(key, data []byte) bool

VerifyWithKey verifies data with the given secret key.

func VerifyWithPassword

func VerifyWithPassword(password, data []byte) bool

VerifyWithPasswordverifies verifies data with the given password.

Types

type Version

type Version byte
const (
	Version1 Version = 0x8a
	Version2 Version = 0x8b
	Version3 Version = 0x8c
	Version4 Version = 0x8d
	Version5 Version = 0x8e
)

Jump to

Keyboard shortcuts

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