pkcs7

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 2 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

func Pad

func Pad(b []byte, blockSize int) ([]byte, error)

Pad right-pads the given byte slice with 1 to n bytes, where n is the block size. The size of the result is x times n, where x is at least 1.

func Unpad

func Unpad(b []byte, blockSize int) ([]byte, error)

Unpad validates and unpads data from the given bytes slice. The returned value will be one to n bytes smaller depending on the amount of padding, where n is the block size.

Types

This section is empty.

Jump to

Keyboard shortcuts

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