github.com/aavshr/aws-sdk-go@v1.41.3/service/s3/s3crypto/padder.go (about) 1 package s3crypto 2 3 // Padder handles padding of crypto data 4 type Padder interface { 5 // Pad will pad the byte array. 6 // The second parameter is NOT how many 7 // bytes to pad by, but how many bytes 8 // have been read prior to the padding. 9 // This allows for streamable padding. 10 Pad([]byte, int) ([]byte, error) 11 // Unpad will unpad the byte bytes. Unpad 12 // methods must be constant time. 13 Unpad([]byte) ([]byte, error) 14 // Name returns the name of the padder. 15 // This is used when decrypting on 16 // instantiating new padders. 17 Name() string 18 } 19 20 // NoPadder does not pad anything 21 var NoPadder = Padder(noPadder{}) 22 23 type noPadder struct{} 24 25 func (padder noPadder) Pad(b []byte, n int) ([]byte, error) { 26 return b, nil 27 } 28 29 func (padder noPadder) Unpad(b []byte) ([]byte, error) { 30 return b, nil 31 } 32 33 func (padder noPadder) Name() string { 34 return "NoPadding" 35 }