crypto

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(name string, k any) *pem.Block

func GenerateAttribKeys

func GenerateAttribKeys(sk *abe.FAMESecKey, attributes []string, fileName string)

func GenerateFAMEKeys

func GenerateFAMEKeys()

func SymKeygen

func SymKeygen() [32]byte

func UnmarshalFameAttrKey

func UnmarshalFameAttrKey(data []byte) (*abe.FAMEAttribKeys, error)

Decode a FameKey from a byte array

func UnmarshalFamePrivKey

func UnmarshalFamePrivKey(data []byte) (*abe.FAMESecKey, error)

func UnmarshalFamePubKey

func UnmarshalFamePubKey(data []byte) (*abe.FAMEPubKey, error)

Types

type AeadCipher

type AeadCipher struct {
	cipher.AEAD
	// contains filtered or unexported fields
}

AeadCipher is an AEAD cipher

func (AeadCipher) Decrypt

func (c AeadCipher) Decrypt(n uint64, ad, ciphertext []byte) (string, error)

func (AeadCipher) Encrypt

func (c AeadCipher) Encrypt(n uint64, ad, plaintext string) ([]byte, error)

type Cipher

type Cipher interface {
	Encrypt(uint64, string, string) ([]byte, error)
	Decrypt(uint64, []byte, []byte) (string, error)
}

Cipher is either an AEAD cipher or a CPABE scheme initialized with keys

func CipherAESGCM

func CipherAESGCM(key [32]byte) Cipher

Creates a new AESGCM cipher with the given key

func CipherChaChaPoly

func CipherChaChaPoly(key [32]byte) Cipher

Creates a new ChaCha20 Poly1305 AEAD cipher

type CipherFunc

type CipherFunc interface {
	Cipher(key [32]byte) Cipher
	CipherName() string
}

type FameCipher

type FameCipher struct {
	*abe.FAME
	// contains filtered or unexported fields
}

FameCipher represent the FAME CPABE scheme

func CipherFame

func CipherFame(publisher bool, keyFile string) FameCipher

Creates a new FameCipher object with the given key

func (FameCipher) Decrypt

func (c FameCipher) Decrypt(u uint64, ad, ciphertext []byte) (string, error)

Decrypts a ciphertext generated using the FAME CP-ABE scheme

func (FameCipher) Encrypt

func (c FameCipher) Encrypt(u uint64, policy, msg string) ([]byte, error)

Encrypts a message MSG with a POLICY using the FAME CP-ABE scheme

func (*FameCipher) FameKeygen

func (c *FameCipher) FameKeygen(attributes []string) (*abe.FAMEPubKey, *abe.FAMEAttribKeys)

Jump to

Keyboard shortcuts

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