subdomainencoding

package
v0.0.0-...-9d00342 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidBlockSize indicates hash blocksize <= 0.
	ErrInvalidBlockSize = errors.New("invalid blocksize")

	// ErrInvalidPKCS7Data indicates bad input to PKCS7 pad or unpad.
	ErrInvalidPKCS7Data = errors.New("invalid PKCS7 data (empty or not padded)")

	// ErrInvalidPKCS7Padding indicates PKCS7 unpad fails to bad input.
	ErrInvalidPKCS7Padding = errors.New("invalid padding on input")
)

PKCS7 errors.

Functions

This section is empty.

Types

type BlockCipherEncoder

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

BlockCipherEncoder can encode or decode data using a block cipher into a domain name

func NewBlockCipherEncoder

func NewBlockCipherEncoder(domainName *pkg.DomainName, block cipher.Block) *BlockCipherEncoder

NewBlockCipherEncoder creates a new BlockCipherEncoder

func (*BlockCipherEncoder) Decode

func (be *BlockCipherEncoder) Decode(src []byte) ([]byte, error)

Decode takes a domain name which contains a message encoded using a block cipher

func (*BlockCipherEncoder) Encode

func (be *BlockCipherEncoder) Encode(src []byte) (string, error)

Encode encodes data into a domain name using a block cipher

func (*BlockCipherEncoder) MaxBytes

func (be *BlockCipherEncoder) MaxBytes() int

MaxBytes is the maximum number of bytes that can be encoded into a single domain name taking the cipher block size and base domain name into account

type Encoder

type Encoder interface {
	Decode(src []byte) ([]byte, error)
	Encode(src []byte) (string, error)
}

Encoder is an interface for which can be implemented by and sub-domain encoder allowing the ability to swap between different encoding strategies

Jump to

Keyboard shortcuts

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