MCPcopy Create free account
hub / github.com/crewjam/saml / appendPadding

Function appendPadding

xmlenc/cbc.go:177–182  ·  view source on GitHub ↗
(buf []byte, blockSize int)

Source from the content-addressed store, hash-verified

175}
176
177func appendPadding(buf []byte, blockSize int) []byte {
178 paddingBytes := blockSize - (len(buf) % blockSize)
179 padding := make([]byte, paddingBytes)
180 padding[len(padding)-1] = byte(paddingBytes) //nolint:gosec // paddingBytes <= blockSize, which is at most 16 for AES
181 return append(buf, padding...)
182}
183
184// ErrDecryptionFailed is returned for a ciphertext whose decrypted bytes
185// are not valid: in CBC mode, when the padding is not. It carries no detail,

Callers 2

EncryptMethod · 0.85

Calls

no outgoing calls

Tested by 1