crypto

package
v1.999.16 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(encrypted *EncryptedData, pubkey *Pubkey, privkey *Privkey) ([]byte, error)

func DecryptSymmetric

func DecryptSymmetric(encrypted *EncryptedData, key []byte) ([]byte, error)

func SignJsonDetached

func SignJsonDetached(obj interface{}, privkey *Privkey) (string, error)

func VerifyDetached

func VerifyDetached(message, sig []byte, pubkey *Pubkey) error

func VerifyPubkeySignature

func VerifyPubkeySignature(signedPubkey, signerPubkey *Pubkey) error

func VerifyPubkeyWithPrivkey

func VerifyPubkeyWithPrivkey(pubkey *Pubkey, privkey *Privkey) error

func VerifySignedCleartext

func VerifySignedCleartext(signed []byte, pubkey *Pubkey) ([]byte, error)

Types

type EncryptedData

type EncryptedData struct {
	Data  string `json:"data"`
	Nonce string `json:"nonce"`
}

func Encrypt

func Encrypt(msg []byte, pubkey *Pubkey, privkey *Privkey) (*EncryptedData, error)

func EncryptSymmetric added in v1.999.15

func EncryptSymmetric(msg []byte, key []byte) *EncryptedData

type EncryptedKeypair

type EncryptedKeypair struct {
	Pubkey           Pubkey        `json:"pubkey"`
	EncryptedPrivkey EncryptedData `json:"encryptedPrivkey"`
}

type EncryptionAndSigningKeys

type EncryptionAndSigningKeys struct {
	SigningKey    string `json:"signingKey"`
	EncryptionKey string `json:"encryptionKey"`
}

type Keypair

type Keypair struct {
	Pubkey  Pubkey
	Privkey Privkey
}

type Privkey

type Privkey struct {
	Keys EncryptionAndSigningKeys `json:"keys"`
}

type Pubkey

type Pubkey struct {
	Keys      EncryptionAndSigningKeys `json:"keys"`
	Signature string                   `json:"signature"`
}

type SignedData

type SignedData struct {
	Data string `json:"data"`
}

func SignJson

func SignJson(obj interface{}, privkey *Privkey) (*SignedData, error)

Jump to

Keyboard shortcuts

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