crypto

package
v0.0.0-...-2e0f108 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 16 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 V1Decrypt

func V1Decrypt(cipherArmored []byte, keys openpgp.EntityList) ([]byte, error)

func V1DecryptAndVerify

func V1DecryptAndVerify(cipherArmored []byte, keys openpgp.EntityList) ([]byte, error)

func V1Encrypt

func V1Encrypt(msg []byte, pubkeys openpgp.EntityList) ([]byte, error)

func V1MakeKeyring

func V1MakeKeyring(decryptedPrivkey openpgp.EntityList, pubkeyArmored []byte) (openpgp.EntityList, error)

func V1ReadArmoredKey

func V1ReadArmoredKey(armoredKey []byte) (openpgp.EntityList, error)

func V1ReadPrivkey

func V1ReadPrivkey(encryptedPrivkeyArmored, pw []byte) (openpgp.EntityList, error)

func V1VerifyPubkeyArmoredSignature

func V1VerifyPubkeyArmoredSignature(signedPubkeyArmored, signerPubkeyArmored []byte) error

func V1VerifyPubkeySignature

func V1VerifyPubkeySignature(signedPubkey, signerPubkey openpgp.EntityList) error

func V1VerifyPubkeyWithPrivkey

func V1VerifyPubkeyWithPrivkey(pubkey, decryptedPrivkey openpgp.EntityList) error

func V1VerifySignedCleartext

func V1VerifySignedCleartext(message []byte, keys openpgp.EntityList) ([]byte, 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

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