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

Function stripPadding

xmlenc/cbc.go:175–187  ·  view source on GitHub ↗
(buf []byte)

Source from the content-addressed store, hash-verified

173}
174
175func stripPadding(buf []byte) ([]byte, error) {
176 if len(buf) < 1 {
177 return nil, errors.New("buffer is too short for padding")
178 }
179 paddingBytes := int(buf[len(buf)-1])
180 if paddingBytes > len(buf)-1 {
181 return nil, errors.New("buffer is too short for padding")
182 }
183 if paddingBytes < 1 {
184 return nil, errors.New("padding must be at least one byte")
185 }
186 return buf[:len(buf)-paddingBytes], nil
187}

Callers 1

DecryptMethod · 0.85

Calls 1

NewMethod · 0.65

Tested by

no test coverage detected