pkcs7

package
v0.0.0-...-544e413 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2016 License: BSD-2-Clause Imports: 2 Imported by: 1

Documentation

Overview

Package pkcs7 implements PKCS#7 padding, described at http://tools.ietf.org/html/rfc5652#section-6.3.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBlockSize     = errors.New("useless/crypto/pkcs7: block size is out of bounds")
	ErrByteBlockSize = errors.New("useless/crypto/pkcs7: byte length is not a multiple of the block size")
)

Functions

func Pad

func Pad(b []byte, size int) (out []byte, err error)

Pad adds padding, with each padded byte being the total number of bytes added. Byte slice should always be padded even if its a multiple of the block size. This makes it easier to unpad bytes if we can safely assume they are always padded.

Example for a blocksize of 8: -> [DD DD DD DD 04 04 04 04]

func UnPad

func UnPad(b []byte, size int) (out []byte, err error)

UnPad removes padding.

Types

This section is empty.

Jump to

Keyboard shortcuts

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