cipher_builder.go 832 B

1234567891011121314151617181920212223242526272829
  1. package s3crypto
  2. import "io"
  3. // ContentCipherBuilder is a builder interface that builds
  4. // ciphers for each request.
  5. type ContentCipherBuilder interface {
  6. ContentCipher() (ContentCipher, error)
  7. }
  8. // ContentCipher deals with encrypting and decrypting content
  9. type ContentCipher interface {
  10. EncryptContents(io.Reader) (io.Reader, error)
  11. DecryptContents(io.ReadCloser) (io.ReadCloser, error)
  12. GetCipherData() CipherData
  13. }
  14. // CipherData is used for content encryption. It used for storing the
  15. // metadata of the encrypted content.
  16. type CipherData struct {
  17. Key []byte
  18. IV []byte
  19. WrapAlgorithm string
  20. CEKAlgorithm string
  21. TagLength string
  22. MaterialDescription MaterialDescription
  23. // EncryptedKey should be populated when calling GenerateCipherData
  24. EncryptedKey []byte
  25. }