pkcs7

package
v1.67.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package pkcs7 implements PKCS#7 padding

This is a standard way of encoding variable length buffers into buffers which are a multiple of an underlying crypto block size.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorPaddingNotFound      = errors.New("bad PKCS#7 padding - not padded")
	ErrorPaddingNotAMultiple  = errors.New("bad PKCS#7 padding - not a multiple of blocksize")
	ErrorPaddingTooLong       = errors.New("bad PKCS#7 padding - too long")
	ErrorPaddingTooShort      = errors.New("bad PKCS#7 padding - too short")
	ErrorPaddingNotAllTheSame = errors.New("bad PKCS#7 padding - not all the same")
)

Errors Unpad can return

Functions

func Pad

func Pad(n int, buf []byte) []byte

Pad buf using PKCS#7 to a multiple of n.

Appends the padding to buf - make a copy of it first if you don't want it modified.

func Unpad

func Unpad(n int, buf []byte) ([]byte, error)

Unpad buf using PKCS#7 from a multiple of n returning a slice of buf or an error if malformed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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