vpcrypto

package
v0.0.0-...-bf055c7 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package vpcrypto contains some cryptographic utilities to sign and crypt content, mostly a wrapper over openpgp API.

Index

Constants

View Source
const PackageCopyright = "Copyright (C)  2015, 2016  Christian Mauduit <ufoot@ufoot.org>" // PackageCopyright set by version.sh

PackageCopyright contains a short copyright notice.

View Source
const PackageEmail = "ufoot@ufoot.org" // PackageEmail set by version.sh

PackageEmail contains a contact email for the package.

View Source
const PackageLicense = "GNU GPL v3" // PackageLicense set by version.sh

PackageLicense contains a short license information.

View Source
const PackageName = "Vapor Toolkit" // PackageName set by version.sh

PackageName contains a readable name of the package, suitable for display.

View Source
const PackageTarname = "vapor" // PackageTarname set by version.sh

PackageTarname contains a short name of the package, suitable for a filename.

View Source
const PackageURL = "https://github.com/ufoot/vapor" // PackageURL set by version.sh

PackageURL contains the address of the project homepage.

View Source
const VersionMajor = 0 // VersionMajor set by version.sh

VersionMajor is the project major version.

View Source
const VersionMinor = 5 // VersionMinor set by version.sh

VersionMinor is the project minor version.

View Source
const VersionStamp = "c6a4298" // VersionStamp set by version.sh

VersionStamp is the project stamp, possibly changes for each build.

Variables

This section is empty.

Functions

func SymDecrypt

func SymDecrypt(content, password []byte) ([]byte, error)

SymDecrypt decrypts a message crypted using a symmetric password/key.

func SymEncrypt

func SymEncrypt(content, password []byte) ([]byte, error)

SymEncrypt encrypts a message using a symmetric password/key.

Types

type Key

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

Key contains a cryptographic key pair. It might only contain a public key if it has been imported from a public key export. In that case it can not be used for signing and decrypting messages.

func ImportPubKey

func ImportPubKey(key []byte) (*Key, error)

ImportPubKey creates a key from an exported public key.

func NewKey

func NewKey() (*Key, error)

NewKey returns a new pair of cryptographic keys. Note that this function is rather slow, it can take up to one second or more, even on a powerfull computer, so don't generate keys often.

func (Key) CheckSig

func (key Key) CheckSig(content, sig []byte) (bool, error)

CheckSig checks a signature. This can be done with a public key, even if private key is not available.

func (Key) Decrypt

func (key Key) Decrypt(content []byte) ([]byte, error)

Decrypt decrypts a message. Note that the key must contain a private key, it is not possible to sign with a public key.

func (Key) Encrypt

func (key Key) Encrypt(content []byte) ([]byte, error)

Encrypt encrypts a message. This can be done with a public key, even if private key is not available.

func (Key) ExportPub

func (key Key) ExportPub() ([]byte, error)

ExportPub exports the public key of a key pair.

func (Key) Sign

func (key Key) Sign(content []byte) ([]byte, error)

Sign signs a content with a key. Note that the key must contain a private key, it is not possible to sign with a public key.

Jump to

Keyboard shortcuts

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