seal

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: Apache-2.0 Imports: 3 Imported by: 2

README

seal interface

Seal is very minimal crypto service to support signing and sealing of envelops.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SealServiceClass = reflect.TypeOf((*SealService)(nil)).Elem()

Functions

This section is empty.

Types

type AsymmetricSealer

type AsymmetricSealer interface {
	PublicKey() crypto.PublicKey

	PrivateKey() crypto.PrivateKey

	EncodePublicKey() (string, error)

	EncodePrivateKey() (string, error)

	Seal(plaintext []byte, recipient crypto.PublicKey) (ciphertext []byte, err error)

	Open(ciphertext []byte, sender crypto.PublicKey) (plaintext []byte, err error)
}

type AsymmetricSigner

type AsymmetricSigner interface {
	PublicKey() crypto.PublicKey

	PrivateKey() crypto.PrivateKey

	EncodePublicKey() (string, error)

	EncodePrivateKey() (string, error)

	Sign(plaintext []byte) (sign []byte, err error)

	Verify(plaintext, sign []byte) (valid bool, err error)
}

type AuthenticatedCipher

type AuthenticatedCipher interface {
	Key() cipher.AEAD

	Encrypt(plaintext []byte) (ciphertext []byte, err error)

	Decrypt(ciphertext []byte) (plaintext []byte, err error)
}

type CipherOption

type CipherOption interface {
	Apply(*CipherOptions) error
}

type CipherOptions

type CipherOptions struct {
	Algorithm string

	Block cipher.Block
}

type SealService

type SealService interface {
	IssueSealer(algorithm string, bits int) (AsymmetricSealer, error)

	Sealer(options ...SealerOption) (AsymmetricSealer, error)

	IssueSigner(algorithm string, bits int) (AsymmetricSigner, error)

	Signer(options ...SealerOption) (AsymmetricSigner, error)

	AuthenticatedCipher(options ...CipherOption) (AuthenticatedCipher, error)
}

type SealerOption

type SealerOption interface {
	Apply(*SealerOptions) error
}

type SealerOptions

type SealerOptions struct {
	Algorithm string

	PublicKey crypto.PublicKey

	PrivateKey crypto.PrivateKey // optional

}

Jump to

Keyboard shortcuts

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